Route Calls After Failing to Pass

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

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=“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 ?

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 .