[OpenSIPS-Users] load balancing based on source IP

Vlad Paiu vladpaiu at opensips.org
Fri Nov 11 09:59:40 CET 2011


Hello,

You can use the dispatcher module to accomplish this. Please check the 
hash_pvar param [1] and the ds_select_dst() func [2] with the 7th 
algorithm.

So what you need to do is put the $si ( source IP ) in the hash_pvar 
AVP, and then call ds_select_dst("1","7"). This will lead to having 
calls from the same IP to be routed to the same Asterisk server.


[1] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id250265
[2] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id292791

Regards,

Vlad Paiu
OpenSIPS Developer


On 11/11/2011 02:51 AM, Mistral 66 wrote:
> I am planning to use opensips to load balance/direct traffic to 
> asterisk servers. We have about 40 locations (will have many more) 
> with 5 phones each, and we would like to have all the traffic coming 
> from a location to go to the same asterisk server; i.e., if the first 
> SIP message from location 1 is sent to Server A, we would like the 
> other messages coming from there also sent to A. Is this possible? 
> Traffic from each location will be more or less the same, so can 
> opensips do the load balancing maybe in a round robin style (I guess 
> via dispatcher) taking the source IP into consideration; e.g. location 
> 1 goes to server A, location 2 goes to server B, location 3 goes to 
> server C, location 4 goes to server A, etc.?
>
> The reason I want to do this is to keep the device state information 
> for each location on the same Asterisk server (I'm not sure if 
> asterisk can store device state data in a database for realtime 
> updates and lookups) and maybe avoid extra messaging (e.g. openais) 
> betwen asterisk servers to distribute the device state data.
>
>  I'm very new to opensips and asterisk...
>
> Thanks,
> Matt
>
>
> _______________________________________________
> 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/20111111/3581abb7/attachment.htm>


More information about the Users mailing list