Asterisk dialplan for dialing in multiple carriers in random mode or use as failover
Description:
How to Dial over multiple trunks in asterisk
How to to failover trunk in asterisk vicidial .
for example we consider the below trunks
SIP trunk - 2 nos (sipA & sipB)
PRI trunk - 1 nos ( E1 trunk)
*****************************
Step 1: creating global variable
*****************************
go to extension.conf , and under general context type the below lines
TRUNKA=SIP/sipA
TRUNKB=SIP/sipB
TRUNKC=DAHDI/g0
******************************
Step 2: dialplan
******************************
copy the below dialplan and enter at default context or on your own outbound context.
exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,n,Set(Trunk=${RAND(1|3)})
exten => _9X.,n,GoToIf($[${Trunk} = 1]?trunkA)
exten => _9X.,n,GoToIf($[${Trunk} = 2]?trunkB)
exten => _9X.,n,GoToIf($[${Trunk} = 3]?trunkC)
exten => _9X.,n,Hangup
exten => _9X.,n(trunkA),Dial(${TRUNKA}/${EXTEN:1},,tTo)
exten => _9X.,n(trunkB),Dial(${TRUNKB}/${EXTEN:1},,tTo)
exten => _9X.,n(trunkC),Dial(${TRUNKC}/${EXTEN:1},,tTo)
exten => _9X.,n,Hangup()