[OpenSIPS-Users] OpenSips rejecting calls even though the destination is not disabled

Chandan PR chandan.pr at webshar.org
Mon Aug 15 22:06:38 CEST 2016


Hi Guys,

We are observing an issue where OpenSips is rejecting calls as Destination
Full, even when the destination is not disabled...

We are not sending too many calls for all the destinations to be full.

The script is as below:

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

disable_tcp=no
listen=tcp:192.168.21.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");
# 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))");
             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]")) {
#Comment the below line and put the above condition to probe for all
500-699 errors
        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");
                # 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");
}


Please do let me know if any comments..

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


More information about the Users mailing list