tfix typo in freepbx_glue and add a guard - dmt - source code for the kunsthal art installation (HTM) git clone git://parazyd.org/dmt.git (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 5797d6ec7e7fd68bc50c08c36e3f5b5bba80529e (DIR) parent 64431b113fdf7d743b4cff49d2c9951b89952b62 (HTM) Author: parazyd <parazyd@dyne.org> Date: Fri, 17 Nov 2017 23:45:14 +0100 fix typo in freepbx_glue and add a guard Diffstat: M freepbx-glue/freepbx_glue.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- (DIR) diff --git a/freepbx-glue/freepbx_glue.py b/freepbx-glue/freepbx_glue.py t@@ -21,19 +21,20 @@ def handle_line(logline): parsed = logline.split() # We wait for a ring. - if parsed[4].split('-')[0] == RECEIVER_ID: - # stackno = parsed[4].split('-')[1] - if parsed[6] == 'ringing': - globalvars.weareringing = True - print('We are ringing') - return + if not globalvars.weareringing and not globalvars.wehaveanswered: + if parsed[4].split('-')[0] == RECEIVER_ID: + # stackno = parsed[4].split('-')[1] + if parsed[6] == 'ringing': + globalvars.weareringing = True + print('We are ringing') + return # When a call is answered, the receiver stackno is +1 in hex than # the caller's. # The phone is ringing. if globalvars.weareringing: - if parsed[3] == 'app_dial:' and parsed[5] == 'answered': + if parsed[3] == 'app_dial.c:' and parsed[5] == 'answered': globalvars.weareringing = False globalvars.wehaveanswered = True print('We have answered')