星号AMI传入呼叫不返回任何呼叫

时间:2016-09-14 10:27:37

标签: python asterisk

我有以下功能,目的是从Asterisk服务器获取Python Web界面的来电。

localhost/api/users/2?page=7

但是当我在注册handle_event方法后尝试获取传入的调用事件时,我得到一个空数组。似乎handle_event方法有问题,但我无法找到它。

2 个答案:

答案 0 :(得分:0)

你应该使用(听)' Newexten'事件和摘录' context'从该事件开始,然后查看调用是否来自传入上下文(如果为true),然后使用该事件中的其他变量。不要使用行动' CoreShowChannel'因为它会列出当前的活动频道。

答案 1 :(得分:0)

当有人打电话给Asterisk作为例如来电号码的来电时,Asterisk解雇了' Newexten'事件。该事件的数据结构是:

`{ event: 'Newexten',
   privilege: 'call,all',
   channel: 'SIP/NameOfyourSIPprovider-0000ae7d',//channel that will be bridged
   channelstate: '0',
   channelstatedesc: 'Down',//the channel is currently down because no one is answered
   calleridnum: '060444333',// num of calling party
   calleridname: '<unknown>',
   connectedlinenum: '+34312345678',//your trunk num
   connectedlinename: '<unknown>',
   language: 'en',
   accountcode: '',
   context: 'from-trunk',//context(extensions.conf) for incoming calls
   exten: '060444333',//num of calling party
   priority: '1',
   uniqueid: '1471265139.357602',//unique id of channel
   linkedid: '1471265138.357596',//linked id of channel that will be bridged
   extension: '060444333',//num of calling party
   application: 'AppDial',
   appdata: '(Outgoing Line)' }`