Page 1 of 1

Fail over Trunk Set up

PostPosted: Wed Jan 25, 2012 4:20 pm
by chasejordan1
I would like to set up a fail over trunk. Example config below.

exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,2,NoOp(LB IS ${lb_trunk})
exten => _9X.,3,GotoIf($[${lb_trunk} != 0]?10)
exten => _9X.,4,Set(GLOBAL(lb_trunk)=1)
exten => _9X.,5,Dial(${trunk1}/${EXTEN:2},,tTor)

exten => _9X.,10,GotoIf($[${lb_trunk} != 1]?20)
exten => _9X.,11,Set(GLOBAL(lb_trunk)=2)
exten => _9X.,12,Dial(${trunk2}/${EXTEN:2},,tTor)

exten => _9X.,20,GotoIf($[${lb_trunk} != 2]?30)
exten => _9X.,21,Set(GLOBAL(lb_trunk)=3)
exten => _9X.,22,Dial(${trunk3}/${EXTEN:2},,tTor)

exten => _9X.,30,GotoIf($[${lb_trunk} != 3]?40)
exten => _9X.,31,Set(GLOBAL(lb_trunk)=4)
exten => _9X.,32,Dial(${trunk4}/${EXTEN:2},,tTor)

exten => _9X.,40,GotoIf($[${lb_trunk} != 4]?50)
exten => _9X.,41,Set(GLOBAL(lb_trunk)=5)
exten => _9X.,42,Dial(${trunk5}/${EXTEN:2},,tTor)

exten => _9X.,50,Set(GLOBAL(lb_trunk)=0)
exten => _9X.,51,Goto(1)

So I load balance a few Voip carriers and what I would like to do is if any of the carries is "offline" or BUSY, CONGESTION, CANCEL, NOANSWER, CHANALUNAVAIL, etc I would like the call to goto trunk 6 (as an example) is there a simple "Gotoif" i can put in my dial string to make this work?

Any input would be great thanks Thad

PostPosted: Wed Jan 25, 2012 7:15 pm
by williamconley
ordinarily exten +101 is the standard "failed" outbound dial attempt.

this is best looked at in the asterisk forums, though. a lot more help there. really. :)

PostPosted: Thu Jan 26, 2012 1:38 pm
by chasejordan1
Ok so here is what I set up, it is for many different trunks to load balance and then fail over. I have it set up this way because, each "trunk" is only one line, and the carrier identifies each line with a specific callerid, So I set up one carrier (trunk1) and just had to change the callerid for each "line" and if that line is not available because I am only allowed 1 to 1 then it will continue to go down the list till it finds a line available or hits the fail over line. Hope this helps someone.

exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,2,NoOp(LB IS ${lb_trunk})
exten => _9X.,3,GotoIf($[${lb_trunk} != 1]?20)
exten => _9X.,4,Set(GLOBAL(lb_trunk)=2)
exten => _9X.,5,Set(CALLERID(num)=9166742654)
exten => _9X.,6,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?20)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?20)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?20)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?20)

exten => _9X.,20,GotoIf($[${lb_trunk} != 2]?30)
exten => _9X.,21,Set(GLOBAL(lb_trunk)=3)
exten => _9X.,22,Set(CALLERID(num)=9166742136)
exten => _9X.,23,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?30)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?30)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?30)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?30)

exten => _9X.,30,GotoIf($[${lb_trunk} != 3]?40)
exten => _9X.,31,Set(GLOBAL(lb_trunk)=4)
exten => _9X.,32,Set(CALLERID(num)=9166235416)
exten => _9X.,33,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?40)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?40)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?40)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?40)

exten => _9X.,40,GotoIf($[${lb_trunk} != 4]?50)
exten => _9X.,41,Set(GLOBAL(lb_trunk)=5)
exten => _9X.,42,Set(CALLERID(num)=9162377290)
exten => _9X.,43,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?50)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?50)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?50)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?50)

exten => _9X.,50,GotoIf($[${lb_trunk} != 5]?60)
exten => _9X.,51,Set(GLOBAL(lb_trunk)=6)
exten => _9X.,52,Set(CALLERID(num)=9166742362)
exten => _9X.,53,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?60)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?60)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?60)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?60)

