aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.py b/main.py
index db8b983..10d4bb4 100755
--- a/main.py
+++ b/main.py
@@ -11,18 +11,21 @@ if __name__ == "__main__":
queue = Queue()
phone_held = Event()
phone_hung_up = Event()
+ processing_event = Event()
# start phone as on hook
phone_held.clear()
phone_hung_up.set()
+ processing_event.clear()
- dial_thread = DialThread(queue)
+ dial_thread = DialThread(queue, phone_held, processing_event)
dial_thread.start()
dial_manager = DialManager(phone_held, phone_hung_up)
hang_up_thread = HangUpThread(phone_held, phone_hung_up, dial_manager)
hang_up_thread.start()
-
+
+ print("Ready")
while True:
try:
# Wait for phone to be picked up
@@ -35,7 +38,9 @@ if __name__ == "__main__":
response = dial_manager.dial(dialed)
# If we matched a sequence, play out event
if response is not None:
+ processing_event.set()
response.speak()
+ processing_event.clear()
except Exception as e:
print(e)