[asterisk-users] How to setup redundant SIP peers
Nicholas Blasgen
nicholas at blasgen.com
Wed Jan 2 15:13:36 CST 2008
Some email asked for some examples. He's an example system that
will use ViaTalk lines (which allow 2 concurrent calls on a channel,
so I use GroupCount to check for a value of 2). It isn't round-robin
and actually I'd pay someone good money to make a revised Dial()
function that would do round robbin on a defined set of SIP trunks. I
solve the Round Robbin issue right now by periodicly changing
where SIP/trunk0 ... SIP/trunkN point to and then reloading the
configurations. Periodic for me is midnight each night. So every night the
order in priority order is reset.
*Again, just in case someone from Asterisk-Dev or Asterisk-Bus is reading
this: I will donate/pay to have a Round Robbin outbound trunk balancing
scheme developed. Should be able to use any Asterisk supported trunk type
(SIP, IAX2, etc). No need to care about maximum concurrent connections
since if it fails then we're out of lines anyways.*
[globals]
TRY1=SIP/trunk0
TRY2=SIP/trunk1
TRY3=SIP/trunk2
TRY4=SIP/trunk3
TRY5=SIP/trunk4
TRY6=SIP/trunk5
TRY7=SIP/trunk6
TRY8=SIP/trunk7
TRY9=SIP/trunk8
TRY10=SIP/trunk9
TRY11=SIP/trunk10
[macro-which-line]
exten => s,1,set(TRIES=0)
exten => s,n(nextone),set(TRIES=$[${TRIES} + 1]) ; increment TRIES by 1
exten => s,n,set(DIALSTRING=${TRY${TRIES}}) ; assign TRYn to DIALSTRING
exten => s,n,gotoif($["${DIALSTRING}" = ""]?donehere) ; see if we've run out
of things to try
exten => s,n,ChanIsAvail(${DIALSTRING}) ; it will be up or down, no need for
this to be exclusive
exten => s,n,gotoif($[${AVAILSTATUS} = 0]?:nextone)
exten => s,n,gotoif($[${GROUP_COUNT(${DIALSTRING})} >= 2]?nextone) ; have we
used up the allowed calls on this channel
exten => s,n,set(GROUP()=${DIALSTRING}) ; Lock the line! Yay...
exten => s,n,Dial(${DIALSTRING}/1${ARG1}) ; dial the phone
exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?donehere) ; Don't keep
dialing
exten => s,n,NoOp("Moving to the next one...");
exten => s,n,goto(nextone) ; TEMP
exten => s,n(donehere),MacroExit() ; we only get here if everything failed
=================
Okay, that's one example. Your simple two line thing might be better done
another way. Let's say we try this:
1) Place a call two two phone lines at once, but have a single line delayed
by 3 seconds.
Something to this effect:
>> Dial(SIP/trunk0&Local/delayed_trunk1)
Where Delayed_Trunk1 is a macro which calls SLEEP(3) and then Dial(Trunk1).
I could go into more detail, but I'm going to assume you can figure out how
to do this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080102/06d936f7/attachment-0001.htm
More information about the asterisk-users
mailing list