Hi Bogdan ,
I will try the script_trace and make a call. Meanwhile I had put xlogs in the load balancer script to see the destination and RURI. The destination is coming as NULL when I try to make a call using sipp. Also error message is seen in the LB logs when the call is executed : ERROR:core:print_rr_body: too many RR ERROR:dialog:get_routing_info: failed to print route records The logs and LB script route snippet is as below : Logs_LB : ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20729]: DEst and RURI after record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: Inside main route loop LoadBalance Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: Destination available before initial req are sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: DEst and RURI before record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: DEst and RURI after record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: ERROR:core:print_rr_body: too many RR Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20722]: ERROR:dialog:get_routing_info: failed to print route records Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: Inside main route loop LoadBalance Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: Destination available before initial req are sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: DEst and RURI before record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: DEst and RURI after record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: ERROR:core:print_rr_body: too many RR Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20721]: ERROR:dialog:get_routing_info: failed to print route records Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: Inside main route loop LoadBalance Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: Destination available before initial req are sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: DEst and RURI before record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: DEst and RURI after record route sip:Mayur@192.168.100.19:5060/<null> Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: ERROR:core:print_rr_body: too many RR Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20718]: ERROR:dialog:get_routing_info: failed to print route records Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20739]: Inside failure_route GW_FAILOVER Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20728]: Inside main route loop LoadBalance Jan 16 16:35:41 stack-VirtualBox /usr/local/opensips_proxy/sbin/opensips[20728]: Inside else of loose route ----------------------------------------------------------------------------------------------------------------------- Load Balancer Script : ####### Routing Logic ######## # main request routing logic route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; } xlog("Inside main route loop LoadBalance\n"); if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("Inside loose_route loop LoadBalance\n"); # validate the sequential request against dialog if ( $DLG_status!=NULL && !validate_dialog() ) { xlog("In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n"); ## exit; } if (is_method("BYE")) { setflag(1); # do accounting ... setflag(3); # ... even if the transaction fails } else if (is_method("INVITE")) { # even if in most of the cases is useless, do RR for # re-INVITEs alos, as some buggy clients do change route set # during the dialog. xlog("Inside else if is_method INVITE loop LoadBalance\n"); record_route(); } # route it out to whatever destination was set by loose_route() # in $du (destination URI). route(RELAY); } else { xlog("Inside else of loose route \n"); if ( is_method("ACK") ) { if ( t_check_trans() ) { # non loose-route, but stateful ACK; must be an ACK after # a 487 or e.g. 404 from upstream server xlog("Inside ACK $ru/$du \n"); t_relay(); exit; } else { # ACK without matching transaction -> # ignore and discard exit; } } sl_send_reply("404","Not here"); } exit; } xlog("Destination available before initial req are $ru/$du \n"); #### INITIAL REQUESTS # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) xlog("Inside CANCEL $ru/$du \n"); t_relay(); exit; } else if (!is_method("INVITE")) { send_reply("405","Method Not Allowed"); exit; } if ($rU==NULL) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; } t_check_trans(); # preloaded route checking if (loose_route()) { xlog("L_ERR", "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]"); if (!is_method("ACK")) sl_send_reply("403","Preload Route denied"); exit; } # record routing xlog("DEst and RURI before record route $ru/$du \n"); record_route(); xlog("DEst and RURI after record route $ru/$du \n"); setflag(1); # do accounting if ( !load_balance("1","sip")) { xlog("Inside load_balance loop LoadBalance\n"); send_reply("500","No Destination available"); exit; } t_on_failure("GW_FAILOVER"); route(RELAY); } route[RELAY] { if (!t_relay()) { sl_reply_error(); }; exit; } failure_route[GW_FAILOVER] { xlog("Inside failure_route GW_FAILOVER \n"); if (t_was_cancelled()) { exit; } # failure detection with redirect to next available trunk if (t_check_status("(408)|([56][0-9][0-9])")) { xlog("Failed trunk $rd/$du detected \n"); if ( load_balance("1","sip") ) { t_on_failure("GW_FAILOVER"); xlog("Destination available before initial req are $ru/$du \n"); t_relay(); exit; } send_reply("500","All GW are down"); } } local_route { if (is_method("BYE") && $DLG_dir=="UPSTREAM") { acc_log_request("200 Dialog Timeout"); } } Regards Mayur On Tue, Jan 16, 2018 at 4:07 PM, Bogdan-Andrei Iancu <bog...@opensips.org> wrote: > Hi Mayur, > > The simplest way to debug this is by using the script_trace() function - > see: > http://www.opensips.org/Documentation/Script-CoreFunctions-2-3#toc43 > > Simply add in the very begging of your script: > script_trace( 1, "$rm from $si, ruri=$ru/$du", "LB"); > > and make a call - see the execution trace through the script for your > INVITE. > > Regards, > > Bogdan-Andrei Iancu > > OpenSIPS Founder and Developer > http://www.opensips-solutions.com > OpenSIPS Summit 2018 > http://www.opensips.org/events/Summit-2018Amsterdam > > On 01/15/2018 07:23 PM, Mayur Koshal wrote: > > Hi Bogdan, > > Thanks for your time and looking into this. > > I am using the Load balancer script which is generated from the menuconfig > as it is. The script was generated after I compiled and build opensips . Did > not made much changes to it. > > Need to find out the reason why it is looping inside LB and not forwarding > it to Proxy. > > > Regards > Mayur > > > > > On Mon, Jan 15, 2018 at 10:43 PM, Bogdan-Andrei Iancu <bog...@opensips.org> > wrote: >> >> Hi MAyur, >> >> Your trance does not show the INVITE being route outside the LB (.19). >> Even more there is a "Too many hops reply" back, suggesting that a loop is >> created on the LB and the INVITE is never sent to the destination (but keep >> re-routed back to LB). >> >> When you do t_relay() in your script, place before it an xlog to see the >> destinations: >> xlog("sending out request to $ru/$du\n"); >> >> Regards, >> >> Bogdan-Andrei Iancu >> >> OpenSIPS Founder and Developer >> http://www.opensips-solutions.com >> OpenSIPS Summit 2018 >> http://www.opensips.org/events/Summit-2018Amsterdam >> >> On 01/12/2018 07:36 PM, Mayur Koshal wrote: >>> >>> Hi Bogdan, >>> >>> Thanks for the Reply. >>> >>> Yes The opensips load balancer is able to reach destinations which is >>> configured in the load balancer table as I can see in the wireshark >>> logs and opensips logs of the SIP Proxy server. >>> >>> >>> >>> >>> I have removed one SIP proxy in the table and the load distribution >>> table looks like : >>> >>> mysql> select * from load_balancer; >>> | id | group_id | dst_uri | resources | probe_mode | >>> description | >>> >>> +----+----------+--------------------------+-----------+------------+-------------+ >>> | 2 | 1 | sip:192.168.100.187:5060 | sip=50 | 0 | >>> serv1 | >>> >>> +----+----------+--------------------------+-----------+------------+-------------+ >>> >>> >>> Now I am using the setup with only one sip proxy to make it simpler as : >>> >>> >>> UAC(192.168.100.19:5065).......>Load_Balancer(192.168.100.19:5060)......>Proxy(192.168.100.187:5060)..........> >>> UAS(192.168.187:5070) >>> >>> >>> I have added a user in Load Balancer: >>> >>> sip:bharti@192.168.100.187:5070 >>> >>> >>> >>> Database changed >>> mysql> select * from location; >>> >>> +-----+----------+--------+---------------------------------+----------+------+---------------------+------+---------------------------------+------+---------------------+-------+--------+--------------------+--------+---------+--------------+ >>> | id | username | domain | contact | received >>> | path | expires | q | callid >>> | cseq | last_modified | flags | cflags | user_agent | >>> socket | methods | sip_instance | >>> >>> +-----+----------+--------+---------------------------------+----------+------+---------------------+------+---------------------------------+------+---------------------+-------+--------+--------------------+--------+---------+--------------+ >>> | 272 | bharti | | sip:bharti@192.168.100.187:5070 | NULL >>> | NULL | 1970-01-01 05:30:00 | 1.00 | dfjrewr12386fd6-...@opensips.mi >>> | 1 | 1970-01-01 05:30:00 | 0 | 0 | OpenSIPS MI Server | >>> NULL | NULL | NULL | >>> >>> +-----+----------+--------+---------------------------------+----------+------+---------------------+------+---------------------------------+------+---------------------+-------+--------+--------------------+--------+---------+--------------+ >>> 1 row in set (0.01 sec) >>> >>> ---------------------------------------------------------------------------------------------------- >>> >>> >>> I am using commands in sipp: >>> >>> UAC ---./sipp -sn uac 192.168.100.19:5060 -s bharti -i 192.168.100.19 >>> -p 5065 -m 10 -r 1 -rp 1000 >>> >>> UAS -- ./sipp -sn uas 192.168.100.19:5060 -i 192.168.100.187 -p 5070 >>> >>> >>> If I remove the load balancer and execute similar sipp commands and >>> run a single call, it is successfull. >>> >>> >>> >>> Logs at Load_Balancer: >>> >>> ------------------------------------------------------------------------------------------------------------------- >>> Jan 11 18:13:17 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[5375]: Inside main route loop >>> LoadBalance >>> Jan 11 18:13:17 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[5376]: Inside failure_route >>> GW_FAILOVER >>> Jan 11 18:13:17 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[5352]: message repeated 2 >>> times: [ Inside main route loop LoadBalance] >>> Jan 11 18:13:17 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[5352]: Inside failure_route >>> GW_FAILOVER >>> Jan 11 18:13:17 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[5352]: Inside main route loop >>> LoadBalance >>> >>> -------------------------------------------------------------------------------------------------------------------- >>> >>> Logs At OPensips Proxy : >>> >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16743]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16725]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16731]: new branch at >>> sip:bharti@192.168.100.19:5060 >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16731]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16721]: new branch at >>> sip:bharti@192.168.100.19:5060 >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16721]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16722]: new branch at >>> sip:bharti@192.168.100.19:5060 >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16722]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16728]: incoming reply >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16737]: new branch at >>> sip:bharti@192.168.100.19:5060 >>> Jan 11 18:13:18 stack-VirtualBox >>> /usr/local/opensips_proxy/sbin/opensips[16737]: incoming reply >>> >>> -------------------------------------------------------------------------------------------------------- >>> >>> Regards >>> Mayur >>> >>> On Tue, Jan 9, 2018 at 7:59 PM, Bogdan-Andrei Iancu <bog...@opensips.org> >>> wrote: >>>> >>>> Hi, >>>> >>>> Are you sure the OpenSIPS LB is able to reach via SIP the destinations >>>> you >>>> configured in the LB table ? Run a single call (with sipp) and make a >>>> network capture to understand how the call is routed. >>>> >>>> Regards, >>>> >>>> Bogdan-Andrei Iancu >>>> >>>> OpenSIPS Founder and Developer >>>> http://www.opensips-solutions.com >>>> OpenSIPS Summit 2018 >>>> http://www.opensips.org/events/Summit-2018Amsterdam >>>> >>>> >>>> On 01/08/2018 06:08 PM, Mayur Koshal wrote: >>>>> >>>>> Reposting the setup part as was not visible clearly in the previous >>>>> mail. >>>>> >>>>> >>>>> My setup is like : >>>>> >>>>> >>>>> ---------> >>>>> Opensips Proxy 1 ----> UAS 1 >>>>> >>>>> UAC -----> Load Balancer >>>>> --------> >>>>> Opensips >>>>> Proxy 2 -----> UAS 2 >>>>> >>>>> Regards >>>>> Mayur >>>>> >>>>> On Mon, Jan 8, 2018 at 9:16 PM, Mayur Koshal <mayurkos...@gmail.com> >>>>> wrote: >>>>>> >>>>>> Hi Everyone, >>>>>> >>>>>> >>>>>> >>>>>> I have configured and build opensips as a Load Balancer but am not >>>>>> able to make it work. >>>>>> >>>>>> Not able to figure out where the problem is ? >>>>>> >>>>>> Request your help in resolving the issue .. >>>>>> >>>>>> >>>>>> >>>>>> My setup is like : >>>>>> >>>>>> >>>>>> ---------> >>>>>> Opensips Proxy 1 ----> UAS 1 >>>>>> >>>>>> UAC -----> Load Balancer >>>>>> --------> >>>>>> Opensips >>>>>> Proxy 2 -----> UAS 2 >>>>>> >>>>>> >>>>>> >>>>>> where UAC = 192.168.100.18 >>>>>> Load Balancer = 192.168.100.18:5060 >>>>>> OPensips Proxy 1 = 192.168.100.194:5060 >>>>>> Opensips Proxy 2 = 192.168.100.187:5060 >>>>>> sipp UAS 1 = 192.168.100.194:5080 >>>>>> sipp UAS 2 = 192.168.100.187:5080 >>>>>> >>>>>> >>>>>> >>>>>> I use the below sipp command for >>>>>> >>>>>> Sipp UAC Command : ./sipp -sn uac -rsa 192.168.100.18:5060 >>>>>> 192.168.100.194:5080 >>>>>> Sipp UAS1 Command : ./sipp -sn uas >>>>>> >>>>>> When I bypass the load balancer and use sipp to test opensips proxy it >>>>>> works fine. >>>>>> >>>>>> When I run the Load Balancer I can see in the wireshark logs as: ICMP >>>>>> 590 Destination unreachable (Port unreachable). >>>>>> >>>>>> In the opensips logs it goes to the failure route and displays message >>>>>> Failed trunk 192.168.100.194/<null> detected. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> The load distribution table I am using is as below : >>>>>> >>>>>> mysql> select * from load_balancer; >>>>>> >>>>>> >>>>>> +----+----------+---------------------+-----------+------------+-------------+ >>>>>> | id | group_id | dst_uri | resources | probe_mode | >>>>>> description | >>>>>> >>>>>> >>>>>> +----+----------+---------------------+-----------+------------+-------------+ >>>>>> | 1 | 1 | sip:192.168.100.194 | sip=64 | 0 | >>>>>> Server1 >>>>>> | >>>>>> | 2 | 1 | sip:192.168.100.187 | sip=64 | 0 | >>>>>> Server2 >>>>>> | >>>>>> >>>>>> >>>>>> +----+----------+---------------------+-----------+------------+-------------+ >>>>>> 2 rows in set (0.00 sec) >>>>>> >>>>>> >>>>>> The load balancer script, Proxy script, Load balancer logs are below. >>>>>> >>>>>> >>>>>> Load Balancer Script : >>>>>> >>>>>> >> > > _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users