|
|
@@ -166,11 +166,12 @@ async def presenceStatusCallback(mngr: Manager, msg: Message):
|
|
|
|
|
|
@manager.register_event('Hangup')
|
|
|
async def hangupCallback(mngr: Manager, msg: Message):
|
|
|
- app.logger.warning(msg)
|
|
|
+ if msg.uniqueid in app.cache['calls']:
|
|
|
+ del app.cache['calls'][msg.uniqueid]
|
|
|
|
|
|
@manager.register_event('Newchannel')
|
|
|
async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
- #app.logger.warning(msg)
|
|
|
+ app.logger.warning(msg)
|
|
|
if (msg.channelstate == '4') and ('HTTP_CLIENT' in app.config):
|
|
|
did = None
|
|
|
cid = None
|
|
|
@@ -179,9 +180,11 @@ async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
uid = None
|
|
|
if msg.context in ('from-pstn'):
|
|
|
app.cache['calls'][msg.uniqueid]=msg
|
|
|
+ app.logger.warning('call from pstn')
|
|
|
elif ((msg.context in ('from-queue')) and
|
|
|
(msg.linkedid in app.cache['calls']) and
|
|
|
(msg.exten in app.cache['devicemap'])):
|
|
|
+ app.logger.warning('call from queue')
|
|
|
did = app.cache['calls'][msg.linkedid].exten
|
|
|
cid = app.cache['calls'][msg.linkedid].calleridnum
|
|
|
user = msg.exten
|
|
|
@@ -189,6 +192,7 @@ async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
uid = msg.linkedid
|
|
|
elif ((msg.context in ('from-internal')) and
|
|
|
(msg.exten in app.cache['devicemap'])):
|
|
|
+ app.logger.warning('call from internal')
|
|
|
user = msg.exten
|
|
|
device = app.cache['devicemap'][user]
|
|
|
if msg.calleridnum in app.cache['usermap']:
|
|
|
@@ -197,6 +201,7 @@ async def newchannelCallback(mngr: Manager, msg: Message):
|
|
|
cid = msg.calleridnum
|
|
|
uid = msg.uniqueid
|
|
|
if device is not None:
|
|
|
+ app.logger.warning('gonna make callback')
|
|
|
row = await db.fetch_one(query='SELECT url FROM callback_urls WHERE device = :device',
|
|
|
values={'device': app.cache['devicemap'][user]})
|
|
|
if (row is not None) and ('url' in row) and (row['url'].startswith('http')):
|