- try to finish answering nodes properly
This commit is contained in:
@@ -22,6 +22,7 @@ CALL_ADDED = multiprocessing.Value('b', False)
|
||||
CALL_REMOVED = multiprocessing.Value('b', False)
|
||||
CALL_LOCK = threading.Lock()
|
||||
|
||||
INTERRUPT_SIGNAL = multiprocessing.Value('b', False)
|
||||
|
||||
# Call state change event
|
||||
class CallState(bt_phone.Observer):
|
||||
@@ -94,13 +95,17 @@ def dial_number(number: str, play_file: str):
|
||||
|
||||
# Answer the call
|
||||
def answer_call(play_file: str):
|
||||
global CALL_PATH, CALL_LOCK, CALL_ADDED
|
||||
global CALL_PATH, CALL_LOCK, CALL_ADDED, INTERRUPT_SIGNAL
|
||||
utils.log('Waiting for incoming call...')
|
||||
|
||||
# Wait for incoming call
|
||||
while not CALL_ADDED.value:
|
||||
time.sleep(0.1)
|
||||
while not CALL_ADDED.value and not INTERRUPT_SIGNAL.value():
|
||||
time.sleep(0.01)
|
||||
|
||||
if INTERRUPT_SIGNAL.value():
|
||||
utils.log(f'Interrupt signal detected, exiting.')
|
||||
return
|
||||
|
||||
utils.log(f'Found incoming call {CALL_PATH}')
|
||||
# CALL_LOCK.release()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user