I an using callfiles and ARI originate to make outbound calls and continue in the dialplan when answered and sometimes I am getting back from the carrier a 503 route advance. How can I setup asterisk to originate with the next trunk on a 503?
If you weren’t using ARI, you would originate to a local channel and that would handle the failover, checking HANGUPCAUSE, or the underlying SIP cause code, if necessary.
Why are you using ARI?
It is integrated with a business application that sends an http request to initiate the call
I also have a different system that uses callfile to schedule calls
Call files can definitely use a local channel.
I have a suspicion that many people using ARI to originate are using the wrong tool.
What do you mean by using local channel?
Thanks for the information I can probably do that with ARI too.
When does the call file transfer the call to the dialplan?
Channel: XXX/XXX
Callerid: XXX
Context: MyContext
Extension: s
Priority: 1
Set: myvar=var
As soon as the channel is created.
Channel: local/8004441234@outbound-calls
Callerid: XXX
Context: MyContext
Extension: s
Priority: 1
Set: myvar=var
Dialplan
[outbound-calls]
exten => _.,1,Noop()
same => n,Dial(PJSIP/${EXTEN}@trunk1,30)
;Handle failover here
Not sure how you do it in ARI, but it is probably doable there as well.
So as soon there is an answered call it will handle the callfile?
Can I do it like this and if the first Dial is answered it will go out of the context when the call is answered and if not it will dial the second?
[outbound-calls]
exten => _.,1,Noop()
same => n,Dial(PJSIP/${EXTEN}@trunk1,30)
same => n,Dial(PJSIP/${EXTEN}@trunk2,30)
That’s basically how you do a failover in dialplan, although a more thorough implementation tests the reason to avoid, for example, ringing a busy, or unanwered, number twice.
The hangup cause I am getting is 34. Is that the same for regular CONGESTION? How can I get the reason string from the sip header?
Cause No. 34 - no circuit/channel available [Q.850]
This cause indicates that there is no appropriate circuit/channel presently available to handle the call.
It is what the Dial application maps to CONGESTION, but, if you are using SIP, there is strictly speaking, no such status, although Asterisk translates 503, 6xx, and 7xx to it. The official RFC, RFC 3398, doesn’t translate any SIP cause to it.
Providers can provide Reason headers, with these values, which Asterisk can use in preference to translating the SIP one.
I see the reason in the cli but how do I get it in the dialplan?
Look at the DIALSTATUS, variable and the HANGUPCAUSE function. And for the actual Reason header, if present, the PJSIP_HEADER function (there is one for the legacy driver as well).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.