[OpenSIPS-Users] Load Balancer - Delay in clearing dialogs

Chandan PR chandan.pr at webshar.org
Tue Aug 16 11:47:36 CEST 2016


Hi Guys,

Opendsips Version : 1.9.x

We have configured the load balancer with 8 ports.

When the calls are ongoing, the lb_list shows the load balancer is running
full.

root at Dev-Chandan-Opensips-LB:/usr/local/opensips/sbin# ./opensipsctl fifo
lb_list
Destination:: sip:192.168.248.62:5060 id=152 group=1 enabled=yes auto-re=on
Resource:: channel max=4 load=4
Destination:: sip:192.168.248.64:5060 id=153 group=1 enabled=yes auto-re=on
Resource:: channel max=4 load=4

When I check the dialog_list, I see some older dialogs which are yet to be
cleared.

root at Dev-Chandan-Opensips-LB:/usr/local/opensips/sbin# ./opensipsctl fifo
dlg_list | grep "callid"
callid:: 14713396610041471339775929_ZTLT_931
callid:: 14713396610151471339775929_ZTLT_937
callid:: 14713396610221471339775929_ZTLT_942
callid:: 14713396610081471339775929_ZTLT_933
callid:: 14713396610181471339775929_ZTLT_939
callid:: 14713396610191471339775929_ZTLT_940
callid:: 14713396610131471339775929_ZTLT_936
callid:: 14713396610031471339775929_ZTLT_930
callid:: 14713396610061471339775929_ZTLT_932
callid:: 14713396610161471339775929_ZTLT_938
callid:: 14713396610271471339775929_ZTLT_945
callid:: 14713396610371471339775929_ZTLT_951
callid:: 14713396610101471339775929_ZTLT_934
callid:: 14713396610311471339775929_ZTLT_947
callid:: 14713396610211471339775929_ZTLT_941
callid:: 14713396610241471339775929_ZTLT_943
callid:: 14713396610341471339775929_ZTLT_949
callid:: 14713396610011471339775929_ZTLT_929
callid:: 14713396610111471339775929_ZTLT_935
root at Dev-Chandan-Opensips-LB:/usr/local/opensips/sbin# ./opensipsctl fifo
dlg_list | grep "callid" | wc -l
13
root at Dev-Chandan-Opensips-LB:/usr/local/opensips/sbin#

*Even when the lb_list shows the load as 0, I see some dialogs present and
getting cleared after around 10-12 seconds.*

What would be the impact of this delay in clearing the dialogs? Can this
lead to lot many calls rejected with "Destination Full" (We are
experiencing this issue in our production, where a huge number of calls
rejected)?

Is there any way to reduce this delay or clear the dialogs immediately?

*Dialog Module Settings:*
#### 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:opensipsrw@localhost/opensips") #


*Load Balancer Script:*
#
# $Id: opensips_loadbalancer.m4 9723 2013-02-01 15:10:50Z bogdan_iancu $
#
# OpenSIPS loadbalancer script
#     by OpenSIPS Solutions <team at opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
#   the "Load Balancer" scenario.
# You can enable / disable more features / functionalities by
#   re-generating the scenario with different options.
#
# Please refer to the Core CookBook at:
#      http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#


####### Global Parameters #########

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.248.111:5060   # CUSTOMIZE ME

disable_tcp=no
listen=tcp:192.168.248.111:5060   # CUSTOMIZE ME

disable_tls=yes




####### Modules Section ########

#set module path
mpath="/usr/local/opensips/lib64/opensips/modules/"



#### SIGNALING module
loadmodule "signaling.so"

#### StateLess module
loadmodule "sl.so"

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timer", 30)
modparam("tm", "fr_inv_timer", 120)
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:opensipsrw@localhost/opensips") # CUSTOMIZE ME


#### LOAD BALANCER module
loadmodule "load_balancer.so"
modparam("load_balancer", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
modparam("load_balancer", "probing_method", "OPTIONS")

modparam("load_balancer", "probing_interval", 15)





####### Routing Logic ########


# main request routing logic
route{
if (!mf_process_maxfwd_header("3")) {
send_reply("483","looping");
exit;
}


if ( has_totag() ) {
# sequential request -> obey Route indication
xlog("Loose Route for $avp(iurl) over $avp(dest) $avp(calltype) \n");
loose_route();
                t_relay();
                exit;
        }

        # handle cancel and re-transmissions
if ( is_method("CANCEL") ) {
if ( t_check_trans() )
t_relay();
exit;
}


        # from now on we have only the initial requests
        if (!is_method("INVITE")) {
                send_reply("405","Method Not Allowed");
                exit;
        }

        # initial request
record_route();
$avp(iurl) = $(hdr(P-Nuance-Initial-URL));
$avp(calltype) = $(hdr(P-Nuance-Call-Type));
        xlog("Sending call $fu $avp(iurl) $avp(calltype) \n");
xlog("Current Dialogs count $DLG_count \n");
# LB function returns negative if no suitable destination (for requested
resources) is found,
        # or if all destinations are full
        if ( !load_balance("1","channel") ) {
    xlog("All Destinations are full. Sending 500! $fu
$(hdr(P-Nuance-Initial-URL)) CURRENT DIALOGS $DLG_count \n");
             send_reply("500","Service full");
             exit;
        }
$avp(dest) = $du;
xlog("Call sent over $avp(dest) $fu $(hdr(P-Nuance-Initial-URL))\n");
t_on_reply("test");
        # arm a failure route for be able to catch a failure event and to
do
        # failover to the next available destination
        t_on_failure("LB_failed");

        # send it out
if (!t_relay()) {
sl_reply_error();
}

}

#onreply_route {
# xlog("OpenSIPS received a reply $avp(iurl) rs= $rs | fu= $fu | si= $si |
Ri= $Ri ===");
#}

onreply_route[test] {
xlog("Reply $rs received from $si for the call $avp(iurl)");
}

failure_route[LB_failed]
{
        # skip if call was canceled
if (t_was_cancelled()) {
exit;
}
xlog("Call $avp(iurl) sent over $avp(dest) failed with code
$T_reply_code\n");

# Checking only for Destination Failure
# If the destination is failed, disable it and reroute the call
        #if ( t_check_status("[56][0-9][0-9]")) {
        if ( t_check_status("503")) {
       # this is a case for failover
                xlog("Marking $avp(dest) disabled as it failed for call
$avp(iurl) with code $T_reply_code\n");
                #xlog("call $avp(iurl) failed with code $T_reply_code from
$avp(dest)\n");
# mark failed destination as disabled
                lb_disable();
                # try to re-route to next available destination
                #if ( !load_balance("1","channel") ) {
#      xlog("RETRY FAILED SENDING 500");
                #      send_reply("500","Service Full");
                #      exit;
                #}
                #xlog("REPORT: re-routing call to $du \n");
                #t_relay();
        }
send_reply("$T_reply_code","Call Failed");
}


Regards,
Chandan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160816/b7c3fc4f/attachment-0001.htm>


More information about the Users mailing list