exten => _9X.,60,GotoIf($[${lb_trunk} != 6]?70)
exten => _9X.,61,Set(GLOBAL(lb_trunk)=7)
exten => _9X.,62,Set(CALLERID(num)=9166294389)
exten => _9X.,63,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?70)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?70)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?70)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?70)

exten => _9X.,70,GotoIf($[${lb_trunk} != 7]?80)
exten => _9X.,71,Set(GLOBAL(lb_trunk)=8)
exten => _9X.,72,Set(CALLERID(num)=9166742336)
exten => _9X.,73,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?80)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?80)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?80)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?80)

exten => _9X.,80,GotoIf($[${lb_trunk} != 8]?90)
exten => _9X.,81,Set(GLOBAL(lb_trunk)=9)
exten => _9X.,82,Set(CALLERID(num)=9162593815)
exten => _9X.,83,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?90)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?90)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?90)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?90)

exten => _9X.,90,GotoIf($[${lb_trunk} != 9]?100)
exten => _9X.,91,Set(GLOBAL(lb_trunk)=10)
exten => _9X.,92,Set(CALLERID(num)=9162519152)
exten => _9X.,93,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?100)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?100)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?100)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?100)

exten => _9X.,100,GotoIf($[${lb_trunk} != 10]?110)
exten => _9X.,101,Set(GLOBAL(lb_trunk)=11)
exten => _9X.,102,Set(CALLERID(num)=9165728490)
exten => _9X.,103,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?110)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?110)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?110)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?110)

exten => _9X.,110,GotoIf($[${lb_trunk} != 11]?120)
exten => _9X.,111,Set(GLOBAL(lb_trunk)=12)
exten => _9X.,112,Set(CALLERID(num)=9166742193)
exten => _9X.,113,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?120)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?120)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?120)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?120)

exten => _9X.,120,GotoIf($[${lb_trunk} != 12]?130)
exten => _9X.,121,Set(GLOBAL(lb_trunk)=13)
exten => _9X.,122,Set(CALLERID(num)=9162413391)
exten => _9X.,123,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?130)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?130)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?130)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?130)

exten => _9X.,130,GotoIf($[${lb_trunk} != 13]?140)
exten => _9X.,131,Set(GLOBAL(lb_trunk)=14)
exten => _9X.,132,Set(CALLERID(num)=9162519145)
exten => _9X.,133,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?140)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?140)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?140)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?140)

exten => _9X.,140,GotoIf($[${lb_trunk} != 14]?150)
exten => _9X.,141,Set(GLOBAL(lb_trunk)=15)
exten => _9X.,142,Set(CALLERID(num)=9165838704)
exten => _9X.,143,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?fail)
exten => _9X.,n(fail),Dial(${trunk2}/${EXTEN:1},,tTor)

exten => _9X.,150,GotoIf($[${lb_trunk} != 15]?160)
exten => _9X.,151,Set(GLOBAL(lb_trunk)=16)
exten => _9X.,152,Set(CALLERID(num)=9162593854)
exten => _9X.,153,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?160)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?160)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?160)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?160)

exten => _9X.,160,GotoIf($[${lb_trunk} != 16]?170)
exten => _9X.,161,Set(GLOBAL(lb_trunk)=17)
exten => _9X.,162,Set(CALLERID(num)=9162585396)
exten => _9X.,163,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?170)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?170)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?170)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?170)

exten => _9X.,170,GotoIf($[${lb_trunk} != 17]?180)
exten => _9X.,171,Set(GLOBAL(lb_trunk)=18)
exten => _9X.,172,Set(CALLERID(num)=9162519320)
exten => _9X.,173,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?180)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?180)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?180)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?180)

exten => _9X.,180,GotoIf($[${lb_trunk} != 18]?190)
exten => _9X.,181,Set(GLOBAL(lb_trunk)=19)
exten => _9X.,182,Set(CALLERID(num)=9165725174)
exten => _9X.,183,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?190)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?190)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?190)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?190)

exten => _9X.,190,GotoIf($[${lb_trunk} != 19]?200)
exten => _9X.,191,Set(GLOBAL(lb_trunk)=20)
exten => _9X.,192,Set(CALLERID(num)=9162353716)
exten => _9X.,193,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?200)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?200)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?200)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?200)

