load balancing based on IP

2011-11-11
2013-05-09
  • I am planning to use opensips to load balance/direct traffic to asterisk servers. We have about 40 locations 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 again, etc.?

    The reason I want to do this is to keep 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) .

    I'm very new to opensips and asterisk obviously :)

    Thanks.

     
  • Hi,

    What do you mean by "all the traffic coming from a location to go to the same asterisk server" ? That all traffic related to a call to be sent to same Asterisk, or that completely all traffic (all calls, all registrations, etc) to be sent to same astterisk ?

    In both cases use dispatcher for initial requests only (with record_route() ) with :  algorithm 0 (for case a) or algorithm 7 with src ip as input (for case b) ; for more see http://www.opensips.org/html/docs/modules/1.7.x/dispatcher.html#id293098

    Regards,
    Bogdan

     
  • Thanks Bogdan. I'll go for case b - it should cover device state updates.