[OpenSIPS-Users] Asterisk Load Balancing with OpenSIPS + dispatcher

Darren Sessions dmsessions at gmail.com
Sun Oct 5 04:31:30 CEST 2008


http://www.opensips.org/html/lcr.html#id2522451

Specifically, you'll want to use either the load_gws() or  
load_gws_from_grp(group_id) functions to pick a gateway out of a pool  
that's been setup in the database. You'll want to have a failure route  
setup so that if OpenSIPS is unable to complete the call with that  
gateway, it pulls another gateway to try.

A combination of those functions, AVPs, and some creative thinking and  
you could build a system that automatically took a gateway out of the  
gateway table and started testing it if there was an issue (these  
would be extremely advanced configs of course).

In any case, you'll want something along these lines (not a perfect  
sample) . .

route[1] {
   ## Outbound Route
   if(!load_gws_from_grp("400")) {
       ## Error loading gateways
       sl_send_reply("503", "Termination Currently Unavailable");
       exit;
   }

   t_on_failure("1");
     if(!t_relay("0x05")) {
     sl_reply_error();
   }

}


failure_route[1] {
   ## Gateway failure route
   if(!t_check_status("408|500|503")) {
     ## No failover routing needed
     exit;
   }
   if(!next_gw()) {
     ## Failed to select next gateway
    exit;
   }

   t_on_failure("1");

   route(1);
}


The general idea being that once your config script has routed the  
call, if it fails it will go to the failure route #1. The failure  
route # 1 will attempt to select another gateway out of the pool and  
re-route the call.

Although outdated and unusable with the latest version of OpenSIPS,  
you may want to check this site out for a idea of how the logic works  
by creating a config with the LCR module options.

http://www.sipwise.com/index.php/products?start=3

Hope this helps.

Cheers,

  - Darren


_____________________________

Darren Sessions
dmsessions at gmail.com
http://www.darrensessions.com
_____________________________





On Oct 4, 2008, at 7:53 PM, John D wrote:

> Hi Darren,
>
> I'd like to use whichever works. I don't have a particular reason  
> for using dispatcher other than running across the module on Google.  
> Are either load_gw or dispatcher clever enough to use a SIP proxy  
> that's available (aka failover in case one node dies) and is it  
> clever enough to know which SIP proxy has less of a load than the  
> other, or does it just round robin?
>
> Thanks.
>
> On Sat, Oct 4, 2008 at 9:48 PM, Darren Sessions  
> <dmsessions at gmail.com> wrote:
> If you're just load balancing two Asterisk servers, why not use the  
> load_gw function?
>
>
> _____________________________
>
> Darren Sessions
> dmsessions at gmail.com
> http://www.darrensessions.com
> _____________________________
>
>
>
>
>
> On Oct 4, 2008, at 7:41 PM, John D wrote:
>
>> All,
>>
>> I'm trying to find some half-decent documentation to get OpenSIPS  
>> working with the dispatcher module for simply load balancing two  
>> Asterisk servers. Most links on voip-info.org and even some on  
>> opensips.org appear dated or 404. I was hoping to try the mail list  
>> to see if anyone could kindly suggest the best resource for  
>> currently setting up the above (and most importantly how to work  
>> with the dispatcher module).
>>
>> Thanks!
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20081004/489b047e/attachment-0001.htm 


More information about the Users mailing list