[Asterisk-Users] Re: how to originate a call and capture it's DIALSTATUS

Tony Mountifield tony at softins.clara.co.uk
Fri Nov 18 02:22:47 MST 2005


In article <451eb55c0511171906s4ef95925k7e46418404a73764 at mail.gmail.com>,
Script Head <scripthead at 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 at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list