Răsfoiți Sursa

ведомления в очередях

svetlana 3 ani în urmă
părinte
comite
57bdcf6ce9
1 a modificat fișierele cu 12 adăugiri și 9 ștergeri
  1. 12 9
      app/app.py

+ 12 - 9
app/app.py

@@ -255,19 +255,22 @@ async def celCallback(mngr: Manager, msg: Message):
         reply = await doCallback('groupAnswered', _cb)
     if ((msg.Application == 'Queue') and
         (firstMessage.Context == 'from-pstn')):
-      queue_changed=False
       if (msg.EventName == 'APP_START'):
-        app.cache['cel_queue_calls'][lid] = {'caller': msg.CallerIDnum, 'start': msg.EventTime}
-        queue_changed = True
+        app.cache['cel_queue_calls'][lid] = {'caller': msg.CallerIDnum, 'start': parseDatetime(msg.EventTime).isoformat()}
+        _cb = {'callid': lid, 
+            'caller': msg.CallerIDnum, 
+            'start': parseDatetime(msg.EventTime).isoformat(),
+            'callerfrom': firstMessage.Exten,
+            'queue': msg.Exten,
+            'agents': app.cache['queues'][msg.Exten]}
+        reply = await doCallback('queueEnter', _cb)
       if (msg.EventName in ('APP_END', 'BRIDGE_ENTER')):
         call = app.cache['cel_queue_calls'].pop(lid,False)
         queue_changed = (call != None)
-      if queue_changed :
-        _cb = {'caller': msg.CallerIDnum,
-               'all': list(app.cache['cel_queue_calls'].values())}
-        if (msg.EventName == 'APP_START'):
-          reply = await doCallback('queueEnter', _cb)
-        else:
+        if queue_changed :
+          _cb = {'callid': lid, 
+              'queue': msg.Exten,
+              'agents': app.cache['queues'][msg.Exten]}
           reply = await doCallback('queueLeave', _cb)
     if (msg.EventName == 'LINKEDID_END'):
       app.cache['cel_calls'].pop(lid, False)