我使用Asterisk Java通过SIP频道拨打各种号码
originateAction.setChannel(" SIP / 10.0.66.118 / 0900044314&#34);
但是当涉及到事件时,频道将变为SIP / 10.0.66.118-0000003f
请建议如何将事件与Originate操作相关联,如DAHDI中显示带有被叫号码的频道。
Manager Event is-->org.asteriskjava.manager.event.NewChannelEvent[dateReceived=Tue Jul 21 18:45:14 IST 2015,privilege='call,all',timestamp='null',calleridname='null',uniqueid='1437484937.66',callerid='null',state='null',calleridnum='null',channel='SIP/10.0.66.118-0000003f',systemHashcode=90910501]
Manager Event is-->org.asteriskjava.manager.event.NewCallerIdEvent[dateReceived=Tue Jul 21 18:45:14 IST 2015,privilege='call,all',timestamp='null',calleridname='null',uniqueid='1437484937.66',callerid='6131000',cidcallingpres='0',cidcallingprestxt='Presentation Allowed, Not Screened',calleridnum='6131000',channel='SIP/10.0.66.118-0000003f',systemHashcode=473578347]
Manager Event is-->org.asteriskjava.manager.event.NewChannelEvent[dateReceived=Tue Jul 21 18:45:15 IST 2015,privilege='call,all',timestamp='null',calleridname='null',uniqueid='1437484938.67',callerid='null',state='null',calleridnum='null',channel='SIP/10.0.66.118-00000040',systemHashcode=856882247]
Manager Event is-->org.asteriskjava.manager.event.NewCallerIdEvent[dateReceived=Tue Jul 21 18:45:15 IST 2015,privilege='call,all',timestamp='null',calleridname='null',uniqueid='1437484938.67',callerid='6131000',cidcallingpres='0',cidcallingprestxt='Presentation Allowed, Not Screened',calleridnum='6131000',channel='SIP/10.0.66.118-00000040',systemHashcode=594588547]
Manager Event is-->org.asteriskjava.manager.event.NewStateEvent[dateReceived=Tue Jul 21 18:45:18 IST 2015,privilege='call,all',timestamp='null',calleridname='null',uniqueid='1437484937.66',callerid='6131000',state='null',calleridnum='6131000',channel='SIP/10.0.66.118-0000003f',systemHashcode=703599489]
Manager Event is-->org.asteriskjava.manager.event.HangupEvent[dateReceived=Tue Jul 21 18:45:44 IST 2015,privilege='call,all',timestamp='null',calleridname='<unknown>',uniqueid='1437484937.66',callerid='6131000',causetxt='User alerting, no answer',cause='19',state='null',calleridnum='6131000',channel='SIP/10.0.66.118-0000003f',systemHashcode=1275756078]
Manager Event is-->org.asteriskjava.manager.event.OriginateResponseEvent[dateReceived=Tue Jul 21 18:45:44 IST 2015,privilege='call,all',reason='3',response='Failure',calleridname='<unknown>',timestamp='null',uniqueid='<null>',actionid='null',internalactionid='498357308_6',context='from-pstn',exten='84',calleridnum='6131000',channel='SIP/10.0.66.118/08755862255',systemHashcode=771938640]
Manager Event is-->org.asteriskjava.manager.event.HangupEvent[dateReceived=Tue Jul 21 18:45:45 IST 2015,privilege='call,all',timestamp='null',calleridname='<unknown>',uniqueid='1437484938.67',callerid='6131000',causetxt='User alerting, no answer',cause='19',state='null',calleridnum='6131000',channel='SIP/10.0.66.118-00000040',systemHashcode=1024010953]
Manager Event is-->org.asteriskjava.manager.event.OriginateResponseEvent[dateReceived=Tue Jul 21 18:45:45 IST 2015,privilege='call,all',reason='3',response='Failure',calleridname='<unknown>',timestamp='null',uniqueid='<null>',actionid='null',internalactionid='1655137665_6',context='from-pstn',exten='5',calleridnum='6131000',channel='SIP/10.0.66.118/09910044314',systemHashcode=618140013]
Manager Event is-->org.asteriskjava.manager.event.RegistryEvent[dateReceived=Tue Jul 21 18:47:34 IST 2015,privilege='system,all',timestamp='null',username='6131000',cause='null',channeldriver='null',status='Registered',domain='10.0.66.118',channel='null',systemHashcode=156354047]
Plz建议。
答案 0 :(得分:0)
在我的C#应用程序中,也使用AMI,使用源操作我使用自己的唯一标识符设置一些变量,然后跟踪VarSet事件以将调用的UniqueId绑定到此变量中指定的我自己的ID。然后使用UniqueId,您可以跟踪呼叫的任何事件。
在您的情况下,您需要执行类似
的操作originateAction.setVariable('myOwnId=myUniqueValue');
然后你可以检查变量和值字段,如果它等于你的值,记住uniqueId值。
还有另一种方法可以将您的原始动作与UniqueId - OriginateResponse事件绑定。
答案 1 :(得分:-1)
UniqueId = "";
var originateResponse = manager.SendEventGeneratingAction(oc, oc.Timeout);
if (originateResponse.Events.Count > 0 && originateResponse.Events[0].UniqueId != null && originateResponse.Events[0].UniqueId != "<unknown>")
{
UniqueId = originateResponse.Events[0].UniqueId;
}