Script Head
2005-Nov-17 20:06 UTC
[Asterisk-Users] how to originate a call and capture it's DIALSTATUS
Hello, I've been trying to originate calls and capture the DIALSTAUS via the manager API. The problem seems that the API doesn't expose enough data to make a decision of what exactly happened to the call. It results in something like this: Action: Originate Channel: IAX2/switch/1<number> MaxRetries: 0 WaitTime: 2 Context: reminder Extension: s Priority: 1 Callerid: "Reminder" <555-555-5555> Event: Hangup Privilege: call,all Channel: IAX2/switch-3 Uniqueid: 1132271784.42 Cause: 0 Cause-txt: Unknown this is far from detailed. Is there a way to extract the actual DIALSTATUS such as ANSWER,BUSY,CONGESION, etc? The Cause doesn't seem to return 0 when the call is terminted thru IAX2 or SIP. It seems that it works on ZAP only. ScriptHead -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20051117/fbd80533/attachment.htm
Tony Mountifield
2005-Nov-18 02:22 UTC
[Asterisk-Users] Re: how to originate a call and capture it's DIALSTATUS
In article <451eb55c0511171906s4ef95925k7e46418404a73764@mail.gmail.com>, Script Head <scripthead@gmail.com> wrote:> > I've been trying to originate calls and capture the DIALSTAUS via the > manager API. The problem seems that the API doesn't expose enough data to > make a decision of what exactly happened to the call. It results in > something like this: > > Action: Originate > Channel: IAX2/switch/1<number> > MaxRetries: 0 > WaitTime: 2 > Context: reminder > Extension: s > Priority: 1 > Callerid: "Reminder" <555-555-5555> > > Event: Hangup > Privilege: call,all > Channel: IAX2/switch-3 > Uniqueid: 1132271784.42 > Cause: 0 > Cause-txt: Unknown > > this is far from detailed. Is there a way to extract the actual DIALSTATUS > such as ANSWER,BUSY,CONGESION, etc? The Cause doesn't seem to return 0 when > the call is terminted thru IAX2 or SIP. It seems that it works on ZAP only.There are two things you could try. 1. Add "Async: yes" to the Originate action, and then watch for the OriginateSuccess and OriginateFailure events. 2. If that doesn't reveal the wanted information, then I would consider it a bug, but you could workaround it by using a Local channel: [outgoing] exten => _X.,1,Dial(IAX2/switch/1${EXTEN}) exten => _X.,2,UserEvent(Fail|Dialstatus: ${DIALSTATUS}) Then in your Originate action use Channel: Local/<number>@outgoing and look for the UserEventFail event. Hope this helps! Cheers Tony -- Tony Mountifield Work: tony@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org