exten => _9X.,200,GotoIf($[${lb_trunk} != 20]?210)
exten => _9X.,201,Set(GLOBAL(lb_trunk)=21)
exten => _9X.,202,Set(CALLERID(num)=9165724174)
exten => _9X.,203,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?210)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?210)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?210)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?210)

exten => _9X.,210,GotoIf($[${lb_trunk} != 21]?220)
exten => _9X.,211,Set(GLOBAL(lb_trunk)=22)
exten => _9X.,212,Set(CALLERID(num)=9162430542)
exten => _9X.,213,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?220)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?220)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?220)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?220)

exten => _9X.,220,GotoIf($[${lb_trunk} != 22]?230)
exten => _9X.,221,Set(GLOBAL(lb_trunk)=23)
exten => _9X.,222,Set(CALLERID(num)=9166235248)
exten => _9X.,223,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?230)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?230)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?230)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?230)

exten => _9X.,230,GotoIf($[${lb_trunk} != 23]?240)
exten => _9X.,231,Set(GLOBAL(lb_trunk)=24)
exten => _9X.,232,Set(CALLERID(num)=9162430546)
exten => _9X.,233,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?240)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?240)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?240)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?240)

exten => _9X.,240,GotoIf($[${lb_trunk} != 24]?250)
exten => _9X.,241,Set(GLOBAL(lb_trunk)=25)
exten => _9X.,242,Set(CALLERID(num)=9165468804)
exten => _9X.,243,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?250)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?250)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?250)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?250)

exten => _9X.,250,GotoIf($[${lb_trunk} != 25]?260)
exten => _9X.,251,Set(GLOBAL(lb_trunk)=26)
exten => _9X.,252,Set(CALLERID(num)=9165728458)
exten => _9X.,253,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?260)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?260)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?260)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?260)

exten => _9X.,260,GotoIf($[${lb_trunk} != 26]?270)
exten => _9X.,261,Set(GLOBAL(lb_trunk)=27)
exten => _9X.,262,Set(CALLERID(num)=9165725268)
exten => _9X.,263,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?270)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?270)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?270)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?270)

exten => _9X.,270,GotoIf($[${lb_trunk} != 27]?280)
exten => _9X.,271,Set(GLOBAL(lb_trunk)=28)
exten => _9X.,272,Set(CALLERID(num)=9162353714)
exten => _9X.,273,Dial(${trunk1}/${EXTEN:2},,tTor)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?fail)
exten => _9X.,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?fail)
exten => _9X.,n(fail),Dial(${trunk2}/${EXTEN:1},,tTor)

exten => _9X.,280,Set(GLOBAL(lb_trunk)=1)
exten => _9X.,281,Goto(2)

PostPosted: Fri Jan 27, 2012 2:13 pm
by Op3r
Say goodbye to your vicidial_auto_calls table if you do that.

Plus you are not supposed to put in CALLERID on the dialplan. You set it on the campaign menu.

PostPosted: Fri Jan 27, 2012 3:13 pm
by williamconley
I don't see a problem with it, but I don't know why you put the callerid in the run. Unless the carrier is "unusual" and actually checks the callerid. But changing the callerid NUM is fine in vicidial (never mess with the NAME, though!)

Let us know how it runs. If you need tweaking. Perhaps an easier method of automating the creation of the failover routines from existing trunks. 8-)

Re: Fail over Trunk Set up

PostPosted: Fri Sep 28, 2012 8:25 pm
by udfxrookie
I went to my main carrier that I want to start the call with and use that prefix for the campaign (in my case 7).
Then I changed the dialplan of that carrier to:
Code: Select all
exten => _71NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _71NXXNXXXXXX,n,Dial(${DIAL7TRUNK}/${EXTEN:1},,Ttor)
exten => _71NXXNXXXXXX,n,Dial(${DIAL8TRUNK}/${EXTEN:1},,Ttor)
exten => _71NXXNXXXXXX,n,Dial(${DIAL9TRUNK}/${EXTEN:1},,Ttor)
exten => _71NXXNXXXXXX,n,Hangup


and since each carrier is setup within vici and set to active the globals are set and can call each individual carrier, correct?
Is more needed to define the reason to use the next carrier?
Created from: http://www.eflo.net/VICIDIALforum/viewtopic.php?f=7&t=9662&sid=f3c8b3e785337038d02ae1d882a9702a