# Route Calls After Failing to Pass

**URL:** <https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660>\
**Category:** Asterisk Support\
**Created:** [October 1, 2015, 1:10pm UTC](https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660 "2015-10-01T13:10:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshoaib](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mshoaib/32/5893_2.png) [@mshoaib](https://community.asterisk.org/u/mshoaib)\
**Post date:** [October 1, 2015, 1:10pm UTC](https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660/1 "2015-10-01T13:10:22Z")

</div>

Hi,  
I would like to know how to pass a call to another route if due to any reason its been unable to pass onto any SIP provider & retries until the call is passed.

Currently my Extensions.conf file is as below.

`
[mobile]
exten => 447940719031,1,Hangup
exten => 447990741790 ,1,Hangup
exten => _0044[7-9].,1,Monitor(gsm,${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},mb)
exten => _0044[7-9].,2,Dial(sip/${EXTEN:2}@mainofficemobile,,o)
exten => _0044[7-9].,3,Dial(sip/${EXTEN:2}@backupmobile,,o)
exten => _0044[7-9].,4,Dial(sip/${EXTEN:2}@otherpromobile,,o)
exten => _0044[7-9].,5,Hangup`

Thanks,  
Regards,  
Mohammad

---

<div class="post-metadata">

**Author:** ![omid.mohajerani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/omid.mohajerani/32/32_2.png) [@omid.mohajerani](https://community.asterisk.org/u/omid.mohajerani)\
**Post date:** [October 1, 2015, 1:39pm UTC](https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660/2 "2015-10-01T13:39:03Z")

</div>

you can work with DIALSTATUS predefined channel variable . Im using it to failover between my e1 and anolog connection .

exten =\> \_9.,1,Dial(${E1Connection}/${EXTEN})  
exten =\> \_9.,n,NoOp(E1 Trunk is not accessible because of ${DIALSTATUS} DialStatus)  
exten =\> \_9.,n,GotoIf($[${DIALSTATUS}=CHANUNAVAIL|${DIALSTATUS}=CONGESTION]?continue:hangup)  
exten =\> \_9.,n(continue),Dial(dahdi/g0/${EXTEN:1})  
exten =\> \_9.,n(hangup),NoOp(Dial failed due to ${DIALSTATUS})  
exten =\> \_9.,n,Hangup

---

<div class="post-metadata">

**Author:** ![mshoaib](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mshoaib/32/5893_2.png) [@mshoaib](https://community.asterisk.org/u/mshoaib)\
**Post date:** [October 1, 2015, 4:16pm UTC](https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660/3 "2015-10-01T16:16:51Z")

</div>

[quote=“omid\_mohajerani”]you can work with DIALSTATUS predefined channel variable . Im using it to failover between my e1 and anolog connection .

exten =\> \_9.,1,Dial(${E1Connection}/${EXTEN})  
exten =\> \_9.,n,NoOp(E1 Trunk is not accessible because of ${DIALSTATUS} DialStatus)  
exten =\> \_9.,n,GotoIf($[${DIALSTATUS}=CHANUNAVAIL|${DIALSTATUS}=CONGESTION]?continue:hangup)  
exten =\> \_9.,n(continue),Dial(dahdi/g0/${EXTEN:1})  
exten =\> \_9.,n(hangup),NoOp(Dial failed due to ${DIALSTATUS})  
exten =\> \_9.,n,Hangup[/quote]

Can we do it via Dial variable ?

---

<div class="post-metadata">

**Author:** ![omid.mohajerani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/omid.mohajerani/32/32_2.png) [@omid.mohajerani](https://community.asterisk.org/u/omid.mohajerani)\
**Post date:** [October 2, 2015, 9:33pm UTC](https://community.asterisk.org/t/route-calls-after-failing-to-pass/49660/4 "2015-10-02T21:33:52Z")

</div>

What do you mean by Dial variable ? I didnt hear about such a variable in asterisk before . DIALSTATUS is the variable that shows the result of Dial application in dialplan .
