[asterisk-users] SIP Load Balancing

Tilghman Lesher tlesher at digium.com
Thu Oct 28 13:15:12 CDT 2010


On Thursday 28 October 2010 13:06:00 Gordon Henderson wrote:
> On Thu, 28 Oct 2010, Tim King wrote:
> > On Thu, Oct 28, 2010 at 11:24 AM, Roger Burton West 
<roger at firedrake.org>wrote:
> >> On Thu, Oct 28, 2010 at 11:08:12AM -0400, Tim King wrote:
> >>> I have a very simple setup with two SIP routes to my carrier. I need
> >>> to
> >> 
> >> have
> >> 
> >>> every other phone call placed to that carrier go to a different
> >>> address.
> >> 
> >> I think what you need to do here is check/set a variable in the
> >> astdb.
> >> 
> >> (If the variable is 1, set it to 2 and route via A; otherwise, set it
> >> to 1 and route via B.)
> >> 
> >> Translation of this to dialplan logic is left as an exercise for the
> >> student.
> > 
> > Sorry for the confusion, but the last sentence throws me off.
> > "Translation of this to dialplan logic is left as an exercise for the
> > student." Is this example from some sort of book or is this a way of
> > saying I am left to figure the rest out??
> > 
> > I was hoping to find a simple example of how this works.
> 
> It's a way of leafing you to figure the rest out.
> 
> It's a bastardised version of a quote from many textbooks - along the
> lines of "implementation is left as an excercise to the student" - ie.
> this is the method in general terms, you write nuts & bolts of the code.
> 
> One reference to it might be:
> 
>    http://catb.org/jargon/html/E/exercise--left-as-an.html
> 
> Roger has told you how to do it - use a variable kept in the astdb and
> alternate it
> 
> In pseudo code:
> 
>    if (switch == 1)
>      Dial (SIP/provider1/number)
>      switch = 0
>    else
>     Dial (SIP/provider2/number
>     switch = 1
>    endif
> 
> Now your task is write the actual dialplan. Or you can pay me or Roger
> to do it for you if you like, but really, it's only a few lines of
> dialplan.

GotoIf(${SET(DB(sw/provider)=$[!0${DB(sw/provider)}])}?provider1:provider2)

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list