[OpenSIPS-Users] Problem with load balancer module

Diego Barberio diego.barberio at redmondsoftware.com
Thu Jan 6 20:25:40 CET 2011



Diego Sebastián Barberio

www.redmondsoftware.com
+54 11 48153511 (Ext 143)


-----Original Message-----
From: Diego Barberio [mailto:diego.barberio at redmondsoftware.com] 
Sent: jueves, 06 de enero de 2011 03:50 p.m.
To: 'users at lists.opensips.org'
Subject: Problem with load balancer module

Hello,

I’m testing the Load Balancing module and I have a problem I can’t fix by
myself. The INVITE message is routed correctly to one of the destinations.
However the subsequent ACK and the BYE messages are not sent to the
destinations.

I set up opensips to run only in the udp 5060 port. Then I have two
identical applications: one running on port 5061 and the other on port 5062,
the 3 components are running in the same server which has a single IP
address: 192.168.1.195.
The application is very simple:
	1. Receives the INVITE, starts streaming the RTP, and sends the OK
	2. When the ACK is received injects some music in the streaming
	3. Waits until de BYE is received. Then stops the streaming and
sends the OK.

This is the configuration of the load_balancer table:

mysql> select * from load_balancer;
+----+----------+------------------------+-----------+------------+---------
----+
| id | group_id | dst_uri                | resources | probe_mode |
description |
+----+----------+------------------------+-----------+------------+---------
----+
|  1 |        0 | sip:192.168.1.195:5061 | pstn=1    |          0 |
|
|  2 |        0 | sip:192.168.1.195:5062 | pstn=1    |          0 |
|
+----+----------+------------------------+-----------+------------+---------
----+
I've configured only one resource in each application because I'm just
testing.

Finally, this is the configuration script, which is the one from the
tutorial on the website:

debug=3
log_facility=LOG_LOCAL6

fork=yes
children=4

/* uncomment the following lines to enable debugging */
debug=6
fork=no
#log_stderror=yes

/* uncomment the next line to disable TCP (default on) */
disable_tcp=yes

port=5060

/* uncomment and configure the following line if you want opensips to 
   bind on a specific interface/port/proto (default bind on all available)
*/
listen=udp:192.168.1.195:5060

####### Modules Section ########

#set module path
mpath="/usr/local/lib/opensips/modules/"

loadmodule "maxfwd.so"
loadmodule "sl.so"
loadmodule "db_mysql.so"
loadmodule "tm.so"
loadmodule "uri.so"
loadmodule "rr.so"
loadmodule "dialog.so"
loadmodule "mi_fifo.so"
loadmodule "signaling.so"
loadmodule "textops.so"
loadmodule "load_balancer.so"

# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")


# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
#modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
#modparam("rr", "append_fromtag", 0)
modparam("rr","enable_double_rr",1)
modparam("rr","append_fromtag",1)


# ----- uri params -----
modparam("uri", "use_uri_table", 0)

modparam("dialog", "dlg_flag", 13)
modparam("dialog", "db_mode", 1)
modparam("dialog", "db_url", "mysql://root:Viamonte1621@localhost/opensips")


modparam("load_balancer",
"db_url","mysql://root:Viamonte1621@localhost/opensips")

####### Routing Logic ########


# main request routing logic
route{
	if (!mf_process_maxfwd_header("3")) {
		sl_send_reply("483","looping");
		exit;
	}


	if (!has_totag()) {
		xlog("[Redmond] Hast'n to tag\n");
                # initial request
		record_route();
	} else {
		# sequential request -> obey Route indication
		xlog("[Redmond] Has to tag\n");
		loose_route();
                t_relay();
                exit;
        }

        # handle cancel and re-transmissions
	if ( is_method("CANCEL") ) {
		if ( t_check_trans() )
			t_relay();
		exit;
	}


        # from now on we have only the initial requests
        if (!is_method("INVITE")) {
		xlog("[Redmond] Not invite\n");
		if ( t_check_trans() )
			t_relay();
		exit;
                #send_reply("405","Method Not Allowed");
                #exit;
        }

	load_balance("0","pstn");

        # LB function returns negative if no suitable destination (for
requested resources) is found,
        # or if all destinations are full
        if ($retcode<0) {
		xlog("[Redmond] Service full\n");
		sl_send_reply("500","Service full");
		exit;
        }

	xlog("[Redmond] Selected destination is: $du\n");

        # send it out
	if (!t_relay()) {
		sl_reply_error();
	}
}





It seems that the route is not saved, because the To tag is sent in the ACK
and BYE messages, also the logs I've added are written as expected for each
message. If necesarry I can send a new email with the log attached.
Please, can you help me to find what's wrong?

Thanks
Diego





More information about the Users mailing list