[Asterisk-Users] Failover Registration
Gabriel Afana
asterisk at gafana.com
Mon Mar 6 18:11:33 MST 2006
How would something like this work with LCDial()?
I would think when this is first ran, LCDial() should somehow return the
trunks in order of least cost to highest cost. Define these to variables
trunk1, trunk2, trunk3...etc and then initiate the call through turnk1. If
that fails then go to the next least expensive carrier (trunk2), and so on.
Does this make sense? How can I get LCDial to do something like that? I
think its written in C and I dont know C :-(
Would it be reliable and fast to do this using an AGI script?
- Gabriel Afana
>Try something like this.
>
>Note: I did not write these scripts. I would give credit to who did, but
>unfortunately I do not remember where I got it.
>
>Dan
>
>
>[globals]
>TRUNK1 => IAX2/user:password at provider1.com
>TRUNK2 => IAX2/user:password at provider2.com
>
>; Sets up the outgoing gateway according to availability
>[macro-swap-priority]
>exten => s,1,NoOp(Swapping trunk priority)
>exten => s,n,SetGlobalVar(TRUNKBUF=${TRUNK1})
>exten => s,n,SetGlobalVar(TRUNK1=${TRUNK2})
>exten => s,n,SetGlobalVar(TRUNK2=${TRUNKBUF})
>exten => s,n,NoOp(Swapped)
>exten => s,n,NoOp(Priority 1 ${TRUNK1})
>exten => s,n,NoOP(Priority 2 ${TRUNK2})
>
>; calls the swap-priority macro to find out which gateway is set to the
>default and dials the number.
>[macro-outbound-dial]
>exten => s,1,Wait(3)
>exten => s,n,Set(TIMEOUT(response)=60)
>exten => s,n,Dial(${TRUNK1}/${ARG1})
>exten => s,n,NoOp(TRUNK1 failed)
>exten => s,n,SetVar(A=2)
>exten => s,n,NoOp(rolling over to TRUNK2)
>exten => s,n,Playback(hang-on-a-second)
>exten => s,n,Macro(swap-priority)
>exten => s,n,Wait(2)
>exten => s,n,Dial(${TRUNK1}/${ARG1})
>exten => s,n,Playback(all-outgoing-lines-unavailable)
>exten => s,n,Playback(please-try-again-later)
>exten => s,n,Hangup()
>
>;Call outbound-dial macro
>[from-inside]
>exten => _1XXXXXXXXXX,1,Macro(outbound-dial,${EXTEN})
>
>
More information about the asterisk-users
mailing list