[OpenSIPS-Users] Question regarding load_balancer resources

Diego Barberio diego.barberio at redmondsoftware.com
Fri May 20 11:28:41 CEST 2011



Hi All,

I have opensips using load_balancer module with two destinations. Both have 500 pstn resources and execute a simple application
that answers a call, plays some audio and waits for the BYE message.
If I place few calls (10 at the same time) all works great. However, if I
put more traffic, the pstn resources are not freed always, even if all the calls are ended gracefully and the BYE and the subsequent OK messages are
forwarded correctly.
I'm sure there's a problem with my configuration or my destinations. So I need to now what triggers the liberation of the
resource.

This is my configuration script:

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

debug=3
#log_facility=LOG_LOCAL6

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

/* uncomment the next line to disable TCP (default on) */
disable_tcp=yes

port=5061

/* uncomment and configure the following line if you want opensips to 
   bind on a specific interface/port/proto (default
bind on all available) */
listen=udp:10.180.12.6:5061


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

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

loadmodule "maxfwd.so"
loadmodule "sl.so"
loadmodule
"db_mysql.so"
loadmodule "tm.so"
loadmodule "uri.so"
loadmodule "rr.so"
loadmodule
"dialog.so"
loadmodule "mi_fifo.so"
loadmodule "signaling.so"
loadmodule "textops.so"
loadmodule "load_balancer.so"
loadmodule "options.so"

# ----------------- setting module-specific parameters
---------------


# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name",
"/tmp/opensips_fifo")


# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
#modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
#modparam("rr", "append_fromtag", 0)
modparam("rr","enable_double_rr",1)
modparam("rr","append_fromtag",1)


# ----- uri params -----
modparam("uri",
"use_uri_table", 0)

modparam("dialog", "dlg_flag", 13)
modparam("dialog",
"db_mode", 1)
modparam("dialog", "db_url", "mysql://root:Viamonte1621@localhost/opensips")


modparam("load_balancer", "db_url","mysql://root:Viamonte1621@localhost/opensips")
modparam("load_balancer", "probing_interval", 30)
modparam("load_balancer", "probing_method",
"OPTIONS")
modparam("load_balancer", "probing_from", "sip:proxy at 10.180.12.6:5061")




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


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


    if (!has_totag()) {
        xlog("[Redmond] Hast'n to tag\n");
                # initial request
   
    record_route();
    } else {
        # sequential request -> obey Route
indication
        xlog("[Redmond] Has to tag\n");
       
loose_route();
                t_relay();
                exit;
       
}

        # handle cancel and re-transmissions
    if (
is_method("CANCEL") ) {
        if ( t_check_trans() )
       
    t_relay();
        exit;
    }
    
    if (uri==myself){
        if (is_method("OPTIONS") && (!
uri=~"sip:.*[@]+.*")) {
            options_reply();
   
        exit;
        }
    }

        # from now on we have only the initial requests
        if
(!is_method("INVITE")) {
        xlog("[Redmond] Not invite\n");
   
    if ( t_check_trans() )
            t_relay();
   
    exit;
               
#send_reply("405","Method Not Allowed");
                #exit;
       
}

    load_balance("0","pstn");

        # LB function
returns negative if no suitable destination (for requested resources) is found,
        # or if all
destinations are full
        if ($retcode<0) {
       
xlog("[Redmond] Service full\n");
        sl_send_reply("500","Service full");
        exit;
        }

    xlog("[Redmond]
Selected destination is: $du\n");

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

failure_route[1] {
    xlog("[Redmond] Failure route\n");
        if
(t_check_status("(408)|(5[0-9][0-9])")) {
               
lb_disable();
                if
(load_balance("0","pstn")) {
                       
t_on_failure("1");
                       
t_relay();
                } else {
                    
                       
t_reply("503", "Service Unavailable");
                }
        }
}

Thanks,
Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110520/83983630/attachment-0001.htm>


More information about the Users mailing list