|
|
@@ -242,6 +242,12 @@ async def celCallback(mngr: Manager, msg: Message):
|
|
|
app.cache['cel_calls'][lid]['all_channels'] = {}
|
|
|
app.cache['cel_calls'][lid]['transfers'] = []
|
|
|
#app.cache['cel_calls'][lid]['mix_monitors'] = []
|
|
|
+ if (False or msg.Context=='from-internal'):
|
|
|
+ sip_call_id = await amiChannelGetVar(msg.Channel,"PJSIP_HEADER(read,UniqueId)")
|
|
|
+ if( False and not sip_call_id):
|
|
|
+ sip_call_id = await amiChannelGetVar(msg.Channel,"PJSIP_HEADER(read,Call-ID)")
|
|
|
+ if (sip_call_id):
|
|
|
+ await amiChannelSetVar(msg.Channel,"CDR(userfield)",sip_call_id)
|
|
|
|
|
|
if (lid in app.cache['cel_calls']):
|
|
|
firstMessage = app.cache['cel_calls'][lid]
|
|
|
@@ -546,6 +552,23 @@ async def action():
|
|
|
reply = await manager.send_action(json.loads(_payload))
|
|
|
return str(reply)
|
|
|
|
|
|
+async def amiChannelGetVar(channel,variable):
|
|
|
+ '''AMI GetVar
|
|
|
+ Gets variable using AMI action GetVar to value in background.
|
|
|
+
|
|
|
+ Parameters:
|
|
|
+ channel (string)
|
|
|
+ variable (string): Variable to get
|
|
|
+
|
|
|
+ Returns:
|
|
|
+ string: value if GetVar was successfull, error message overwise
|
|
|
+ '''
|
|
|
+ reply = await manager.send_action({'Action': 'GetVar',
|
|
|
+ 'Variable': variable,
|
|
|
+ 'Channel': channel})
|
|
|
+ app.logger.warning('GetVar({},{}={})'.format(channel,variable,reply.value))
|
|
|
+ return reply.value
|
|
|
+
|
|
|
async def amiGetVar(variable):
|
|
|
'''AMI GetVar
|
|
|
Returns value of requested variable using AMI action GetVar in background.
|
|
|
@@ -673,7 +696,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
|