Issue:
When an inbound call hits my dialplan, it rings multiple extensions in a Dial() command. After 30 seconds, if nobody answers, the call ends instead of continuing to the next step in the dialplan (for example, to a failover extension or voicemail).
Here’s a simplified example of what I’m using:
[from-pstn]
exten => 19843450555,1,NoOp(Incoming call)
same => n,Dial(PJSIP/1001&PJSIP/1002,30,tT)
same => n,NoOp(DIALSTATUS after ring: ${DIALSTATUS})
same => n,GotoIf($["${DIALSTATUS}" != "ANSWER"]?failover)
same => n,Hangup()
same => n(failover),NoOp(Failover to extension 1000)
same => n,Dial(PJSIP/1000,30,tT)
same => n,Hangup()
Problem:
After 30 seconds, the call disconnects instead of moving to the “failover” label. DIALSTATUS shows NOANSWER, but Asterisk doesn’t continue executing the next priority — it just hangs up the call.
Question:
How can I make Asterisk continue the dialplan after Dial() times out, instead of hanging up the call?
[from-pstn]
exten => 19843450555,1,NoOp(DID 19843450555)
same => n,NoOp(DID 19843450555 → RingGroup Econolodge_Inn)
same => n,Set(__RG_EMAIL=dp2473229@gmail.com)
same => n,Set(__RG_NAME=Econolodge_Inn)
same => n,Gosub(rg-dial-12,s,1)
same => n,NoOp(DIALSTATUS after Gosub: ${DIALSTATUS})
same => n,GotoIf($[“${DIALSTATUS}” != “ANSWER”]?failover)
same => n,Hangup()
same => n(failover),NoOp(No Answer – Failover to external: 18668650111)
same => n,System(cd /var/www/html && /usr/bin/php artisan notify:missedcall ‘dp2473229@gmail.com’ ‘${CALLERID(name)}’ ‘${CALLERID(num)}’ ‘Econolodge_Inn’)
same => n,Dial(PJSIP/18668650111@trunk-out,30,tTg)
same => n,Hangup()
[rg-dial-12]
exten => s,1,NoOp(RingGroup Econolodge_Inn - Start Dial)
same => n,Dial(PJSIP/10052001&PJSIP/10052003,30,tTg)
same => n,Return()
Console Output:
Executing [19843450555@from-pstn:1] NoOp(“PJSIP/Econolodge_Inn-00000073”, “DID 19843450555”) in new stack
– Executing [19843450555@from-pstn:2] NoOp(“PJSIP/Econolodge_Inn-00000073”, “DID 19843450555 → RingGroup Econolodge_Inn”) in new stack
– Executing [19843450555@from-pstn:3] Set(“PJSIP/Econolodge_Inn-00000073”, “__RG_EMAIL=dp2473229@gmail.com”) in new stack
– Executing [19843450555@from-pstn:4] Set(“PJSIP/Econolodge_Inn-00000073”, “__RG_NAME=Econolodge_Inn”) in new stack
– Executing [19843450555@from-pstn:5] Gosub(“PJSIP/Econolodge_Inn-00000073”, “rg-dial-12,s,1”) in new stack
– Executing [s@rg-dial-12:1] NoOp(“PJSIP/Econolodge_Inn-00000073”, “RingGroup Econolodge_Inn - Start Dial”) in new stack
– Executing [s@rg-dial-12:2] Dial(“PJSIP/Econolodge_Inn-00000073”, “PJSIP/10052001&PJSIP/10052003,30,tTg”) in new stack
– Called PJSIP/10052001
– Called PJSIP/10052003
– PJSIP/10052003-00000075 connected line has changed. Saving it until answer for PJSIP/Econolodge_Inn-00000073
– PJSIP/10052001-00000074 connected line has changed. Saving it until answer for PJSIP/Econolodge_Inn-00000073
– PJSIP/10052003-00000075 is ringing
– PJSIP/10052001-00000074 is ringing
== Spawn extension (rg-dial-12, s, 2) exited non-zero on ‘PJSIP/Econolodge_Inn-00000073’
== Endpoint 10052001 is now Unreachable
I would say you need to answer the call, as I think this is the provider, or the caller’s provider, cutting off the call, rather than anything that Asterisk is doing. Normally I would say don’t answer, because that will cause the caller to get billed, even if the eventually failed, assuming it is a toll call, for them.
Also, please use the full log, not the console. The full log includes time stamps, which are particularly important for any time related issue.