Hi Bogdan,<br><br>I run the scenario again with a few destinations: two
8002 destinations and one 8003 destination. Here'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 "100 Trying" but does not send
"200 OK".<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 "100 Trying" but does not send "200 OK".<br>
* At 10.49.49: tm timer again detects that INVITE is not processed and
cancels the call. Failure procedure at this point returns < 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 <<a href="mailto:sip%3Aar@10.10.5.44">sip:ar@10.10.5.44</a>> 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 <<a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a>> 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 <<a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a>> 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"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></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">> Hi Bogdan,<br>
><br>
> In my tests when all resources from group id 1 (with higher priority)<br>
> are busy (or fail to accept call with some error) I'm calling<br>
> load_balance for group id 2. Although there is available destinations<br>
> on this group, return code from load_balance call is < 0. So this is<br>
> the point where I'm stuck.<br>
><br>
> Any help appreciated.<br>
><br>
> Here's my configuration.<br>
><br>
> load_balancer table<br>
> -------------------------------<br>
> +----+----------+---------------------+-----------+------------+-------------+<br>
> | id | group_id | dst_uri | resources | probe_mode |<br>
> description |<br>
> +----+----------+---------------------+-----------+------------+-------------+<br>
</div>> | 95 | 8002 | <a href="mailto:sip%3Aar@10.10.5.23">sip:ar@10.10.5.23</a> <mailto:<a href="mailto:sip%253Aar@10.10.5.23">sip%3Aar@10.10.5.23</a>> |<br>
> sip=1 | 2 | |<br>
> | 19 | 8002 | <a href="mailto:sip%3Aar@10.10.5.44">sip:ar@10.10.5.44</a> <mailto:<a href="mailto:sip%253Aar@10.10.5.44">sip%3Aar@10.10.5.44</a>> |<br>
> sip=1 | 2 | |<br>
> | 20 | 8003 | <a href="mailto:sip%3Aar@10.210.54.86">sip:ar@10.210.54.86</a> <mailto:<a href="mailto:sip%253Aar@10.210.54.86">sip%3Aar@10.210.54.86</a>> |<br>
> sip=1 | 2 | |<br>
> | 96 | 8002 | <a href="mailto:sip%3Aar@10.10.5.13">sip:ar@10.10.5.13</a> <mailto:<a href="mailto:sip%253Aar@10.10.5.13">sip%3Aar@10.10.5.13</a>> |<br>
> sip=1 | 2 | |<br>
> | 97 | 8002 | <a href="mailto:sip%3Aar@10.10.5.10">sip:ar@10.10.5.10</a> <mailto:<a href="mailto:sip%253Aar@10.10.5.10">sip%3Aar@10.10.5.10</a>> |<br>
> sip=1 | 2 | |<br>
> | 98 | 8002 | <a href="mailto:sip%3Aar@10.10.6.50">sip:ar@10.10.6.50</a> <mailto:<a href="mailto:sip%253Aar@10.10.6.50">sip%3Aar@10.10.6.50</a>> |<br>
<div><div></div><div class="h5">> sip=1 | 2 | |<br>
> ...<br>
><br>
> opensips.cfg<br>
> ----------------------<br>
> ####### Global Parameters #########<br>
><br>
> debug=3<br>
> log_stderror=no<br>
> log_facility=LOG_LOCAL6<br>
><br>
> fork=yes<br>
> children=4<br>
><br>
> /* uncomment the next line to disable TCP (default on) */<br>
> disable_tcp=yes<br>
><br>
> port=5060<br>
><br>
> ####### Modules Section ########<br>
><br>
> #set module path<br>
> mpath="//lib/opensips/modules/"<br>
><br>
> /* uncomment next line for MySQL DB support */<br>
> loadmodule "db_mysql.so"<br>
> loadmodule "signaling.so"<br>
> loadmodule "sl.so"<br>
> loadmodule "tm.so"<br>
> loadmodule "rr.so"<br>
> loadmodule "maxfwd.so"<br>
> loadmodule "usrloc.so"<br>
> loadmodule "registrar.so"<br>
> loadmodule "textops.so"<br>
> loadmodule "mi_fifo.so"<br>
> loadmodule "uri.so"<br>
> loadmodule "xlog.so"<br>
> loadmodule "acc.so"<br>
><br>
> /* uncomment next lines for MySQL based authentication support<br>
> NOTE: a DB (like db_mysql) module must be also loaded */<br>
> loadmodule "auth.so"<br>
> loadmodule "auth_db.so"<br>
><br>
> # needed for load balancer module<br>
> loadmodule "dialog.so"<br>
> loadmodule "load_balancer.so"<br>
><br>
> # ----------------- setting module-specific parameters ---------------<br>
><br>
><br>
> # ----- mi_fifo params -----<br>
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")<br>
><br>
><br>
> # ----- rr params -----<br>
> modparam("rr", "enable_double_rr", 1)<br>
> modparam("rr", "append_fromtag", 1)<br>
><br>
><br>
> # ----- usrloc params -----<br>
> modparam("usrloc", "db_mode", 0)<br>
><br>
><br>
> # ----- uri params -----<br>
> modparam("uri", "use_uri_table", 0)<br>
><br>
><br>
> # ----- acc params -----<br>
> /* what sepcial events should be accounted ? */<br>
> modparam("acc", "early_media", 1)<br>
> modparam("acc", "report_ack", 0)<br>
> modparam("acc", "report_cancels", 0)<br>
><br>
> /* by default ww do not adjust the direct of the sequential requests.<br>
> if you enable this parameter, be sure the enable "append_fromtag"<br>
> in "rr" module */<br>
> modparam("acc", "detect_direction", 0)<br>
><br>
> /* account triggers (flags) */<br>
> modparam("acc", "failed_transaction_flag", 3)<br>
><br>
> /* uncomment the following lines to enable DB accounting also */<br>
> modparam("acc", "db_flag", 1)<br>
> modparam("acc", "db_missed_flag", 2)<br>
><br>
><br>
> # ----- auth_db params -----<br>
> /* uncomment the following lines if you want to enable the DB based<br>
> authentication */<br>
> modparam("auth_db", "calculate_ha1", yes)<br>
> modparam("auth_db", "password_column", "password")<br>
><br>
><br>
> # ----- tm params -----<br>
> modparam("tm", "fr_timer", 5)<br>
> modparam("tm", "fr_inv_timer", 5)<br>
><br>
><br>
> # ----- load balancer params -----<br>
> modparam("load_balancer", "db_url",<br>
> "mysql://opensips:opensipsrw@localhost/opensips16")<br>
> modparam("load_balancer", "db_table", "load_balancer")<br>
> modparam("load_balancer", "probing_interval", 20)<br>
> modparam("load_balancer", "probing_method", "OPTIONS")<br>
> modparam("load_balancer", "probing_from", "<a href="mailto:sip%3Aproxy@192.168.187.121">sip:proxy@192.168.187.121</a><br>
</div></div>> <mailto:<a href="mailto:sip%253Aproxy@192.168.187.121">sip%3Aproxy@192.168.187.121</a>>")<br>
<div><div></div><div class="h5">><br>
> ####### Routing Logic ########<br>
><br>
><br>
> # main request routing logic<br>
> route{<br>
> if (!mf_process_maxfwd_header("10")) {<br>
> sl_send_reply("483","Too Many Hops");<br>
> exit;<br>
> }<br>
><br>
> if (has_totag()) {<br>
> # sequential request withing a dialog should<br>
> # take the path determined by record-routing<br>
> if (loose_route()) {<br>
> if (is_method("BYE")) {<br>
> setflag(1); # do accounting ...<br>
> setflag(3); # ... even if the transaction fails<br>
> } else if (is_method("INVITE")) {<br>
> # even if in most of the cases is useless, do RR for<br>
> # re-INVITEs alos, as some buggy clients do change route set<br>
> # during the dialog.<br>
> record_route();<br>
> }<br>
> # route it out to whatever destination was set by loose_route()<br>
> # in $du (destination URI).<br>
> route(1);<br>
> } else {<br>
> if ( is_method("ACK") ) {<br>
> if ( t_check_trans() ) {<br>
> # non loose-route, but stateful ACK; must be an ACK after<br>
> # a 487 or e.g. 404 from upstream server<br>
> t_relay();<br>
> exit;<br>
> } else {<br>
> # ACK without matching transaction -><br>
> # ignore and discard<br>
> exit;<br>
> }<br>
> }<br>
> sl_send_reply("404","Not here");<br>
> }<br>
> exit;<br>
> }<br>
><br>
> #initial requests<br>
><br>
> # CANCEL processing<br>
> if (is_method("CANCEL"))<br>
> {<br>
> if (t_check_trans())<br>
> t_relay();<br>
> exit;<br>
> }<br>
><br>
> t_check_trans();<br>
><br>
> # preloaded route checking<br>
> if (loose_route()) {<br>
> xlog("L_ERR",<br>
> "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br>
> if (!is_method("ACK"))<br>
> sl_send_reply("403","Preload Route denied");<br>
> exit;<br>
> }<br>
><br>
> # record routing<br>
> if (!is_method("REGISTER|MESSAGE"))<br>
> record_route();<br>
><br>
> # account only INVITEs<br>
> if (is_method("INVITE")) {<br>
> setflag(1); # do accounting<br>
> }<br>
> if (is_method("PUBLISH"))<br>
> {<br>
> sl_send_reply("503", "Service Unavailable");<br>
> exit;<br>
> }<br>
> if ($rU==NULL) {<br>
> # request with no Username in RURI<br>
> sl_send_reply("484","Address Incomplete");<br>
> exit;<br>
> }<br>
><br>
> # when routing via usrloc, log the missed calls also<br>
> setflag(2);<br>
><br>
> route(3);<br>
> }<br>
><br>
> route[1] {<br>
> # for INVITEs enable some additional helper routes<br>
> if (is_method("INVITE")) {<br>
> t_on_branch("2");<br>
> t_on_reply("2");<br>
> t_on_failure("1");<br>
> }<br>
><br>
> if (!t_relay()) {<br>
> sl_reply_error();<br>
> };<br>
> exit;<br>
> }<br>
><br>
><br>
> route[3] {<br>
> if (is_method("INVITE")) {<br>
> load_balance("8002", "sip");<br>
> if ($retcode < 0) {<br>
> xlog("L_INFO", "load_balancer: Insufficient resource to<br>
> balance request from $fu to $tu . Re-balancing to route 4!\n");<br>
> route(4);<br>
> }<br>
> }<br>
> t_on_failure("2");<br>
><br>
> # send request<br>
> if (!t_relay()) {<br>
> sl_reply_error();<br>
> }<br>
> exit;<br>
> }<br>
><br>
> route[4] {<br>
> if (is_method("INVITE")) {<br>
> load_balance("8003", "sip");<br>
> if ($retcode < 0) {<br>
> xlog("L_INFO", "load_balancer: Insufficient resource to<br>
> balance request from $fu to $tu . Sending error!\n");<br>
> sl_send_reply("500", "Service full");<br>
> exit;<br>
> }<br>
> }<br>
> # send request<br>
> if (!t_relay()) {<br>
> sl_reply_error();<br>
> }<br>
> exit;<br>
> }<br>
><br>
><br>
> branch_route[2] {<br>
> xlog("new branch at $ru\n");<br>
> }<br>
><br>
><br>
> onreply_route[2] {<br>
> xlog("incoming reply\n");<br>
> }<br>
><br>
> de<br>
><br>
> failure_route[1] {<br>
> if (t_was_cancelled()) {<br>
> exit;<br>
> }<br>
><br>
> # uncomment the following lines if you want to block client<br>
> # redirect based on 3xx replies.<br>
> ##if (t_check_status("3[0-9][0-9]")) {<br>
> ##t_reply("404","Not found");<br>
> ## exit;<br>
> ##}<br>
><br>
> # uncomment the following lines if you want to redirect the failed<br>
> # calls to a different new destination<br>
> ##if (t_check_status("486|408")) {<br>
</div></div>> ## sethostport("<a href="http://192.168.2.100:5060" target="_blank">192.168.2.100:5060</a> <<a href="http://192.168.2.100:5060" target="_blank">http://192.168.2.100:5060</a>>");<br>
<div class="im">> ## # do not set the missed call flag again<br>
> ## t_relay();<br>
> ##}<br>
> }<br>
><br>
><br>
> failure_route[2] {<br>
> if (t_was_cancelled()) {<br>
> exit;<br>
> }<br>
><br>
> if (t_check_status("486|408|603")) {<br>
> xlog("L_INFO", "load_balancer: Request from $fu to $tu<br>
> failed. Re-balancing to 8002!\n");<br>
> lb_disable();<br>
> load_balance("8002", "sip");<br>
><br>
> if ($retcode < 0) {<br>
> xlog("L_INFO", "load_balancer: Insufficient resource to<br>
> balance request from $fu to $tu . Re-balancing to route 4!\n");<br>
> route(4);<br>
> }<br>
> t_on_failure("2");<br>
> t_relay();<br>
> }<br>
> }<br>
><br>
</div>> ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">><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>
><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>