[OpenSIPS-Users] Problem with load balancer module

Diego Barberio diego.barberio at redmondsoftware.com
Wed Jan 12 22:00:38 CET 2011


Hi Bogdan,

Thanks for your prompt response and all your support. I will correct that
bug, and test again.

Thanks
Diego 

-----Original Message-----
From: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
Sent: miércoles, 12 de enero de 2011 05:58 p.m.
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Problem with load balancer module

That's not true - the contact address is the address of the other end 
point, it does not mean that the communication is done directly between 
the end points. The Route hdr is the one dictating the intermediary 
hops....bottom line , contact points the end point, sequential requests 
will visit opensips because of the Route hdr.

Regards,
Bogdan

Diego Barberio wrote:
> Hi Bogdan,
>
> Thanks again for your response.
> I understand your point but as fair as I know if the contact is set to
> 50257609195 at 192.168.2.165:5061 the subsequent messages (i.e. ACK and BYE)
> will be sent directly to the callee bypassing the proxy. This is OK for
me,
> but I understand that the LB needs to receive the BYE message to keep
track
> of the available resources.
> Please correct me if I'm wrong.
>
> Thanks
> Diego
>
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org
> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
> Sent: miércoles, 12 de enero de 2011 09:15 a.m.
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] Problem with load balancer module
>
> Hi Diego,
>
> The bug seams to be in your callee device. Take a look at the 200 OK it 
> sends:
>
> U 192.168.2.165:5061 -> 192.168.2.165:5060
> SIP/2.0 200 OK..From: "Your Long 
>
Name"<sip:Username at 192.168.2.150:5060>;tag=A46E9878A6B36612423768382DD6C758.
> .To: 
>
<sip:50257609195 at 192.168.2.165>;tag=843e7f0-a502a8c0-13c5-50022-1110-60a48c5
> 6-1110..Call-ID: 
> D059E3F6F50CACFB33B4526B0A1CA112 at 192.168.2
> .150..CSeq: 1 INVITE..Via: SIP/2.0/UDP 
> 192.168.2.165;branch=z9hG4bK7bcf.2d3c8236.0..Via: SIP/2.0/UDP 
>
192.168.2.150:5060;received=192.168.2.150;rport=5060;branch=z9hG4bKC115ED423
> 0E704ED2956D13FC3999153..Record-Route: 
> <sip:192.168.2.165;lr;ftag=A46E98
> 78A6B36612423768382DD6C758;did=08c.697623b5>..Contact: 
> <sip:50257609195 at 192.168.2.165>..Allow: INVITE, CANCEL, ACK, BYE, 
> OPTIONS, INFO..Content-Type: application/sdp..Content-Length: 
> 210....v=0..o=RBTAlerting 2844730 0 IN IP4 192.168.2.165..s=INTEL_
> SIP_CCLIB..i=session information..c=IN IP4 192.168.2.165..t=0 0..m=audio 
> 49152 RTP/AVP 8 101..a=rtpmap:8 PCMA/8000..a=rtpmap:101 
> telephone-event/8000..
> #
>
> The 200 OK is sent from 192.168.2.165:5061, but in contact it places 
> sip:50257609195 at 192.168.2.165 -> the port is missing, so the sequential 
> requests are going to the wrong destination (to 
> sip:50257609195 at 192.168.2.165 which is actually the LB ,not the callee)
>
> Regards,
> Bogdan
>
> Diego Barberio wrote:
>   
>> Hi Bogdan,
>>
>> Have you been able to take a look at the traces I sent?
>>
>> Thanks
>> Diego
>>
>> -----Original Message-----
>> From: users-bounces at lists.opensips.org
>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Diego Barberio
>> Sent: lunes, 10 de enero de 2011 12:51 p.m.
>> To: users at lists.opensips.org
>> Subject: [OpenSIPS-Users] Problem with load balancer module
>>
>> Hi Bogdan,
>>
>> Thank you for your prompt response. I'm sorry I couldn't send the trace
>> before but I had some problems with my network.
>> Also I've change the IP Address schema.
>> The call is originated from 192.168.2.150 to 192.168.2.165:5060 which is
>>     
> the
>   
>> opensips address. Currently, the load balancer is configured to redirect
>>     
> the
>   
>> calls to 192.168.2.165:5061 or 192.168.2.165:5062. In the call I'm
sending
>> the INVITE was redirected to 5061.
>>
>> The you will see that the ACK is not redirected to the destination.
>>
>> Thanks
>> Diego
>>
>> -----Original Message-----
>> From: users-bounces at lists.opensips.org
>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei
Iancu
>> Sent: viernes, 07 de enero de 2011 01:19 p.m.
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] Problem with load balancer module
>>
>> Hi Diego,
>>
>> Could you post a SIP capture of a complete call (starting with INVITE)
>>     
> from
>   
>> the opensips LB machine ?
>>
>> Regards,
>> Bogdan
>>
>> Diego Barberio wrote:
>>   
>>     
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>   
>>>     
>>>       
>> --
>> Bogdan-Andrei Iancu
>> OpenSIPS Event - expo, conf, social, bootcamp
>> 2 - 4 February 2011, ITExpo, Miami,  USA www.voice-system.ro
>>
>>
>> _______________________________________________
>> 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
>>
>>   
>>     
>
>
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Event - expo, conf, social, bootcamp
2 - 4 February 2011, ITExpo, Miami,  USA
www.voice-system.ro


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list