How do I set up an alternete destination in dial plan

I have a location where I run Chan Dongle and HAve a Grandstream HT503 . I currently send calls from both devices to a separate asterisk box on a public IP .

Recently however the Internet has proven unreliable.

I need to use the ht503 as an alternate destination for the calls coming in on the chan_dongle

I currently use this

my full extensions.conf

exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS$
; exten => sms,n,System(echo "To:\nSubject: Incoming SMS fr$
exten => sms,n,System(echo "From: ${CALLERID(num)}\nT$
exten => sms,n,Set(FILE(/tmp/sms.txt,a)=${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(sendmail -t < /tmp/sms.txt)
exten => sms,n,Hangup()
exten => _.,1,Answer()
exten => _.,n,Set(CALLERID(all)=52${CALLERID(num)})
; exten => _.,n,Goto(from-trunk,${EXTEN},1)
exten => _.,n,Dial(SIP/destination@publicIPServer)

So how can I add an alternate destination ONLY when the call fails to SIP/destination@publicIPServer

I would then like to send to



Firstly, using _. is inadvisable, because it also matches h, i, e, t, etc.

You should put the Dial for the alternative destination immediately after the first Dial. However, in practice, you also need to look at ${HANGUPCAUSE} to make, or at least ${DIALSTATUS}. Otherwise you can end up ringing the destination multiple times

david551 ,
maybe you could be more specific on how to get the hangupcause ?


The values are ISDN clearing cause codes.