[OpenSIPS-Users] Input on my loadbalancer configuration

Geoffrey Mina geoffreymina at gmail.com
Mon Nov 10 15:41:18 CET 2008


Please disregard that last configuration.  I have gone through and
enhanced the config based on some more studying.  If anyone would care
to comment on the current configuration I would really appreciate it.
It all works as designed, I am really just looking for any 'gotchas'
which I haven't accounted for... as well as anything I am doing which
is very inefficient or otherwise bad practice.

Thanks!
Geoff

<pre>


###### Global Parameters #####
debug=3
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=8
disable_tcp=yes
listen=eth0:5060
port=5060


#fork=no
#log_stderror=yes

##### Module Loading and Param Setting #####
mpath="/usr/local/lib64/opensips/modules/"
loadmodule "sl.so"
loadmodule "db_mysql.so"
loadmodule "tm.so"
loadmodule "maxfwd.so"
loadmodule "uri.so"
loadmodule "textops.so"

## Enable RR ##
loadmodule "rr.so"
modparam("rr", "enable_full_lr",0)
modparam("rr", "append_fromtag",1)
modparam("rr", "enable_double_rr",1)
modparam("rr", "add_username",0)

## Enable Logging ##
loadmodule "xlog.so"
modparam("xlog", "buf_size",4096)
modparam("xlog", "force_color",0)

## Enable SipTrace module for debugging SIP transactions ##
loadmodule "siptrace.so"
modparam("siptrace","db_url","mysql://appservers:appservers@localhost/opensips")
modparam("siptrace","table","sip_trace")
modparam("siptrace","trace_on",1)
modparam("siptrace","trace_flag",13)

## Enable Dispatcher module ##
loadmodule "dispatcher.so"
#modparam("dispatcher","ds_ping_method","INFO")
#modparam("dispatcher","ds_ping_from","sip:monitoring at connectfirst.com")
#modparam("dispatcher","ds_ping_interval",10)
#modparam("dispatcher","ds_probing_mode",1)


###########################################################################
## Request route 'main'
###########################################################################
route{
    xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
    setflag(13);
    sip_trace();

    if(msg:len > max_len){
        xlog("L_INFO", "Message too big\n");
        sl_send_reply("513", "Message Too Big");
        exit;
    }

    if (!mf_process_maxfwd_header("70")){
        xlog("L_INFO", "Too many hops\n");
        sl_send_reply("483", "Too Many Hops");
        exit;
    }

    if(!is_method("REGISTER")){
        xlog("L_INFO", "Recording Route info\n");
        record_route();
    }


    if(is_method("INVITE"){
        xlog("L_INFO", "Method is an INVITE, fetching next from dispatcher\n");
        route(1);
    }else if(loose_route()){
        xlog("L_INFO", "Loose route has returned true, attempting routing.\n");

        if(!has_totag()){
            xlog("L_INFO", "Initial loose-route rejected\n");
            sl_send_reply("403","Initial Loose-Routing Rejected.");
            exit;
        }

        route(2);
    }else{
        if(is_method("CANCEL") || is_method("ACK")){
            xlog("L_INFO", "We have an ACK or CANCEL");
            route(3);
        }
    }
}



########################################################################
## Handles relay of INVITE messages
## with round-robin load balancing
########################################################################
route[1]{
    ds_select_dst("1","4");
    t_on_reply("1");
    t_on_failure("1");
    t_relay();
}



########################################################################
## Handles relay of all non INVITE messages
########################################################################
route[2]{
    xlog("L_INFO", "Setting up reply handler  and relaying request\n");
    t_on_reply("1");
    if(!t_relay()){
        sl_reply_error();
    }
}


########################################################################
## Handles relay of CANCEL or ACK messages
########################################################################
route[3]{
    t_on_reply("1");
    if(t_check_trans()){
        if(!t_relay()){
            xlog("L_INFO","Error relaying message route[3]\n");
            sl_reply_error();
        }
    }else{
        xlog("L_INFO","Dropping mis-routed request from route[3]\n");

    }
    exit;
}



#######################################################################
## Simply logs responses
#######################################################################
onreply_route[1]{
    xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
    exit;
}



#######################################################################
## Handles failure of INVITE forwarding
#######################################################################
failure_route[1]{
    xlog("L_INFO","Failure route, trying agai\n");

    if(t_check_status("408")){
        xlog("L_INFO","Got a 408 Timeout, flagging dest as invalid\n");
        ds_mark_dst();
    }

    route(1);
}




On Sun, Nov 9, 2008 at 2:45 PM, <geoffreymina at gmail.com> wrote:
>
> Was wondering if any of the good people out there would be willing to comment on my configuration. The goal here is to simply provide inbound load balancing services from my service provider to a farm of 10 asterisk servers. I was hoping to get around this without "tm.so", but i couldn't figure it out. I am trying to build a system which will eventually support 2000 concurrent inbound sessions. Here is what I have come up with.
>
> This works in the bubble of my testing/proof of concept world, but I am sure I am missing some important aspects.
>
> Thanks for anyones time!
>



More information about the Users mailing list