[SR-Users] using kamailio as load balancer

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 29 16:35:36 CET 2011


Hello,

you have to do load balancing only for initial requests, not for 
requests within dialog. For requests within dialog (like NOTIFY) is 
better to rely on record routing.

A good way to build your load balancing config for kamailio is to start 
from disptacher module example:

http://kamailio.org/docs/modules/stable/modules_k/dispatcher.html#id2523004

Remove route[REGISTRAR], route[PRESENCE] and the $rU==$null condition, 
then update route[DISPATCH] to fit your needs.

Cheers,
Daniel

On 11/29/11 4:16 PM, Albert Petit wrote:
> Hello,
>
> I'm trying to setup kamailio as load  balancer  Behind that load 
> balancer I've a registrar and a presence server.
>
> When I start a client for the REGISTER and subscribe messages all 
> looks to work fine. The messages from clients are properly balanced to 
> the backend and responses are forwarded properly to the clients.
>
> However when my presence server sends a NOTIFY I find the load 
> balancer module answers 404 message to the presence server.
> I'm thinking the problem is front-end kamailio cannot locate users.  I 
> am quite newbie to use Kamailio for this purpose so sorry if what i'm 
> saying contains a big mistake.
>
> My load balancer script looks as following:
>
> log_facility=LOG_LOCAL0
>
> fork=yes
> children=4
>
> listen=10.1.1.63:6666 <http://10.1.1.63:6666>
> listen=10.1.1.63:5060 <http://10.1.1.63:5060>
> alias=dev.myenvironment.net <http://dev.genaker.net>
>
> mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"
>
> loadmodule "xlog.so"
>
>
>
> # ----------------- setting module-specific parameters ---------------
>
> #!define WITH_DISP
>
> #!ifdef WITH_DISP
> loadmodule "dispatcher.so"
> loadmodule "db_mysql.so"
> #!endif
>
>
>
> # ----- dispatcher -----
> #!ifdef WITH_DISP
> # Set database used for dispatcher servers. As we will use default 
> values, no further
> # information is needed
> modparam("dispatcher", 
> "db_url","mysql://openser:openserrw@10.1.1.50/openser 
> <http://openser:openserrw@10.1.1.50/openser>")
> #!endif
>
> ####### Routing Logic ########
> route{
> #!ifdef WITH_DISP
> if( uri=~"sip:.*session=chat.*" ) {
>         xlog("L_DEBUG", "PoC:relaying chat session by Request URI");
>         ds_select_dst("1", "3");
>
>         forward();
> } else {
>         xlog("L_DEBUG", "PoC:relaying PoC Session by round-robin");
>         ds_select_dst("1", "4");
>         forward();
> }
> #!else
> xlog("L_DEBUG", "PoC: Relaying by hardcoded route");
> t_relay("10.1.1.50", "6666");
> #!endif
> }
> ~
>
> So the questions are: Does this module need to locate users? Should I 
> include usrloc module iin that sip proxy node in order to be able to 
> locate the users??
>
> Thanks
> Albert
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Dec 5-8, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20111129/7b1b70b0/attachment.htm>


More information about the sr-users mailing list