Hi All,
So I am now on such a place where im fairly okay-ish with asterisk and how it works.
With that said, I am trying to figure out how to auto forward calls to another asterisk box, before anyone says its easy, let me explain the setup, I obviously cant give real system names or real service provider names or real IP’s so i will do it in a way that should theoretically make sense to most.
Vital Server: This is where all the calls are sent from within the company and this system then splits it to service providers on a load balancing manor + cost effective routing and per IAXVAR for hard coded CLI’s
Service Providers Interconnect: This is 3 Service providers Asterisk Box, Lets Name them SP1. SP2, SP3
Now currently if say SP1 gets a fibre sip failure we manually have to turn off all calls to that SP with the Vital server.
The idea is to make something as follows.
Vitals → SP1 if SP1 is down auto send it to SP2 and if SP2 is down send to SP3
Vitals → SP2 if SP2 is down auto send it to SP3 and if SP3 is down send to SP1
Vitals → SP3 if SP3 is down auto send it to SP1 and if SP1 is down send to SP2
So this means i need to figure out in extensions.conf if it sends it to the Service provider and the service provider gives an error back or anything like that, Not a no answer or hangup or like that just the SIP is down or Call Failed then it needs to redirect that call to SP2.
So the part i use as an example below is in the 1 SP extensions.conf. IP’s removed obviously.
[macro-threecli2]
exten => s,1,GotoIfTime(00:01-11:30,,,?first)
exten => s,2,GotoIfTime(11:30-23:59,,,?second)
exten => s,n(first),Set(DATEONE=${STRFTIME(${EPOCH},Africa/Cairo,%Y%m%d)}1)
exten => s,n,GoTo(getnum)
exten => s,n(second),Set(DATEONE=${STRFTIME(${EPOCH},Africa/Cairo,%Y%m%d)}2)
exten => s,n,GoTo(getnum)
exten => s,n(getnum),Set(CELNUMONE=${DB(List/${DATEONE})})
exten => s,n,Set(CALLERID(number)=27${CELNUMONE:1}) ; To remove the 0 and add 27 infront of the number
exten => s,n,Set(CALLERID(name)==27${CELNUMONE:1}) ; To remove the 0 and add 27 infront of the number
exten => s,n,SIPAddHeader(P-Asserted-Identity:Private sip:Private@SPsbc)
exten => s,n,Dial(SIP/${ARG1}@SPsbc1)
exten => s,n,NoOp( Dial Status: ${DIALSTATUS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n,Hangup()
So now what would i have to add where in this above to forward the call to another SP box if the Dial fails for any reason?
Hope to hear from anyone here. And yes i know i am still using SIP and not PJSip