Hal De 3 سال پیش
والد
کامیت
41d68a48bb
1فایلهای تغییر یافته به همراه9 افزوده شده و 5 حذف شده
  1. 9 5
      app/app.py

+ 9 - 5
app/app.py

@@ -215,10 +215,13 @@ async def celCallback(mngr: Manager, msg: Message):
   #app.logger.warning('CEL {}'.format(msg))
   lid = msg.LinkedID
   if (msg.EventName == 'ATTENDEDTRANSFER'):
+    app.logger.warning('CEL {}'.format(msg))
     extra = json.loads(msg.Extra)
-    if ('transferee_channel_uniqueid' in exta) and ('channel2_uniqueid' in extra):
+    app.logger.warning('EXTRA {} '.format(extra));
+    if ('transferee_channel_uniqueid' in extra) and ('channel2_uniqueid' in extra):
       first = extra['transferee_channel_uniqueid'];
       second = extra['channel2_uniqueid']
+      app.logger.warning('first {} {}'.format(first,second))
       await db.execute(query='update cdr set transfer_from=(select distinct linkedid from cdr where uniqueid=:first) where linkedid=:second;',values={'first': first,'second': second})
       
   if ((msg.EventName == 'CHAN_START') and (lid == msg.UniqueID)):    #save first msg
@@ -373,11 +376,12 @@ async def getCallInfo(linkedid):
   unique_ids = set()
   events = CdrEvents()
   async for row in db.iterate(query=_q, values=_v):
+    row = dict(row)
+    if row['recordingfile'] is not None and row['recordingfile']  != '':
+      row['recordingfile'] = '/static/records/{d.year}/{d.month:02}/{d.day:02}/{filename}'.format(d=row['calldate'],
+                                                                                            filename=row['recordingfile'])
     events.add(row)
-  record = events.simple()
-  if record['file'] is not None:
-    record['file'] = '/static/records/{d.year}/{d.month:02}/{d.day:02}/{filename}'.format(d=record['start'],
-                                                                                            filename=record['file'])
+  record = events.simple()                                                     
   return record