[asterisk-users] Fallback on a fallback

Andrew Joakimsen joakimsen at gmail.com
Tue Jul 29 15:24:01 CDT 2008


I have two sites running Asterisk PBX. Normally the inbound calls go
through a 3rd (colocated) server and are routed via IAX to the site
(the site registers with the main server)

I created a macro that tries to ring one location and then another.
Each site explicitly Answer() the call even though it will only ring
all the sip phones at the relevant location. When fall back is in
effect it goes to the other location and then the other PBX server
rings the same phones (they register to both servers, the server at
the other location via VPN). It was implemented this way because at
the time there was a hardware stability issue.

Now I want to add a 3rd failback via a PSTN line. This will be done
from the main colocated server.... so even if the internet at the
location is down calls go to the PBX via the PSTN and if the PBX
server catches fire we setup some Weco 2500 clones (in red) as further
protection. But the issue here is that if we tell it to ring (in this
order) site 1, site 2 and then PSTN and the internet to site 1 is down
it will go to site 2 and be "answered" but since the internet is down
so is the VPN and the call drops there. I can change that, but if only
the PBX server is down (and not the internet or VPN) then I don't want
to use the PSTN line because capacity is only 1 call inbound or
outbound and any subsequent callers would get a busy tone. I also
don't want to send the call out of site 2 directly due to bandwidth
concerns.

Does anyone have a suggestion on how to implement this?

Current setup is exactly as follows

MAIN:

;exten => 13057221371,1,Macro(welcome-message)
;exten => 13057221371,n,Macro(site-fallback,site1/4997|site2/4997|7|7)


[macro-site-fallback]
; ${ARG1) Dialstring 1
; ${ARG2} Dialstring 2
; ${ARG3} Ringtime Peer 1
; ${ARG4} Ringtime PEER 2


exten => s,1,Playtones(ring)
exten => s,2,Dial(${ARG1},${ARG3},m)
exten => s,n,Goto(s-${DIALSTATUS},1)

;exten => s-NOANSWER,1,

;exten => s-BUSY,1,Macro(all-circuits-busy)
;exten => s-BUSY,n,Hangup

exten => _s-.,1,GoTo(s-BACKUP,1)

exten => s-BACKUP,1,Dial(${ARG2},${ARG4},m)
exten => s-BACKUP,n,Goto(s-BACKUP-${DIALSTATUS},1)

exten => s-BACKUP-NOANSWER,1,Macro(no-answer)
exten => s-BACKUP-NOANSWER,n,Hangup

exten => s-BACKUP-BUSY,1,Macro(all-circuits-busy)
exten => s-BACKUP-BUSY,n,Hangup

exten => _s-BACKUP.,1,Macro(network-error)
exten => _s-BACKUP.,n,Hangup



Site 1 or 2 (they are basically identical) but FWIW this is the config
of site 2 for failover of site 1:

exten => 4997,1,Answer
exten => 4997,n,Set(CALLERID(name)="CM Fallback Service})
exten => 4997,n,Dial(SIP/401&SIP/402&SIP/403&SIP/404&SIP/405&SIP/406&SIP/407&SIP/408&SIP/409&SIP/410,90,r)
exten => 4997,n,Playtones(ring)
exten => 4997,n,Wait(1)
exten => 4997,n,VoiceMail(499|u)


pbxserver-sitetwo*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status
410/410                    192.168.12.111   D          5060     Unmonitored
409/409                    192.168.12.100   D          5060     Unmonitored
408/408                    192.168.12.116   D          5060     Unmonitored
406/406                    (Unspecified)    D          0        Unmonitored
405/405                    192.168.12.223   D          5060     Unmonitored
404/404                    (Unspecified)    D          0        Unmonitored
403/403                    192.168.12.248   D          5060     Unmonitored
402/402                    (Unspecified)    D          0        Unmonitored
401/401                    192.168.12.119   D          5060     Unmonitored
210/210                    192.168.0.253    D          5060     OK (39 ms)
209/209                    192.168.0.106    D          5060     OK (40 ms)
208/208                    192.168.0.190    D          5060     OK (40 ms)
207                        (Unspecified)    D          0        UNKNOWN
206/206                    192.168.0.194    D          5060     OK (38 ms)
205/205                    192.168.0.105    D          5060     OK (43 ms)
204/204                    192.168.0.173    D          5060     OK (39 ms)
203/203                    192.168.0.126    D          5060     OK (37 ms)
202/202                    192.168.0.187    D          5060     OK (39 ms)
201/201                    192.168.0.176    D          5060     OK (40 ms)
501/501                    (Unspecified)    D          0        UNKNOWN
20 sip peers [18 online , 2 offline]



More information about the asterisk-users mailing list