|
|
@@ -26,7 +26,7 @@ from aiohttp.resolver import AsyncResolver
|
|
|
class ApiJsonEncoder(JSONEncoder):
|
|
|
def default(self, o):
|
|
|
if isinstance(o, dt):
|
|
|
- return o.isoformat()
|
|
|
+ return o.isoformat() + 'Z'
|
|
|
if isinstance(o, CdrChannel):
|
|
|
return str(o)
|
|
|
if isinstance(o, CdrEvent):
|
|
|
@@ -214,6 +214,13 @@ async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
async def celCallback(mngr: Manager, msg: Message):
|
|
|
#app.logger.warning('CEL {}'.format(msg))
|
|
|
lid = msg.LinkedID
|
|
|
+ if (msg.EventName == 'ATTENDEDTRANSFER'):
|
|
|
+ extra = json.loads(msg.Extra)
|
|
|
+ if ('transferee_channel_uniqueid' in exta) and ('channel2_uniqueid' in extra):
|
|
|
+ first = extra['transferee_channel_uniqueid'];
|
|
|
+ second = extra['channel2_uniqueid']
|
|
|
+ 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
|
|
|
app.cache['cel_calls'][lid] = msg
|
|
|
app.cache['cel_calls'][lid]['current_channels'] = {}
|
|
|
@@ -367,7 +374,11 @@ async def getCallInfo(linkedid):
|
|
|
events = CdrEvents()
|
|
|
async for row in db.iterate(query=_q, values=_v):
|
|
|
events.add(row)
|
|
|
- return events.simple()
|
|
|
+ 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'])
|
|
|
+ return record
|
|
|
|
|
|
|
|
|
async def getUserCDR(user,
|