|
@@ -176,6 +176,16 @@ async def hangupCallback(mngr: Manager, msg: Message):
|
|
|
if msg.uniqueid in app.cache['calls']:
|
|
if msg.uniqueid in app.cache['calls']:
|
|
|
del app.cache['calls'][msg.uniqueid]
|
|
del app.cache['calls'][msg.uniqueid]
|
|
|
|
|
|
|
|
|
|
+@manager.register_event('VarSet')
|
|
|
|
|
+async def VarSetCallback(mngr: Manager, msg: Message):
|
|
|
|
|
+ m = re.search(r"(.*savedb_)(.*)", msg.variable)
|
|
|
|
|
+ app.logger.warning('set vales {} res {}'.format(msg.variable,m))
|
|
|
|
|
+ if (m):
|
|
|
|
|
+ varname = m.group(2)
|
|
|
|
|
+ value = msg.value
|
|
|
|
|
+ app.logger.warning('insert into call_values {}, {}, {}'.format(msg.linkedid,varname,value))
|
|
|
|
|
+ await db.execute(query='insert into call_values (linkedid,name,value) values (:linkedid,:name,:value);',values={'linkedid': msg.linkedid,'name': varname,'value':value})
|
|
|
|
|
+
|
|
|
@manager.register_event('Newchannel')
|
|
@manager.register_event('Newchannel')
|
|
|
async def newchannelCallback(mngr: Manager, msg: Message):
|
|
async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
if (msg.channelstate == '4') and ('HTTP_CLIENT' in app.config):
|
|
if (msg.channelstate == '4') and ('HTTP_CLIENT' in app.config):
|
|
@@ -575,9 +585,15 @@ async def ui():
|
|
|
js_url=app.config['SWAGGER_JS_URL'],
|
|
js_url=app.config['SWAGGER_JS_URL'],
|
|
|
css_url=app.config['SWAGGER_CSS_URL'])
|
|
css_url=app.config['SWAGGER_CSS_URL'])
|
|
|
|
|
|
|
|
|
|
+@app.route('/ami/action', methods=['POST'])
|
|
|
async def action():
|
|
async def action():
|
|
|
_payload = await request.get_data()
|
|
_payload = await request.get_data()
|
|
|
reply = await manager.send_action(json.loads(_payload))
|
|
reply = await manager.send_action(json.loads(_payload))
|
|
|
|
|
+ if (isinstance(reply, list) and
|
|
|
|
|
+ (len(reply) > 1)):
|
|
|
|
|
+ for message in reply:
|
|
|
|
|
+ if (message.event == 'DBGetResponse'):
|
|
|
|
|
+ return message.val
|
|
|
return str(reply)
|
|
return str(reply)
|
|
|
|
|
|
|
|
async def amiChannelGetVar(channel,variable):
|
|
async def amiChannelGetVar(channel,variable):
|