Преглед на файлове

филтровать ансвер для группы

svetlana преди 3 години
родител
ревизия
945772709b
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      app/app.py

+ 10 - 1
app/app.py

@@ -221,6 +221,14 @@ async def celCallback(mngr: Manager, msg: Message):
     firstMessage = app.cache['cel_calls'][lid]
     cid = firstMessage.CallerIDnum
     uid = firstMessage.LinkedID
+    if ((msg.Application == 'Queue') and
+        (msg.EventName == 'APP_START') and 
+        (firstMessage.Context == 'from-internal')):
+      app.cache['cel_calls'][lid]['groupCall'] = True
+    if ((msg.Application == 'Queue') and
+        (msg.EventName == 'APP_END') and 
+        (firstMessage.Context == 'from-internal')):
+      app.cache['cel_calls'][lid].pop('groupCall', False)
     if (cid is not None) and (len(cid) < 7):                         #for local calls only
       if msg.Context in ('from-queue'):
         if ((msg.EventName == 'CHAN_START') or
@@ -236,6 +244,7 @@ async def celCallback(mngr: Manager, msg: Message):
           reply = await doCallback('groupRinging', _cb)
       if ((msg.EventName == 'ANSWER') and
           (msg.Application == 'AppDial') and
+          ('groupCall' in firstMessage) and 
           (lid in app.cache['cel_calls'])):
         called = msg.Exten
         app.cache['cel_calls'][lid]['answered'] = True
@@ -245,7 +254,7 @@ async def celCallback(mngr: Manager, msg: Message):
                'callId': uid}
         reply = await doCallback('groupAnswered', _cb)
     if ((msg.Application == 'Queue') and
-        (firstMessage.Context == 'from-pstn')):                                 
+        (firstMessage.Context == 'from-pstn')):
       queue_changed=False
       if (msg.EventName == 'APP_START'):
         app.cache['cel_queue_calls'][lid] = {'caller': msg.CallerIDnum, 'start': msg.EventTime}