Hi Bogdan,<br><br>I run the scenario again with a few destinations: two
8002 destinations and one 8003 destination. Here&#39;s my test analysis and
trace of load_balancer module in debug=6 (Full trace is bigger than 100k. I can try to send it but it is rejected by maillist). I hope it will help us to see
what is wrong with my configuration.<br>
<br>* Call is received at 10:49:40: load balancer forwards INVITE to
host 10.10.5.44. Host 10.10.5.44 returns &quot;100 Trying&quot; but does not send
&quot;200 OK&quot;.<br>* At 10:49:44: tm timer detects that INVITE is not
processed and cancels the call. Then failure route is called and
load_balancer tries to forward this call to 10.10.6.50. Host 10.10.6.50
again sends &quot;100 Trying&quot; but does not send &quot;200 OK&quot;.<br>
* At 10.49.49: tm timer again detects that INVITE is not processed and
cancels the call. Failure procedure at this point returns &lt; 0 for
8002. So load_balance(8003) is called. But a valid destination is not
found.<br><br><br>Dec 22 10:49:40 arsipt1 /sbin/opensips[9141]: DBG:load_balancer:do_load_balance: found requested (0) resource sip<br>Dec 22 10:49:40 arsipt1 /sbin/opensips[9141]: DBG:load_balancer:do_load_balance: destination &lt;<a href="mailto:sip%3Aar@10.10.5.44">sip:ar@10.10.5.44</a>&gt; selected for LB set with free=1 (max=1)<br>
Dec 22 10:49:40 arsipt1 /sbin/opensips[9141]: DBG:load_balancer:do_load_balance: destination &lt;<a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a>&gt; selected for LB set with free=1 (max=1)<br>Dec 22 10:49:44 arsipt1 /sbin/opensips[9146]: load_balancer: Request from <a href="mailto:sip%3A5304556731@86.108.132.8">sip:5304556731@86.108.132.8</a> to <a href="http://sip:8002@10.210.54.83:5060">sip:8002@10.210.54.83:5060</a> failed. Re-balancing to 8002!<br>
Dec 22 10:49:44 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: found requested (0) resource sip<br>Dec 22 10:49:44 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: destination &lt;<a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a>&gt; selected for LB set with free=1 (max=1)<br>
Dec 22 10:49:44 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: failed to remove from profile<br>Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: load_balancer: Request from <a href="mailto:sip%3A5304556731@86.108.132.8">sip:5304556731@86.108.132.8</a> to <a href="http://sip:8002@10.210.54.83:5060">sip:8002@10.210.54.83:5060</a> failed. Re-balancing to 8002!<br>
Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: found requested (0) resource sip<br>Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: failed to remove from profile<br>
Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: no destination found<br>Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: load_balancer: Insufficient resource to balance request from <a href="mailto:sip%3A5304556731@86.108.132.8">sip:5304556731@86.108.132.8</a> to <a href="http://sip:8002@10.210.54.83:5060">sip:8002@10.210.54.83:5060</a> . Re-balancing to route 4!<br>
Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: found requested (0) resource sip<br>Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: failed to remove from profile<br>
Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: DBG:load_balancer:do_load_balance: no destination found<br>Dec 22 10:49:49 arsipt1 /sbin/opensips[9146]: load_balancer: Insufficient resource to balance request from <a href="mailto:sip%3A5304556731@86.108.132.8">sip:5304556731@86.108.132.8</a> to <a href="http://sip:8002@10.210.54.83:5060">sip:8002@10.210.54.83:5060</a> . Sending error!<br>
<br>Regards,<br>Taner<br><br><div class="gmail_quote">On Tue, Dec 22, 2009 at 10:18 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Taner,<br>
<br>
So, you have a call and you first try to do LB in group 8002 (in<br>
route[3]) and if failed, in group 8003.....which does not work properly<br>
as you said...<br>
<br>
Can you run in debug=6 and post here the output related to the INVITE<br>
processing ?<br>
<div class="im"><br>
Regards,<br>
Bogdan<br>
<br>
Taner Sener wrote:<br>
</div><div class="im">&gt; Hi Bogdan,<br>
&gt;<br>
&gt; In my tests when all resources from group id 1 (with higher priority)<br>
&gt; are busy (or fail to accept call with some error) I&#39;m calling<br>
&gt; load_balance for group id 2. Although there is available destinations<br>
&gt; on this group, return code from load_balance call is &lt; 0. So this is<br>
&gt; the point where I&#39;m stuck.<br>
&gt;<br>
&gt; Any help appreciated.<br>
&gt;<br>
&gt; Here&#39;s my configuration.<br>
&gt;<br>
&gt; load_balancer table<br>
&gt; -------------------------------<br>
&gt; +----+----------+---------------------+-----------+------------+-------------+<br>
&gt; | id | group_id | dst_uri             | resources | probe_mode |<br>
&gt; description |<br>
&gt; +----+----------+---------------------+-----------+------------+-------------+<br>
</div>&gt; | 95 |     8002 | <a href="mailto:sip%3Aar@10.10.5.23">sip:ar@10.10.5.23</a> &lt;mailto:<a href="mailto:sip%253Aar@10.10.5.23">sip%3Aar@10.10.5.23</a>&gt;   |<br>
&gt; sip=1     |          2 |             |<br>
&gt; | 19 |     8002 | <a href="mailto:sip%3Aar@10.10.5.44">sip:ar@10.10.5.44</a> &lt;mailto:<a href="mailto:sip%253Aar@10.10.5.44">sip%3Aar@10.10.5.44</a>&gt;   |<br>
&gt; sip=1     |          2 |             |<br>
&gt; | 20 |     8003 | <a href="mailto:sip%3Aar@10.210.54.86">sip:ar@10.210.54.86</a> &lt;mailto:<a href="mailto:sip%253Aar@10.210.54.86">sip%3Aar@10.210.54.86</a>&gt; |<br>
&gt; sip=1     |          2 |             |<br>
&gt; | 96 |     8002 | <a href="mailto:sip%3Aar@10.10.5.13">sip:ar@10.10.5.13</a> &lt;mailto:<a href="mailto:sip%253Aar@10.10.5.13">sip%3Aar@10.10.5.13</a>&gt;   |<br>
&gt; sip=1     |          2 |             |<br>
&gt; | 97 |     8002 | <a href="mailto:sip%3Aar@10.10.5.10">sip:ar@10.10.5.10</a> &lt;mailto:<a href="mailto:sip%253Aar@10.10.5.10">sip%3Aar@10.10.5.10</a>&gt;   |<br>
&gt; sip=1     |          2 |             |<br>
&gt; | 98 |     8002 | <a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a> &lt;mailto:<a href="mailto:sip%253Aar@10.10.6.50">sip%3Aar@10.10.6.50</a>&gt;   |<br>
<div><div></div><div class="h5">&gt; sip=1     |          2 |             |<br>
&gt; ...<br>
&gt;<br>
&gt; opensips.cfg<br>
&gt; ----------------------<br>
&gt; ####### Global Parameters #########<br>
&gt;<br>
&gt; debug=3<br>
&gt; log_stderror=no<br>
&gt; log_facility=LOG_LOCAL6<br>
&gt;<br>
&gt; fork=yes<br>
&gt; children=4<br>
&gt;<br>
&gt; /* uncomment the next line to disable TCP (default on) */<br>
&gt; disable_tcp=yes<br>
&gt;<br>
&gt; port=5060<br>
&gt;<br>
&gt; ####### Modules Section ########<br>
&gt;<br>
&gt; #set module path<br>
&gt; mpath=&quot;//lib/opensips/modules/&quot;<br>
&gt;<br>
&gt; /* uncomment next line for MySQL DB support */<br>
&gt; loadmodule &quot;db_mysql.so&quot;<br>
&gt; loadmodule &quot;signaling.so&quot;<br>
&gt; loadmodule &quot;sl.so&quot;<br>
&gt; loadmodule &quot;tm.so&quot;<br>
&gt; loadmodule &quot;rr.so&quot;<br>
&gt; loadmodule &quot;maxfwd.so&quot;<br>
&gt; loadmodule &quot;usrloc.so&quot;<br>
&gt; loadmodule &quot;registrar.so&quot;<br>
&gt; loadmodule &quot;textops.so&quot;<br>
&gt; loadmodule &quot;mi_fifo.so&quot;<br>
&gt; loadmodule &quot;uri.so&quot;<br>
&gt; loadmodule &quot;xlog.so&quot;<br>
&gt; loadmodule &quot;acc.so&quot;<br>
&gt;<br>
&gt; /* uncomment next lines for MySQL based authentication support<br>
&gt;    NOTE: a DB (like db_mysql) module must be also loaded */<br>
&gt; loadmodule &quot;auth.so&quot;<br>
&gt; loadmodule &quot;auth_db.so&quot;<br>
&gt;<br>
&gt; # needed for load balancer module<br>
&gt; loadmodule &quot;dialog.so&quot;<br>
&gt; loadmodule &quot;load_balancer.so&quot;<br>
&gt;<br>
&gt; # ----------------- setting module-specific parameters ---------------<br>
&gt;<br>
&gt;<br>
&gt; # ----- mi_fifo params -----<br>
&gt; modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>
&gt;<br>
&gt;<br>
&gt; # ----- rr params -----<br>
&gt; modparam(&quot;rr&quot;, &quot;enable_double_rr&quot;, 1)<br>
&gt; modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 1)<br>
&gt;<br>
&gt;<br>
&gt; # ----- usrloc params -----<br>
&gt; modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   0)<br>
&gt;<br>
&gt;<br>
&gt; # ----- uri params -----<br>
&gt; modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)<br>
&gt;<br>
&gt;<br>
&gt; # ----- acc params -----<br>
&gt; /* what sepcial events should be accounted ? */<br>
&gt; modparam(&quot;acc&quot;, &quot;early_media&quot;, 1)<br>
&gt; modparam(&quot;acc&quot;, &quot;report_ack&quot;, 0)<br>
&gt; modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 0)<br>
&gt;<br>
&gt; /* by default ww do not adjust the direct of the sequential requests.<br>
&gt;    if you enable this parameter, be sure the enable &quot;append_fromtag&quot;<br>
&gt;    in &quot;rr&quot; module */<br>
&gt; modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)<br>
&gt;<br>
&gt; /* account triggers (flags) */<br>
&gt; modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 3)<br>
&gt;<br>
&gt; /* uncomment the following lines to enable DB accounting also */<br>
&gt; modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)<br>
&gt; modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)<br>
&gt;<br>
&gt;<br>
&gt; # ----- auth_db params -----<br>
&gt; /* uncomment the following lines if you want to enable the DB based<br>
&gt;    authentication */<br>
&gt; modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)<br>
&gt; modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)<br>
&gt;<br>
&gt;<br>
&gt; # ----- tm params -----<br>
&gt; modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 5)<br>
&gt; modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 5)<br>
&gt;<br>
&gt;<br>
&gt; # ----- load balancer params -----<br>
&gt; modparam(&quot;load_balancer&quot;, &quot;db_url&quot;,<br>
&gt; &quot;mysql://opensips:opensipsrw@localhost/opensips16&quot;)<br>
&gt; modparam(&quot;load_balancer&quot;, &quot;db_table&quot;, &quot;load_balancer&quot;)<br>
&gt; modparam(&quot;load_balancer&quot;, &quot;probing_interval&quot;, 20)<br>
&gt; modparam(&quot;load_balancer&quot;, &quot;probing_method&quot;, &quot;OPTIONS&quot;)<br>
&gt; modparam(&quot;load_balancer&quot;, &quot;probing_from&quot;, &quot;<a href="mailto:sip%3Aproxy@192.168.187.121">sip:proxy@192.168.187.121</a><br>
</div></div>&gt; &lt;mailto:<a href="mailto:sip%253Aproxy@192.168.187.121">sip%3Aproxy@192.168.187.121</a>&gt;&quot;)<br>
<div><div></div><div class="h5">&gt;<br>
&gt; ####### Routing Logic ########<br>
&gt;<br>
&gt;<br>
&gt; # main request routing logic<br>
&gt; route{<br>
&gt; if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>
&gt; sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; if (has_totag()) {<br>
&gt; # sequential request withing a dialog should<br>
&gt; # take the path determined by record-routing<br>
&gt; if (loose_route()) {<br>
&gt; if (is_method(&quot;BYE&quot;)) {<br>
&gt; setflag(1); # do accounting ...<br>
&gt; setflag(3); # ... even if the transaction fails<br>
&gt; } else if (is_method(&quot;INVITE&quot;)) {<br>
&gt; # even if in most of the cases is useless, do RR for<br>
&gt; # re-INVITEs alos, as some buggy clients do change route set<br>
&gt; # during the dialog.<br>
&gt; record_route();<br>
&gt; }<br>
&gt; # route it out to whatever destination was set by loose_route()<br>
&gt; # in $du (destination URI).<br>
&gt; route(1);<br>
&gt; } else {<br>
&gt; if ( is_method(&quot;ACK&quot;) ) {<br>
&gt; if ( t_check_trans() ) {<br>
&gt; # non loose-route, but stateful ACK; must be an ACK after<br>
&gt; # a 487 or e.g. 404 from upstream server<br>
&gt; t_relay();<br>
&gt; exit;<br>
&gt; } else {<br>
&gt; # ACK without matching transaction -&gt;<br>
&gt; # ignore and discard<br>
&gt; exit;<br>
&gt; }<br>
&gt; }<br>
&gt; sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
&gt; }<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; #initial requests<br>
&gt;<br>
&gt; # CANCEL processing<br>
&gt; if (is_method(&quot;CANCEL&quot;))<br>
&gt; {<br>
&gt; if (t_check_trans())<br>
&gt; t_relay();<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; t_check_trans();<br>
&gt;<br>
&gt; # preloaded route checking<br>
&gt; if (loose_route()) {<br>
&gt; xlog(&quot;L_ERR&quot;,<br>
&gt; &quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);<br>
&gt; if (!is_method(&quot;ACK&quot;))<br>
&gt; sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; # record routing<br>
&gt; if (!is_method(&quot;REGISTER|MESSAGE&quot;))<br>
&gt; record_route();<br>
&gt;<br>
&gt; # account only INVITEs<br>
&gt; if (is_method(&quot;INVITE&quot;)) {<br>
&gt; setflag(1); # do accounting<br>
&gt; }<br>
&gt; if (is_method(&quot;PUBLISH&quot;))<br>
&gt; {<br>
&gt; sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
&gt; exit;<br>
&gt; }<br>
&gt; if ($rU==NULL) {<br>
&gt; # request with no Username in RURI<br>
&gt; sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; # when routing via usrloc, log the missed calls also<br>
&gt; setflag(2);<br>
&gt;<br>
&gt; route(3);<br>
&gt; }<br>
&gt;<br>
&gt; route[1] {<br>
&gt; # for INVITEs enable some additional helper routes<br>
&gt; if (is_method(&quot;INVITE&quot;)) {<br>
&gt; t_on_branch(&quot;2&quot;);<br>
&gt; t_on_reply(&quot;2&quot;);<br>
&gt; t_on_failure(&quot;1&quot;);<br>
&gt; }<br>
&gt;<br>
&gt; if (!t_relay()) {<br>
&gt; sl_reply_error();<br>
&gt; };<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; route[3] {<br>
&gt;         if (is_method(&quot;INVITE&quot;)) {<br>
&gt;             load_balance(&quot;8002&quot;, &quot;sip&quot;);<br>
&gt;             if ($retcode &lt; 0) {<br>
&gt;              xlog(&quot;L_INFO&quot;, &quot;load_balancer: Insufficient resource to<br>
&gt; balance request from $fu to $tu . Re-balancing to route 4!\n&quot;);<br>
&gt; route(4);<br>
&gt;             }<br>
&gt;         }<br>
&gt; t_on_failure(&quot;2&quot;);<br>
&gt;<br>
&gt; # send request<br>
&gt; if (!t_relay()) {<br>
&gt; sl_reply_error();<br>
&gt; }<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; route[4] {<br>
&gt;         if (is_method(&quot;INVITE&quot;)) {<br>
&gt;             load_balance(&quot;8003&quot;, &quot;sip&quot;);<br>
&gt;             if ($retcode &lt; 0) {<br>
&gt;              xlog(&quot;L_INFO&quot;, &quot;load_balancer: Insufficient resource to<br>
&gt; balance request from $fu to $tu . Sending error!\n&quot;);<br>
&gt;                 sl_send_reply(&quot;500&quot;, &quot;Service full&quot;);<br>
&gt;                 exit;<br>
&gt;             }<br>
&gt;         }<br>
&gt; # send request<br>
&gt; if (!t_relay()) {<br>
&gt; sl_reply_error();<br>
&gt; }<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; branch_route[2] {<br>
&gt; xlog(&quot;new branch at $ru\n&quot;);<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; onreply_route[2] {<br>
&gt; xlog(&quot;incoming reply\n&quot;);<br>
&gt; }<br>
&gt;<br>
&gt; de<br>
&gt;<br>
&gt; failure_route[1] {<br>
&gt; if (t_was_cancelled()) {<br>
&gt; exit;<br>
&gt; }<br>
&gt;<br>
&gt; # uncomment the following lines if you want to block client<br>
&gt; # redirect based on 3xx replies.<br>
&gt; ##if (t_check_status(&quot;3[0-9][0-9]&quot;)) {<br>
&gt; ##t_reply(&quot;404&quot;,&quot;Not found&quot;);<br>
&gt; ## exit;<br>
&gt; ##}<br>
&gt;<br>
&gt; # uncomment the following lines if you want to redirect the failed<br>
&gt; # calls to a different new destination<br>
&gt; ##if (t_check_status(&quot;486|408&quot;)) {<br>
</div></div>&gt; ## sethostport(&quot;<a href="http://192.168.2.100:5060" target="_blank">192.168.2.100:5060</a> &lt;<a href="http://192.168.2.100:5060" target="_blank">http://192.168.2.100:5060</a>&gt;&quot;);<br>
<div class="im">&gt; ## # do not set the missed call flag again<br>
&gt; ## t_relay();<br>
&gt; ##}<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; failure_route[2] {<br>
&gt;         if (t_was_cancelled()) {<br>
&gt;                 exit;<br>
&gt;         }<br>
&gt;<br>
&gt;         if (t_check_status(&quot;486|408|603&quot;)) {<br>
&gt;             xlog(&quot;L_INFO&quot;, &quot;load_balancer: Request from $fu to $tu<br>
&gt; failed. Re-balancing to 8002!\n&quot;);<br>
&gt;             lb_disable();<br>
&gt;             load_balance(&quot;8002&quot;, &quot;sip&quot;);<br>
&gt;<br>
&gt;             if ($retcode &lt; 0) {<br>
&gt;              xlog(&quot;L_INFO&quot;, &quot;load_balancer: Insufficient resource to<br>
&gt; balance request from $fu to $tu . Re-balancing to route 4!\n&quot;);<br>
&gt; route(4);<br>
&gt;             }<br>
&gt;    t_on_failure(&quot;2&quot;);<br>
&gt;             t_relay();<br>
&gt; }<br>
&gt; }<br>
&gt;<br>
</div>&gt; ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">&gt;<br>
&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
&gt; <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
&gt;<br>
<br>
<br>
--<br>
Bogdan-Andrei Iancu<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br>