|
|
@@ -151,7 +151,7 @@ async def reloadCallback(mngr: Manager, msg: Message):
|
|
|
async def extensionStatusCallback(mngr: Manager, msg: Message):
|
|
|
user = msg.exten
|
|
|
state = msg.statustext.lower()
|
|
|
- app.logger.warning('ExtensionStatus({}, {})'.format(user, state))
|
|
|
+ #app.logger.warning('ExtensionStatus({}, {})'.format(user, state))
|
|
|
if user in app.cache['ustates']:
|
|
|
prevState = getUserStateCombined(user)
|
|
|
app.cache['ustates'][user] = state
|
|
|
@@ -218,9 +218,8 @@ 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))
|
|
|
+ #app.logger.warning('CEL {}'.format(msg))
|
|
|
extra = json.loads(msg.Extra)
|
|
|
- app.logger.warning('EXTRA {} '.format(extra));
|
|
|
if ('transferee_channel_uniqueid' in extra) and ('channel2_uniqueid' in extra):
|
|
|
first = extra['transferee_channel_uniqueid']; #unique
|
|
|
second = extra['channel2_uniqueid'] #linked
|
|
|
@@ -228,14 +227,12 @@ async def celCallback(mngr: Manager, msg: Message):
|
|
|
secondname = extra['channel2_name']
|
|
|
if (True or msg.CallerIDrdnis == '78124254209'):
|
|
|
res = await amiStopMixMonitor(firstname);
|
|
|
- app.logger.warning('{}'.format(res))
|
|
|
filename = "transfer-{}-{}-{}".format(msg.Exten, msg.CallerIDnum, msg.LinkedID);
|
|
|
res = await amiStartMixMonitor(firstname,filename);#2022/03/11/external-2534-1934-20220311-122726-1647001646.56557.wav
|
|
|
res = await amiChannelSetVar(firstname,"CDR(recordingfile)","{}.wav".format(filename))
|
|
|
- app.logger.warning('{}'.format(res));
|
|
|
#await amiStopMixMonitor(secondname);
|
|
|
app.cache['cel_calls'][lid]['transfers'].append((first,second)) #no cdr in db here
|
|
|
- app.logger.warning('first {} {}'.format(first,second))
|
|
|
+ #app.logger.warning('first {} {}'.format(first,second))
|
|
|
|
|
|
if ((msg.EventName == 'CHAN_START') and (lid == msg.UniqueID)): #save first msg
|
|
|
app.cache['cel_calls'][lid] = msg
|
|
|
@@ -340,7 +337,7 @@ async def celCallback(mngr: Manager, msg: Message):
|
|
|
|
|
|
if (msg.EventName == 'LINKEDID_END'):
|
|
|
for t in firstMessage['transfers']:
|
|
|
- app.logger.warning('first {}'.format(t))
|
|
|
+ #app.logger.warning('first {}'.format(t))
|
|
|
(f,s) = t
|
|
|
await db.execute(query='update cdr set transfer_from=(select distinct linkedid from cdr where uniqueid=:first) where linkedid=:second;',values={'first': f,'second': s})
|
|
|
app.cache['cel_calls'].pop(lid, False)
|
|
|
@@ -439,7 +436,7 @@ async def getUserCDR(user,
|
|
|
if None not in (limit, offset):
|
|
|
_q += f''' LIMIT {offset},{limit}'''
|
|
|
_q += f''') AS c2 ON c.linkedid = c2.linkedid;'''
|
|
|
- app.logger.warning('SQL: {}'.format(_q))
|
|
|
+ #app.logger.warning('SQL: {}'.format(_q))
|
|
|
_cdr = {}
|
|
|
async for row in db.iterate(query=_q):
|
|
|
if (row['disposition']=='FAILED' and row['lastapp']=='Queue'):
|
|
|
@@ -523,7 +520,7 @@ async def amiGetVar(variable):
|
|
|
'''
|
|
|
reply = await manager.send_action({'Action': 'GetVar',
|
|
|
'Variable': variable})
|
|
|
- app.logger.warning('GetVar({})->{}'.format(variable, reply.value))
|
|
|
+ #app.logger.warning('GetVar({})->{}'.format(variable, reply.value))
|
|
|
return reply.value
|
|
|
|
|
|
@app.route('/ami/auths')
|
|
|
@@ -574,7 +571,7 @@ async def amiStartMixMonitor(channel,filename):
|
|
|
'options': 'ai(LOCAL_MIXMON_ID)',
|
|
|
'Command': "/etc/asterisk/scripts/wav2mp3.sh {} {} {} {}".format(year,month,day,filename),
|
|
|
'File': fullname})
|
|
|
- app.logger.warning('MixMonitor({}, {})'.format(channel, fullname))
|
|
|
+ #app.logger.warning('MixMonitor({}, {})'.format(channel, fullname))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return None
|
|
|
@@ -592,7 +589,7 @@ async def amiStopMixMonitor(channel):
|
|
|
'''
|
|
|
reply = await manager.send_action({'Action': 'StopMixMonitor',
|
|
|
'Channel': channel})
|
|
|
- app.logger.warning('StopMixMonitor({})'.format(channel))
|
|
|
+ #app.logger.warning('StopMixMonitor({})'.format(channel))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return None
|
|
|
@@ -614,7 +611,7 @@ async def amiUserEvent(name, data):
|
|
|
reply = await manager.send_action({**{'Action': 'UserEvent',
|
|
|
'UserEvent': name},
|
|
|
**data})
|
|
|
- app.logger.warning('UserEvent({})'.format(name))
|
|
|
+ #app.logger.warning('UserEvent({})'.format(name))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return None
|
|
|
@@ -638,7 +635,7 @@ async def amiChannelSetVar(channel,variable, value):
|
|
|
'Variable': variable,
|
|
|
'Channel': channel,
|
|
|
'Value': value})
|
|
|
- app.logger.warning('SetVar({},{}={})'.format(channel,variable, value))
|
|
|
+ #app.logger.warning('SetVar({},{}={})'.format(channel,variable, value))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return None
|
|
|
@@ -660,7 +657,7 @@ async def amiSetVar(variable, value):
|
|
|
reply = await manager.send_action({'Action': 'SetVar',
|
|
|
'Variable': variable,
|
|
|
'Value': value})
|
|
|
- app.logger.warning('SetVar({}, {})'.format(variable, value))
|
|
|
+ #app.logger.warning('SetVar({}, {})'.format(variable, value))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return None
|
|
|
@@ -686,7 +683,7 @@ async def amiDBGet(family, key):
|
|
|
(len(reply) > 1)):
|
|
|
for message in reply:
|
|
|
if (message.event == 'DBGetResponse'):
|
|
|
- app.logger.warning('DBGet(/{}/{})->{}'.format(family, key, message.val))
|
|
|
+ #app.logger.warning('DBGet(/{}/{})->{}'.format(family, key, message.val))
|
|
|
return message.val
|
|
|
app.logger.warning('DBGet(/{}/{})->Error!'.format(family, key))
|
|
|
return None
|
|
|
@@ -765,7 +762,7 @@ async def amiPresenceState(user):
|
|
|
'''
|
|
|
reply = await manager.send_action({'Action': 'PresenceState',
|
|
|
'Provider': 'CustomPresence:{}'.format(user)})
|
|
|
- app.logger.warning('PresenceState({})'.format(user))
|
|
|
+ #app.logger.warning('PresenceState({})'.format(user))
|
|
|
if isinstance(reply, Message):
|
|
|
if reply.success:
|
|
|
return True, reply.state
|
|
|
@@ -993,7 +990,7 @@ async def userStateChangeCallback(user, state, prevState = None):
|
|
|
'prev_state':prevState}
|
|
|
reply = await doCallback(device, _cb)
|
|
|
|
|
|
- app.logger.warning('{} changed state to: {}'.format(user, state))
|
|
|
+ #app.logger.warning('{} changed state to: {}'.format(user, state))
|
|
|
return reply
|
|
|
|
|
|
def getUserStateCombined(user):
|