[OpenSIPS-Devel] [ opensips-Bugs-3604147 ] load_balance in failure_route

SourceForge.net noreply at sourceforge.net
Sat Feb 16 10:30:35 CET 2013


Bugs item #3604147, was opened at 2013-02-11 11:12
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3604147&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
>Group: 1.9.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Seth Schultz (sethschultz)
>Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: load_balance in failure_route

Initial Comment:
Hello,

I call load_balance in my failure_route for sip_codes "(408)|[56][0-9]{2}".  This works, however, once all of the destinations have been exhausted, it continually tries to load balance the call to the last address, instead of returning false.  Please see the snippet below.

failure_route[1]
{
...
if (t_was_cancelled())
{
    exit;
}

if (is_method("INVITE") && $tt == NULL && t_check_status("(403)|(404)|(408)|([56][0-9]{2})"))
{
if(load_balance("1", "pstn", "1"))
{
...  #this code gets continually called with the last address in the pool instead of hitting the else condition below
}
else
{
    send_reply("$rs","$rr");
    exit;
}
}
...
}

----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2013-02-16 01:30

Message:
Hi Seth,

Tested with trunk version (and 1.9) with this script:

failure_route[lb]
{
	if (load_balance("1","pstn","1") ) {
		xlog("L_DEBUG", "\n===DESTINATION IS $du===\n");
		t_on_failure("lb");
		t_relay();
	}
}


route {

	load_balance("1","pstn","1");
	xlog("L_DEBUG", "\n===DESTINATION IS $du===\n");
	t_on_failure("lb");

	t_relay();
	exit;
}


I used 2 destinations in LB  and it stopped after the second failure . See
here the logs :

Feb 16 11:28:52 [24870] DBG:load_balancer:do_load_balance: found requested
(0) resource pstn
Feb 16 11:28:52 [24870] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.10> selected for LB set with free=100 (max=100)
Feb 16 11:28:52 [24870] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.15> selected for LB set with free=100 (max=100)
Feb 16 11:28:52 [24870] DBG:load_balancer:do_load_balance: winning
destination <sip:127.0.0.10> selected for LB set with free=100
.....
Feb 16 11:28:57 [24877] DBG:load_balancer:do_load_balance: found requested
(0) resource pstn
Feb 16 11:28:57 [24877] DBG:load_balancer:do_load_balance: sequential call
of LB - previous selected dst is 1
Feb 16 11:28:57 [24877] DBG:load_balancer:do_load_balance: skipping
destination <sip:127.0.0.10> (used=1 , disabled=0)
Feb 16 11:28:57 [24877] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.15> selected for LB set with free=100 (max=100)
Feb 16 11:28:57 [24877] DBG:load_balancer:do_load_balance: winning
destination <sip:127.0.0.15> selected for LB set with free=100
.....
Feb 16 11:29:03 [24877] DBG:load_balancer:do_load_balance: found requested
(0) resource pstn
Feb 16 11:29:03 [24877] DBG:load_balancer:do_load_balance: sequential call
of LB - previous selected dst is 2
Feb 16 11:29:03 [24877] DBG:load_balancer:do_load_balance: skipping
destination <sip:127.0.0.10> (used=1 , disabled=0)
Feb 16 11:29:03 [24877] DBG:load_balancer:do_load_balance: skipping
destination <sip:127.0.0.15> (used=1 , disabled=0)
Feb 16 11:29:03 [24877] DBG:load_balancer:do_load_balance: no destination
found


Please consider the attached patch for more debugs - run with it and post
the logs generated by the LB module

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Seth Schultz (sethschultz)
Date: 2013-02-11 11:35

Message:
I should note that I have tried it with both the 0 and the 1 algorithm. 
Both of them fail in the same way.

Thanks,
Seth

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3604147&group_id=232389



More information about the Devel mailing list