[asterisk-users] SIP Load Balancing

Gordon Henderson gordon+asterisk at drogon.net
Thu Oct 28 13:06:00 CDT 2010


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.

Gordon



More information about the asterisk-users mailing list