Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-03-21 Thread Mayur Koshal
Hi Bogdan,

Sorry for the delayed reply.

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 :

UAC(192.168.100.21:5065)---LB (192.168.100.21:5060)--SIP Proxy
(192.168.100.17:5060)UAS(192.168.100.17:5080)

sipp commands used :

./sipp -sf uac_mod.xml 192.168.100.21:5060 -s archana -i 192.168.100.21 -p
5065 -r 1 -rp 1000 -m 10

./sipp -sf uas_mod_orig.xml -rsa 192.168.100.21:5060 -i 192.168.100.17 -p
5080

where I have registered user archana in the SIP proxy server .


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 ).

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.

when I hardcoded the request uri in the Proxy script to the UAS uri I can
see the invite request reaching the UAS.

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)

There is some issue in the script either in LB or Proxy which I am not able
to figure out.

Request your help for the same.



The LB and Proxy script snnipets as below :

Load Balancer Script  :


route{

if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit; }

if (has_totag()) {

  # sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
  # 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(ACC_DO); # do accounting ...
setflag(ACC_FAILED); # ... 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.
record_route();
}

# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(RELAY);
} else {
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
  t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}

 INITIAL REQUESTS

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
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_route();

setflag(ACC_DO); # do accounting

if ( !load_balance("1","sip")) {

   xlog("\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] {
  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");
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");
}
}


*

Proxy Script :




route{

if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}

if (has_totag()) {

# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {

  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.
  record_route();
}


# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(1);
} else {
  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

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-03-07 Thread Mayur Koshal
Hi Bogdan,

Sorry for the delayed reply.

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 :

UAC(192.168.100.21:5065)---LB (192.168.100.21:5060)--SIP Proxy
(192.168.100.17:5060)UAS(192.168.100.17:5080)

sipp commands used :

./sipp -sf uac_mod.xml 192.168.100.21:5060 -s archana -i
192.168.100.21 -p 5065 -r 1 -rp 1000 -m 10

./sipp -sf uas_mod_orig.xml -rsa 192.168.100.21:5060 -i 192.168.100.17 -p 5080

where I have registered user archana in the SIP proxy server .


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 ).

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.

when I hardcoded the request uri in the Proxy script to the UAS uri I
can see the invite request reaching the UAS.

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)

There is some issue in the script either in LB or Proxy which I am not
able to figure out.

Request your help for the same.



The LB and Proxy script snnipets as below :

Load Balancer Script  :


route{

 if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit; }

if (has_totag()) {

  # sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
  # 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(ACC_DO); # do accounting ...
setflag(ACC_FAILED); # ... 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.
record_route();
}

# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(RELAY);
} else {
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
  t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}

 INITIAL REQUESTS

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
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_route();

setflag(ACC_DO); # do accounting

if ( !load_balance("1","sip")) {

   xlog("\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] {
   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");
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");
}
}


*

Proxy Script :




route{

if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}

if (has_totag()) {

# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {

   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.
   record_route();
}


# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
 route(1);
} else {
  if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-16 Thread Mayur Koshal
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-16 Thread Bogdan-Andrei Iancu

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 
mailto: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.


Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-15 Thread Mayur Koshal
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 
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 sta

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-15 Thread Bogdan-Andrei Iancu

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 rep

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-12 Thread Mayur Koshal
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  wrote:
> Hi,
>
> Are you sure the OpenSIPS LB is able to reach via SIP the destinations you
> configured in the LB tabl

Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-09 Thread Bogdan-Andrei Iancu

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  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/ 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


Re: [OpenSIPS-Users] Not able to make Load Balancer work

2018-01-08 Thread Mayur Koshal
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  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/ 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 :
>
> 
> debug=3
> log_stderror=no
> log_facility=LOG_LOCAL1
>
> fork=yes
> children=4
>
> /* uncomment the following lines to enable debugging */
> #debug=6
> #fork=no
> #log_stderror=yes
>
> /* uncomment the next line to enable the auto temporary blacklisting of
>not available destinations (default disabled) */
> #disable_dns_blacklist=no
>
> /* uncomment the next line to enable IPv6 lookup after IPv4 dns
>lookup failures (default disabled) */
> #dns_try_ipv6=yes
>
> /* comment the next line to enable the auto discovery of local aliases
>based on revers DNS on IPs */
> auto_aliases=no
>
>
> listen=udp:192.168.100.18:5060   # CUSTOMIZE ME
>
> disable_tcp=no
> listen=tcp:192.168.100.18:5060   # CUSTOMIZE ME
>
> disable_tls=yes
>
>
>
>
> ### Modules Section 
>
> #set module path
> mpath="/usr/local/opensips_proxy/lib64/opensips/modules/"
>
>  SIGNALING module
> loadmodule "signaling.so"
>
>  StateLess module
> loadmodule "sl.so"
>
>  Transaction Module
> loadmodule "tm.so"
> modparam("tm", "fr_timer", 5)
> modparam("tm", "fr_inv_timer", 30)
> modparam("tm", "restart_fr_on_each_reply", 0)
> modparam("tm", "onreply_avp_mode", 1)
>
>  Record Route Module
> loadmodule "rr.so"
> /* do not append from tag to the RR (no need for this script) */
> modparam("rr", "append_fromtag", 0)
>
>  MAX ForWarD module
> loadmodule "maxfwd.so"
>
>  SIP MSG OPerationS module
> loadmodule "sipmsgops.so"
>
>  FIFO Management Interface
> loadmodule "mi_fifo.so"
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
> modparam("mi_fifo", "fifo_mode", 0666)
>
>  URI module
> loadmodule "uri.so"
> modparam("uri", "use_uri_table", 0)
>
>  MYSQL module
> loadmodule "db_mysql.so"
>
>  AVPOPS module
> loadmodule "avpops.so"
>
>  ACCounting module
> loadmodule "acc.so"
> /* what special events should be accounted ? */
> modparam("acc", "early_media", 0)
> modparam("acc", "report_cancels", 0)
> /* by default we do not adjust the direct of the sequential requests.
>if you enable this parameter, be sure the enable "append_fromtag"
>in "rr" module */
> modparam("acc", "detect_direction", 0)
> modparam("acc", "failed_transaction_flag", "ACC_FAILED")
> /* account triggers (flags) */
> modparam("acc", "log_flag", "ACC_DO")
> modparam("acc", "log_missed_flag", "ACC_MISSED")
>
>
>  DIALOG module
> loadmodule "dialog.so"
> modparam("dialog", "dlg_match_mode", 1)
> modparam("dialog", "default_timeout", 21600)  # 6 hours timeout
> modparam("dialog", "db_mode", 2)
> modparam("dialog", "db_url",
> "mysql://opensips:stack@localhos