<div dir="ltr"><div>Hi Bogdan,</div><div><br></div><div>Sorry for the delayed reply.</div><div><br></div><div>I resumed to look into this issue after a break and I confirmed that the invite request is going back and forth between the load balancer and the proxy. Just to revisit the setup as the IP's got changed :</div><div><br></div><div>UAC(192.168.100.21:5065)-------LB (192.168.100.21:5060)------SIP Proxy (192.168.100.17:5060)------------UAS(<a href="http://192.168.100.17:5080">192.168.100.17:5080</a>)</div><div><br></div><div>sipp commands used :</div><div><br></div><div>./sipp -sf uac_mod.xml <a href="http://192.168.100.21:5060">192.168.100.21:5060</a> -s archana -i 192.168.100.21 -p 5065 -r 1 -rp 1000 -m 10</div><div><br></div><div>./sipp -sf uas_mod_orig.xml -rsa <a href="http://192.168.100.21:5060">192.168.100.21:5060</a> -i 192.168.100.17 -p 5080</div><div><br></div><div>where I have registered user archana in the SIP proxy server .</div><div><br></div><div><br></div><div>The problem looks like not a loop within the load balancer but the fact that the proxy returns the INVITE back to the load balancer instead of sending it to the server (UAS ).</div><div><br></div><div>The LB, when handling the INVITE, properly routes it to the proxy but does not change the request-uri. The proxy then routes the INVITE according to the unchanged request-uri which means that it sends it back to the LB.</div><div><br></div><div>when I hardcoded the request uri in the Proxy script to the UAS uri I can see the invite request reaching the UAS.</div><div><br></div><div>In the LB script as well as proxy script I could see the record routing of initial request (INVITE).(Not sure if record routing changes the uri for initial request as it does for sequential request)</div><div><br></div><div>There is some issue in the script either in LB or Proxy which I am not able to figure out.</div><div><br></div><div>Request your help for the same.</div><div><br></div><div><br></div><div><br></div><div>The LB and Proxy script snnipets as below :</div><div><br></div><div>Load Balancer Script :</div><div>----------------------------------------</div><div><br></div><div>route{</div><div><br></div><div> <span style="white-space:pre"> </span>if (!mf_process_maxfwd_header("10")) {</div><div><span style="white-space:pre"> </span>sl_send_reply("483","Too Many Hops");</div><div><span style="white-space:pre"> </span>exit;<span style="white-space:pre"> </span>}</div><div> </div><div><span style="white-space:pre"> </span>if (has_totag()) {</div><div> </div><div> <span style="white-space:pre"> </span># sequential request withing a dialog should</div><div><span style="white-space:pre"> </span># take the path determined by record-routing</div><div><span style="white-space:pre"> </span>if (loose_route()) {</div><div><span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span># validate the sequential request against dialog</div><div><span style="white-space:pre"> </span>if ( $DLG_status!=NULL && !validate_dialog() ) {</div><div><span style="white-space:pre"> </span>xlog("In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n");</div><div><span style="white-space:pre"> </span>## exit;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>if (is_method("BYE")) {</div><div><span style="white-space:pre"> </span>setflag(ACC_DO); # do accounting ...</div><div><span style="white-space:pre"> </span>setflag(ACC_FAILED); # ... even if the transaction fails</div><div><span style="white-space:pre"> </span>} else if (is_method("INVITE")) {</div><div><span style="white-space:pre"> </span># even if in most of the cases is useless, do RR for</div><div><span style="white-space:pre"> </span># re-INVITEs alos, as some buggy clients do change route set</div><div><span style="white-space:pre"> </span># during the dialog.</div><div> <span style="white-space:pre"> </span>record_route();</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># route it out to whatever destination was set by loose_route()</div><div><span style="white-space:pre"> </span># in $du (destination URI).</div><div><span style="white-space:pre"> </span>route(RELAY);</div><div><span style="white-space:pre"> </span>} else {</div><div><span style="white-space:pre"> </span>if ( is_method("ACK") ) {</div><div><span style="white-space:pre"> </span>if ( t_check_trans() ) {</div><div><span style="white-space:pre"> </span># non loose-route, but stateful ACK; must be an ACK after </div><div><span style="white-space:pre"> </span># a 487 or e.g. 404 from upstream server</div><div> <span style="white-space:pre"> </span>t_relay();</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>} else {</div><div><span style="white-space:pre"> </span># ACK without matching transaction -></div><div><span style="white-space:pre"> </span># ignore and discard</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>sl_send_reply("404","Not here");</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>#### INITIAL REQUESTS</div><div><br></div><div><span style="white-space:pre"> </span># CANCEL processing</div><div><span style="white-space:pre"> </span>if (is_method("CANCEL")) {</div><div><span style="white-space:pre"> </span>if (t_check_trans())</div><div><span style="white-space:pre"> </span>t_relay();</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>} else if (!is_method("INVITE")) {</div><div><span style="white-space:pre"> </span>send_reply("405","Method Not Allowed");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>if ($rU==NULL) {</div><div><span style="white-space:pre"> </span># request with no Username in RURI</div><div><span style="white-space:pre"> </span>sl_send_reply("484","Address Incomplete");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>t_check_trans();</div><div><br></div><div><span style="white-space:pre"> </span># preloaded route checking</div><div><span style="white-space:pre"> </span>if (loose_route()) {</div><div><span style="white-space:pre"> </span>xlog("L_ERR",</div><div><span style="white-space:pre"> </span>"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");</div><div><span style="white-space:pre"> </span>if (!is_method("ACK"))</div><div><span style="white-space:pre"> </span>sl_send_reply("403","Preload Route denied");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>record_route();</div><div><br></div><div><span style="white-space:pre"> </span>setflag(ACC_DO); # do accounting</div><div><br></div><div><span style="white-space:pre"> </span>if ( !load_balance("1","sip")) {</div><div><span style="white-space:pre"> </span> </div><div> xlog("\n");</div><div><span style="white-space:pre"> </span>send_reply("500","No Destination available");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div> <span style="white-space:pre"> </span>t_on_failure("GW_FAILOVER");</div><div><br></div><div><span style="white-space:pre"> </span>route(RELAY);</div><div>}</div><div><br></div><div><br></div><div>route[RELAY] {</div><div><span style="white-space:pre"> </span>if (!t_relay()) {</div><div><span style="white-space:pre"> </span>sl_reply_error();</div><div><span style="white-space:pre"> </span>};</div><div><span style="white-space:pre"> </span>exit;</div><div>}</div><div><br></div><div><br></div><div>failure_route[GW_FAILOVER] {</div><div> <span style="white-space:pre"> </span>if (t_was_cancelled()) {</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># failure detection with redirect to next available trunk</div><div><span style="white-space:pre"> </span>if (t_check_status("(408)|([56][0-9][0-9])")) {</div><div><span style="white-space:pre"> </span>xlog("Failed trunk $rd/$du detected \n");</div><div><br></div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>if ( load_balance("1","sip") ) {</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>t_on_failure("GW_FAILOVER");</div><div><span style="white-space:pre"> </span>t_relay();</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>send_reply("500","All GW are down");</div><div><span style="white-space:pre"> </span>}</div><div>}</div><div><br></div><div><br></div><div>local_route {</div><div><span style="white-space:pre"> </span>if (is_method("BYE") && $DLG_dir=="UPSTREAM") {</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>acc_log_request("200 Dialog Timeout");</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>}</div><div>}</div><div><br></div><div><br></div><div>*************************************************</div><div><br></div><div>Proxy Script :</div><div>----------------</div><div><br></div><div><br></div><div><br></div><div>route{</div><div><span style="white-space:pre"> </span></div><div> </div><div><span style="white-space:pre"> </span>if (!mf_process_maxfwd_header("10")) {</div><div><span style="white-space:pre"> </span>sl_send_reply("483","Too Many Hops");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>if (has_totag()) {</div><div> </div><div><span style="white-space:pre"> </span># sequential request withing a dialog should</div><div><span style="white-space:pre"> </span># take the path determined by record-routing</div><div><span style="white-space:pre"> </span>if (loose_route()) {</div><div> </div><div><span style="white-space:pre"> </span> <span style="white-space:pre"> </span>if (is_method("BYE")) {</div><div><span style="white-space:pre"> </span>setflag(1); # do accounting ...</div><div><span style="white-space:pre"> </span>setflag(3); # ... even if the transaction fails</div><div><span style="white-space:pre"> </span>} else if (is_method("INVITE")) {</div><div><span style="white-space:pre"> </span># even if in most of the cases is useless, do RR for</div><div><span style="white-space:pre"> </span># re-INVITEs alos, as some buggy clients do change route set</div><div><span style="white-space:pre"> </span># during the dialog.</div><div> <span style="white-space:pre"> </span>record_route();</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span># route it out to whatever destination was set by loose_route()</div><div><span style="white-space:pre"> </span># in $du (destination URI).</div><div> <span style="white-space:pre"> </span>route(1);</div><div><span style="white-space:pre"> </span>} else {</div><div><span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>if ( is_method("ACK") ) {</div><div><span style="white-space:pre"> </span>if ( t_check_trans() ) {</div><div><span style="white-space:pre"> </span># non loose-route, but stateful ACK; must be an ACK after </div><div><span style="white-space:pre"> </span># a 487 or e.g. 404 from upstream server</div><div> </div><div> t_relay();</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>} else {</div><div><span style="white-space:pre"> </span># ACK without matching transaction -></div><div><span style="white-space:pre"> </span># ignore and discard</div><div> <span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>sl_send_reply("404","Not here");</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># CANCEL processing</div><div><span style="white-space:pre"> </span>if (is_method("CANCEL"))</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>if (t_check_trans())</div><div><span style="white-space:pre"> </span>t_relay();</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><br></div><div> xlog("Outside has to tag \n");</div><div><span style="white-space:pre"> </span>t_check_trans();</div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span># preloaded route checking</div><div><span style="white-space:pre"> </span>if (loose_route()) {</div><div><span style="white-space:pre"> </span>xlog("L_ERR",</div><div><span style="white-space:pre"> </span>"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");</div><div><span style="white-space:pre"> </span>if (!is_method("ACK"))</div><div><span style="white-space:pre"> </span>sl_send_reply("403","Preload Route denied");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># record routing</div><div><span style="white-space:pre"> </span>if (!is_method("REGISTER|MESSAGE")){</div><div> <span style="white-space:pre"> </span>record_route();</div><div> }</div><div> </div><div><span style="white-space:pre"> </span># account only INVITEs</div><div><span style="white-space:pre"> </span>if (is_method("INVITE")) {</div><div><br></div><div> <span style="white-space:pre"> </span>setflag(1); # do accounting</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>if (!uri==myself) {</div><div><span style="white-space:pre"> </span>append_hf("P-hint: outbound\r\n"); </div><div> <b> $ru = "<a href="http://sip:archana@192.168.100.17:5080">sip:archana@192.168.100.17:5080</a>"; # Hard coding</b></div><div><span style="white-space:pre"> </span> route(1);</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># requests for my domain</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>if (is_method("PUBLISH|SUBSCRIBE"))</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>sl_send_reply("503", "Service Unavailable");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>if (is_method("REGISTER"))</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span># authenticate the REGISTER requests</div><div><span style="white-space:pre"> </span>if (!save("location"))</div><div><span style="white-space:pre"> </span>sl_reply_error();</div><div><br></div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>if ($rU==NULL) {</div><div><span style="white-space:pre"> </span># request with no Username in RURI</div><div><span style="white-space:pre"> </span>sl_send_reply("484","Address Incomplete");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span> </div><div><br></div><div><span style="white-space:pre"> </span># do lookup with method filtering</div><div><span style="white-space:pre"> </span>if (!lookup("location","m")) {</div><div><span style="white-space:pre"> </span>if (!db_does_uri_exist()) {</div><div><span style="white-space:pre"> </span>send_reply("420","Bad Extension");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>t_newtran();</div><div><span style="white-space:pre"> </span>t_reply("404", "Not Found");</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>} </div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span># when routing via usrloc, log the missed calls also</div><div><span style="white-space:pre"> </span>setflag(2);</div><div> <span style="white-space:pre"> </span>route(1);</div><div>}</div><div><br></div><div><br></div><div>route[1] {</div><div><span style="white-space:pre"> </span># for INVITEs enable some additional helper routes</div><div><span style="white-space:pre"> </span>if (is_method("INVITE")) {</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span>t_on_branch("2");</div><div><span style="white-space:pre"> </span>t_on_reply("2");</div><div><span style="white-space:pre"> </span>t_on_failure("1");</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span></div><div><br></div><div><span style="white-space:pre"> </span>if (!t_relay()) {</div><div><span style="white-space:pre"> </span>send_reply("500","Internal Error");</div><div><span style="white-space:pre"> </span>};</div><div><span style="white-space:pre"> </span>exit;</div><div>}</div><div><br></div><div><br></div><div><br></div><div><br></div><div>branch_route[2] {</div><div><span style="white-space:pre"> </span>xlog("new branch at $ru\n");</div><div> </div><div>}</div><div><br></div><div><br></div><div>onreply_route[2] {</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>xlog("incoming reply\n");</div><div>}</div><div><br></div><div><br></div><div>failure_route[1] {</div><div><span style="white-space:pre"> </span>if (t_was_cancelled()) {</div><div><span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span># uncomment the following lines if you want to block client </div><div><span style="white-space:pre"> </span># redirect based on 3xx replies.</div><div><span style="white-space:pre"> </span>##if (t_check_status("3[0-9][0-9]")) {</div><div><span style="white-space:pre"> </span>##t_reply("404","Not found");</div><div><span style="white-space:pre"> </span>##<span style="white-space:pre"> </span>exit;</div><div><span style="white-space:pre"> </span>##}</div><div><br></div><div><span style="white-space:pre"> </span></div><div>}</div><div><br></div><div><br></div><div>Regards</div><div>Mayur</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 16, 2018 at 6:55 PM, Mayur Koshal <span dir="ltr"><<a href="mailto:mayurkoshal@gmail.com" target="_blank">mayurkoshal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Bogdan ,<br>
<br>
<br>
I will try the script_trace and make a call.<br>
<br>
Meanwhile I had put xlogs in the load balancer script to see the<br>
destination and RURI.<br>
<br>
The destination is coming as NULL when I try to make a call using sipp.<br>
Also error message is seen in the LB logs when the call is executed :<br>
<br>
ERROR:core:print_rr_body: too many RR<br>
ERROR:dialog:get_routing_info: failed to print route records<br>
<br>
<br>
The logs and LB script route snippet is as below :<br>
<br>
<br>
<br>
Logs_LB :<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------<br>
stack-VirtualBox /usr/local/opensips_proxy/<wbr>sbin/opensips[20729]: DEst<br>
and RURI after record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]: Inside main route loop<br>
LoadBalance<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]: Destination available<br>
before initial req are <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]: DEst and RURI before<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]: DEst and RURI after<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]:<br>
ERROR:core:print_rr_body: too many RR<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20722]:<br>
ERROR:dialog:get_routing_info: failed to print route records<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]: Inside main route loop<br>
LoadBalance<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]: Destination available<br>
before initial req are <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]: DEst and RURI before<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]: DEst and RURI after<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]:<br>
ERROR:core:print_rr_body: too many RR<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20721]:<br>
ERROR:dialog:get_routing_info: failed to print route records<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]: Inside main route loop<br>
LoadBalance<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]: Destination available<br>
before initial req are <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]: DEst and RURI before<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]: DEst and RURI after<br>
record route <a href="http://sip:Mayur@192.168.100.19:5060/" rel="noreferrer" target="_blank">sip:Mayur@192.168.100.19:5060/</a><wbr><null><br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]:<br>
ERROR:core:print_rr_body: too many RR<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20718]:<br>
ERROR:dialog:get_routing_info: failed to print route records<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20739]: Inside failure_route<br>
GW_FAILOVER<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20728]: Inside main route loop<br>
LoadBalance<br>
Jan 16 16:35:41 stack-VirtualBox<br>
/usr/local/opensips_proxy/<wbr>sbin/opensips[20728]: Inside else of loose<br>
route<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-----------------------------<br>
<br>
Load Balancer Script :<br>
<span class=""><br>
####### Routing Logic ########<br>
<br>
# main request routing logic<br>
<br>
route{<br>
<br>
if (!mf_process_maxfwd_header("<wbr>10")) {<br>
sl_send_reply("483","Too Many Hops");<br>
exit;<br>
}<br>
<br>
<br>
xlog("Inside main route loop LoadBalance\n");<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>
xlog("Inside loose_route loop LoadBalance\n");<br>
# validate the sequential request against dialog<br>
if ( $DLG_status!=NULL && !validate_dialog() ) {<br>
xlog("In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n");<br>
## exit;<br>
}<br>
if (is_method("BYE")) {<br>
</span><span class="">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>
</span><span class=""> xlog("Inside else if is_method INVITE loop<br>
LoadBalance\n");<br>
record_route();<br>
}<br>
<br>
# route it out to whatever destination was set by loose_route()<br>
# in $du (destination URI).<br>
route(RELAY);<br>
} else {<br>
</span> xlog("Inside else of loose route \n");<br>
<span class="">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>
</span> xlog("Inside ACK $ru/$du \n");<br>
<span class="">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>
</span> xlog("Destination available before initial req are $ru/$du \n");<br>
<span class="">#### INITIAL REQUESTS<br>
<br>
# CANCEL processing<br>
if (is_method("CANCEL")) {<br>
if (t_check_trans())<br>
</span> xlog("Inside CANCEL $ru/$du \n");<br>
<span class="">t_relay();<br>
exit;<br>
} else if (!is_method("INVITE")) {<br>
send_reply("405","Method Not Allowed");<br>
exit;<br>
}<br>
<br>
if ($rU==NULL) {<br>
# request with no Username in RURI<br>
sl_send_reply("484","Address Incomplete");<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>
</span> xlog("DEst and RURI before record route $ru/$du \n");<br>
record_route();<br>
xlog("DEst and RURI after record route $ru/$du \n");<br>
setflag(1); # do accounting<br>
<span class=""><br>
if ( !load_balance("1","sip")) {<br>
<br>
xlog("Inside load_balance loop LoadBalance\n");<br>
send_reply("500","No Destination available");<br>
exit;<br>
}<br>
<br>
<br>
t_on_failure("GW_FAILOVER");<br>
<br>
route(RELAY);<br>
}<br>
<br>
<br>
route[RELAY] {<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
}<br>
<br>
<br>
failure_route[GW_FAILOVER] {<br>
xlog("Inside failure_route GW_FAILOVER \n");<br>
if (t_was_cancelled()) {<br>
exit;<br>
}<br>
<br>
# failure detection with redirect to next available trunk<br>
if (t_check_status("(408)|([56][<wbr>0-9][0-9])")) {<br>
xlog("Failed trunk $rd/$du detected \n");<br>
<br>
if ( load_balance("1","sip") ) {<br>
t_on_failure("GW_FAILOVER");<br>
</span> xlog("Destination available before initial req are<br>
$ru/$du \n");<br>
<span class="">t_relay();<br>
exit;<br>
}<br>
send_reply("500","All GW are down");<br>
}<br>
}<br>
<br>
<br>
local_route {<br>
if (is_method("BYE") && $DLG_dir=="UPSTREAM") {<br>
acc_log_request("200 Dialog Timeout");<br>
}<br>
}<br>
<br>
<br>
</span>Regards<br>
Mayur<br>
<br>
On Tue, Jan 16, 2018 at 4:07 PM, Bogdan-Andrei Iancu<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>> wrote:<br>
> Hi Mayur,<br>
><br>
> The simplest way to debug this is by using the script_trace() function -<br>
> see:<br>
> <a href="http://www.opensips.org/Documentation/Script-CoreFunctions-2-3#toc43" rel="noreferrer" target="_blank">http://www.opensips.org/<wbr>Documentation/Script-<wbr>CoreFunctions-2-3#toc43</a><br>
><br>
> Simply add in the very begging of your script:<br>
> script_trace( 1, "$rm from $si, ruri=$ru/$du", "LB");<br>
><br>
> and make a call - see the execution trace through the script for your<br>
> INVITE.<br>
><br>
> Regards,<br>
><br>
> Bogdan-Andrei Iancu<br>
><br>
> OpenSIPS Founder and Developer<br>
> <a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.<wbr>com</a><br>
> OpenSIPS Summit 2018<br>
> <a href="http://www.opensips.org/events/Summit-2018Amsterdam" rel="noreferrer" target="_blank">http://www.opensips.org/<wbr>events/Summit-2018Amsterdam</a><br>
><br>
> On 01/15/2018 07:23 PM, Mayur Koshal wrote:<br>
><br>
> Hi Bogdan,<br>
><br>
> Thanks for your time and looking into this.<br>
><br>
> I am using the Load balancer script which is generated from the menuconfig<br>
> as it is. The script was generated after I compiled and build opensips . Did<br>
> not made much changes to it.<br>
><br>
> Need to find out the reason why it is looping inside LB and not forwarding<br>
> it to Proxy.<br>
><br>
><br>
> Regards<br>
> Mayur<br>
><br>
><br>
><br>
><br>
> On Mon, Jan 15, 2018 at 10:43 PM, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>><br>
> wrote:<br>
>><br>
>> Hi MAyur,<br>
>><br>
>> Your trance does not show the INVITE being route outside the LB (.19).<br>
>> Even more there is a "Too many hops reply" back, suggesting that a loop is<br>
>> created on the LB and the INVITE is never sent to the destination (but keep<br>
>> re-routed back to LB).<br>
>><br>
>> When you do t_relay() in your script, place before it an xlog to see the<br>
>> destinations:<br>
>> xlog("sending out request to $ru/$du\n");<br>
>><br>
>> Regards,<br>
>><br>
>> Bogdan-Andrei Iancu<br>
>><br>
>> OpenSIPS Founder and Developer<br>
>> <a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.<wbr>com</a><br>
>> OpenSIPS Summit 2018<br>
>> <a href="http://www.opensips.org/events/Summit-2018Amsterdam" rel="noreferrer" target="_blank">http://www.opensips.org/<wbr>events/Summit-2018Amsterdam</a><br>
>><br>
>> On 01/12/2018 07:36 PM, Mayur Koshal wrote:<br>
>>><br>
>>> Hi Bogdan,<br>
>>><br>
>>> Thanks for the Reply.<br>
>>><br>
>>> Yes The opensips load balancer is able to reach destinations which is<br>
>>> configured in the load balancer table as I can see in the wireshark<br>
>>> logs and opensips logs of the SIP Proxy server.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> I have removed one SIP proxy in the table and the load distribution<br>
>>> table looks like :<br>
>>><br>
>>> mysql> select * from load_balancer;<br>
>>> | id | group_id | dst_uri | resources | probe_mode |<br>
>>> description |<br>
>>><br>
>>> +----+----------+-------------<wbr>-------------+-----------+----<wbr>--------+-------------+<br>
>>> | 2 | 1 | sip:<a href="http://192.168.100.187:5060" rel="noreferrer" target="_blank">192.168.100.187:5060</a> | sip=50 | 0 |<br>
>>> serv1 |<br>
>>><br>
>>> +----+----------+-------------<wbr>-------------+-----------+----<wbr>--------+-------------+<br>
>>><br>
>>><br>
>>> Now I am using the setup with only one sip proxy to make it simpler as :<br>
>>><br>
>>><br>
>>> UAC(192.168.100.19:5065)......<wbr>.>Load_Balancer(192.168.100.<wbr>19:5060)......>Proxy(192.168.<wbr>100.187:5060)..........><br>
>>> UAS(192.168.187:5070)<br>
>>><br>
>>><br>
>>> I have added a user in Load Balancer:<br>
>>><br>
>>> <a href="http://sip:bharti@192.168.100.187:5070" rel="noreferrer" target="_blank">sip:bharti@192.168.100.187:<wbr>5070</a><br>
>>><br>
>>><br>
>>><br>
>>> Database changed<br>
>>> mysql> select * from location;<br>
>>><br>
>>> +-----+----------+--------+---<wbr>------------------------------<wbr>+----------+------+-----------<wbr>----------+------+------------<wbr>---------------------+------+-<wbr>--------------------+-------+-<wbr>-------+--------------------+-<wbr>-------+---------+------------<wbr>--+<br>
>>> | id | username | domain | contact | received<br>
>>> | path | expires | q | callid<br>
>>> | cseq | last_modified | flags | cflags | user_agent |<br>
>>> socket | methods | sip_instance |<br>
>>><br>
>>> +-----+----------+--------+---<wbr>------------------------------<wbr>+----------+------+-----------<wbr>----------+------+------------<wbr>---------------------+------+-<wbr>--------------------+-------+-<wbr>-------+--------------------+-<wbr>-------+---------+------------<wbr>--+<br>
>>> | 272 | bharti | | <a href="http://sip:bharti@192.168.100.187:5070" rel="noreferrer" target="_blank">sip:bharti@192.168.100.187:<wbr>5070</a> | NULL<br>
>>> | NULL | 1970-01-01 05:30:00 | 1.00 | dfjrewr12386fd6-343@opensips.<wbr>mi<br>
>>> | 1 | 1970-01-01 05:30:00 | 0 | 0 | OpenSIPS MI Server |<br>
>>> NULL | NULL | NULL |<br>
>>><br>
>>> +-----+----------+--------+---<wbr>------------------------------<wbr>+----------+------+-----------<wbr>----------+------+------------<wbr>---------------------+------+-<wbr>--------------------+-------+-<wbr>-------+--------------------+-<wbr>-------+---------+------------<wbr>--+<br>
>>> 1 row in set (0.01 sec)<br>
>>><br>
>>> ------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----------<br>
>>><br>
>>><br>
>>> I am using commands in sipp:<br>
>>><br>
>>> UAC ---./sipp -sn uac <a href="http://192.168.100.19:5060" rel="noreferrer" target="_blank">192.168.100.19:5060</a> -s bharti -i 192.168.100.19<br>
>>> -p 5065 -m 10 -r 1 -rp 1000<br>
>>><br>
>>> UAS -- ./sipp -sn uas <a href="http://192.168.100.19:5060" rel="noreferrer" target="_blank">192.168.100.19:5060</a> -i 192.168.100.187 -p 5070<br>
>>><br>
>>><br>
>>> If I remove the load balancer and execute similar sipp commands and<br>
>>> run a single call, it is successfull.<br>
>>><br>
>>><br>
>>><br>
>>> Logs at Load_Balancer:<br>
>>><br>
>>> ------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------------------------<br>
>>> Jan 11 18:13:17 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[5375]: Inside main route loop<br>
>>> LoadBalance<br>
>>> Jan 11 18:13:17 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[5376]: Inside failure_route<br>
>>> GW_FAILOVER<br>
>>> Jan 11 18:13:17 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[5352]: message repeated 2<br>
>>> times: [ Inside main route loop LoadBalance]<br>
>>> Jan 11 18:13:17 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[5352]: Inside failure_route<br>
>>> GW_FAILOVER<br>
>>> Jan 11 18:13:17 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[5352]: Inside main route loop<br>
>>> LoadBalance<br>
>>><br>
>>> ------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------------<br>
>>><br>
>>> Logs At OPensips Proxy :<br>
>>><br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16743]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16725]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16731]: new branch at<br>
>>> <a href="http://sip:bharti@192.168.100.19:5060" rel="noreferrer" target="_blank">sip:bharti@192.168.100.19:5060</a><br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16731]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16721]: new branch at<br>
>>> <a href="http://sip:bharti@192.168.100.19:5060" rel="noreferrer" target="_blank">sip:bharti@192.168.100.19:5060</a><br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16721]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16722]: new branch at<br>
>>> <a href="http://sip:bharti@192.168.100.19:5060" rel="noreferrer" target="_blank">sip:bharti@192.168.100.19:5060</a><br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16722]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16728]: incoming reply<br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16737]: new branch at<br>
>>> <a href="http://sip:bharti@192.168.100.19:5060" rel="noreferrer" target="_blank">sip:bharti@192.168.100.19:5060</a><br>
>>> Jan 11 18:13:18 stack-VirtualBox<br>
>>> /usr/local/opensips_proxy/<wbr>sbin/opensips[16737]: incoming reply<br>
>>><br>
>>> ------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br>
>>><br>
>>> Regards<br>
>>> Mayur<br>
>>><br>
>>> On Tue, Jan 9, 2018 at 7:59 PM, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> Are you sure the OpenSIPS LB is able to reach via SIP the destinations<br>
>>>> you<br>
>>>> configured in the LB table ? Run a single call (with sipp) and make a<br>
>>>> network capture to understand how the call is routed.<br>
>>>><br>
>>>> Regards,<br>
>>>><br>
>>>> Bogdan-Andrei Iancu<br>
>>>><br>
>>>> OpenSIPS Founder and Developer<br>
>>>> <a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.<wbr>com</a><br>
>>>> OpenSIPS Summit 2018<br>
>>>> <a href="http://www.opensips.org/events/Summit-2018Amsterdam" rel="noreferrer" target="_blank">http://www.opensips.org/<wbr>events/Summit-2018Amsterdam</a><br>
>>>><br>
>>>><br>
>>>> On 01/08/2018 06:08 PM, Mayur Koshal wrote:<br>
>>>>><br>
>>>>> Reposting the setup part as was not visible clearly in the previous<br>
>>>>> mail.<br>
>>>>><br>
>>>>><br>
>>>>> My setup is like :<br>
>>>>><br>
>>>>><br>
>>>>> ---------><br>
>>>>> Opensips Proxy 1 ----> UAS 1<br>
>>>>><br>
>>>>> UAC -----> Load Balancer<br>
>>>>> --------><br>
>>>>> Opensips<br>
>>>>> Proxy 2 -----> UAS 2<br>
>>>>><br>
>>>>> Regards<br>
>>>>> Mayur<br>
>>>>><br>
>>>>> On Mon, Jan 8, 2018 at 9:16 PM, Mayur Koshal <<a href="mailto:mayurkoshal@gmail.com">mayurkoshal@gmail.com</a>><br>
>>>>> wrote:<br>
>>>>>><br>
>>>>>> Hi Everyone,<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> I have configured and build opensips as a Load Balancer but am not<br>
>>>>>> able to make it work.<br>
>>>>>><br>
>>>>>> Not able to figure out where the problem is ?<br>
>>>>>><br>
>>>>>> Request your help in resolving the issue ..<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> My setup is like :<br>
>>>>>><br>
>>>>>><br>
>>>>>> ---------><br>
>>>>>> Opensips Proxy 1 ----> UAS 1<br>
>>>>>><br>
>>>>>> UAC -----> Load Balancer<br>
>>>>>> --------><br>
>>>>>> Opensips<br>
>>>>>> Proxy 2 -----> UAS 2<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> where UAC = 192.168.100.18<br>
>>>>>> Load Balancer = <a href="http://192.168.100.18:5060" rel="noreferrer" target="_blank">192.168.100.18:5060</a><br>
>>>>>> OPensips Proxy 1 = <a href="http://192.168.100.194:5060" rel="noreferrer" target="_blank">192.168.100.194:5060</a><br>
>>>>>> Opensips Proxy 2 = <a href="http://192.168.100.187:5060" rel="noreferrer" target="_blank">192.168.100.187:5060</a><br>
>>>>>> sipp UAS 1 = <a href="http://192.168.100.194:5080" rel="noreferrer" target="_blank">192.168.100.194:5080</a><br>
>>>>>> sipp UAS 2 = <a href="http://192.168.100.187:5080" rel="noreferrer" target="_blank">192.168.100.187:5080</a><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> I use the below sipp command for<br>
>>>>>><br>
>>>>>> Sipp UAC Command : ./sipp -sn uac -rsa <a href="http://192.168.100.18:5060" rel="noreferrer" target="_blank">192.168.100.18:5060</a><br>
>>>>>> <a href="http://192.168.100.194:5080" rel="noreferrer" target="_blank">192.168.100.194:5080</a><br>
>>>>>> Sipp UAS1 Command : ./sipp -sn uas<br>
>>>>>><br>
>>>>>> When I bypass the load balancer and use sipp to test opensips proxy it<br>
>>>>>> works fine.<br>
>>>>>><br>
>>>>>> When I run the Load Balancer I can see in the wireshark logs as: ICMP<br>
>>>>>> 590 Destination unreachable (Port unreachable).<br>
>>>>>><br>
>>>>>> In the opensips logs it goes to the failure route and displays message<br>
>>>>>> Failed trunk <a href="http://192.168.100.194/" rel="noreferrer" target="_blank">192.168.100.194/</a><null> detected.<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> The load distribution table I am using is as below :<br>
>>>>>><br>
>>>>>> mysql> select * from load_balancer;<br>
>>>>>><br>
>>>>>><br>
>>>>>> +----+----------+-------------<wbr>--------+-----------+---------<wbr>---+-------------+<br>
>>>>>> | id | group_id | dst_uri | resources | probe_mode |<br>
>>>>>> description |<br>
>>>>>><br>
>>>>>><br>
>>>>>> +----+----------+-------------<wbr>--------+-----------+---------<wbr>---+-------------+<br>
>>>>>> | 1 | 1 | sip:192.168.100.194 | sip=64 | 0 |<br>
>>>>>> Server1<br>
>>>>>> |<br>
>>>>>> | 2 | 1 | sip:192.168.100.187 | sip=64 | 0 |<br>
>>>>>> Server2<br>
>>>>>> |<br>
>>>>>><br>
>>>>>><br>
>>>>>> +----+----------+-------------<wbr>--------+-----------+---------<wbr>---+-------------+<br>
>>>>>> 2 rows in set (0.00 sec)<br>
>>>>>><br>
>>>>>><br>
>>>>>> The load balancer script, Proxy script, Load balancer logs are below.<br>
>>>>>><br>
>>>>>><br>
>>>>>> Load Balancer Script :<br>
>>>>>><br>
>>>>>><br>
>><br>
><br>
><br>
</div></div></blockquote></div><br></div>