Too many Hops error

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Too many Hops error

Francjos
I've configured two opensips to load balance incoming calls to freeswitch servers.One of the two opensips works welle and routes calls to the destination, but another causes the error "Too many hops".
I have the same configuration file for the two opsnisps.

Any help?

Here is the configuration file:

opensips.cfg


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

#debug=3
debug=4
log_stderror=yes
log_facility=LOG_LOCAL0

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
mhomed=yes


#listen=udp:127.0.0.1:5060   # CUSTOMIZE ME
listen=udp:10.0.0.5:5060


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


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

##### DB_MYSQL module
loadmodule "db_mysql.so"
modparam("db_mysql", "exec_query_threshold", 600000)
modparam("db_mysql", "timeout_interval", 2)

#####  UAC_AUTH module: Authentication module
loadmodule "uac_auth.so"
modparam("uac_auth", "credential", "username:10.0.0.5:password")

###### UAC_REGISTRANT module: module of registration on a remote server
loadmodule "uac_registrant.so"
modparam("uac_registrant", "hash_size", 2)
modparam("uac_registrant", "timer_interval", 100)
modparam("uac_registrant", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("uac_registrant", "table_name", "registrant")
modparam("uac_registrant", "registrar_column", "registrar")
modparam("uac_registrant", "proxy_column", "proxy")
modparam("uac_registrant", "aor_column", "aor")
modparam("uac_registrant", "third_party_registrant_column", "third_party_registrant")
modparam("uac_registrant", "username_column", "username")
modparam("uac_registrant", "password_column", "password")
modparam("uac_registrant", "binding_URI_column", "binding_URI")
modparam("uac_registrant", "binding_params_column", "binding_params")
modparam("uac_registrant", "expiry_column", "expiry")
modparam("uac_registrant", "forced_socket_column", "forced_socket")

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

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

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 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)


###### Text Operations Module
loadmodule "textops.so"


#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)
modparam("uri", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")

#### REGISTRAR module
loadmodule "registrar.so"
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
modparam("registrar", "tcp_persistent_flag", 7)

#### 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")


#########AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url","mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
modparam("auth_db", "load_credentials", "")


########### Doamian module
loadmodule "domain.so"
modparam("domain", "db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("domain", "db_mode", 1)   # Use caching
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain_name")
modparam("domain", "attrs_col", "attributes")

modparam("auth_db|usrloc|uri", "use_domain", 1)

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

##### RTPPROXY module
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "udp:10.0.0.5:37000")

###### AVPs operations module
loadmodule "avpops.so"
modparam("avpops", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("avpops", "avp_table", "New_usr_preferences")
modparam("avpops", "use_domain", 1)

##### NATHELPER module
loadmodule "nathelper.so"
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "received_avp", "$avp(i:42)")
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from", "sip:opensips@10.0.0.5")

####### Load_balancer module
loadmodule "load_balancer.so"
#ping every 30 secs the failesd destinations
modparam("load_balancer", "probing_interval", 30)
modparam("load_balancer", "probing_method", "OPTIONS")
modparam("load_balancer", "db_table", "load_balancer")
# consider positive ping reply the 404
modparam("load_balancer", "probing_reply_codes", "501, 404")

modparam("load_balancer", "probing_from", "sip:opensips@10.0.0.5")
modparam("load_balancer", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")

#### UDP protocol
loadmodule "proto_udp.so"



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

# main request routing logic

route {

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

         if (nat_uac_test("19")) {
                xlog("L_INFO","[$pr:$fU@$si:$sp]: NAT Detection Test-19 Passed Now Fixing-Nat for '$rm' \n");
                if (is_method("REGISTER")) {
                        fix_nated_register();
                } else {
                        fix_nated_contact();
                }
                xlog("L_INFO","[$pr:$fU@$si:$sp]: NAT Fixed for '$rm' \n");
                setflag(5);
        };

        if (has_totag()) {
                # sequential requests within a dialog should
                # take the path determined by record-routing and obey Route indication
                if (loose_route()) {

                        if(is_method("BYE")) {
                                setflag(ACC_DO); # do accounting ...
                                setflag(ACC_FAILED); # ... even if the transaction fails
                                unforce_rtp_proxy();   ###### AJOUTE PAR MOI
                        } 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;
        }

        # CANCEL processing
        if (is_method("CANCEL"))
        {
                if (t_check_trans())
                        t_relay();
                exit;
        }

        t_check_trans();

        if ( !(is_method("REGISTER")  ) ) {
                if (from_uri==myself)
                {
                }else{
                        #if caller is not local, then called number must be local
                        if(!uri==myself){
                                send_reply("403", "Relay forbidden");
                                exit;
                        }
                }
        }

        # 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 routing
        if (!is_method("REGISTER|MESSAGE"))
                  record_route();

        # account only INVITEs
        if (is_method("INVITE")) {

                setflag(ACC_DO); # do accounting
        }


        if (!uri==myself) {
                append_hf("P-hint: outbound\r\n");
                route(relay);
        }

        # requests for my domain
        if (is_method("PUBLISH|SUBSCRIBE"))
        {
                sl_send_reply("503", "Service Unavailable");
                exit;
        }

        if (is_method("REGISTER"))
        {
                if (!save("location"))
                        sl_reply_error();

                exit;
        }

        if ($rU==NULL) {
        # request with no Username in RURI
                sl_send_reply("484","Address Incomplete");
                exit;
        }

        ### FREESWITCH

        # Do lookup with method filtering

        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Call from '$fu' to '$ru' LOOKUP in 'Location' table\n");

        if(!lookup("location", "m")){
                switch ($retcode) {
                        case -1:
                        case -3:
                                t_newtran();
                                #t_reply("404", "Not Found");
                                xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Call from '$fu' to '$ru' User Not Found - try Dialing Media-Server\n");
                                route(2);
                                route(relay);
                        case -2:
                                sl_send_reply("405", "Method Not Allowed");
                                exit;
                }
        }

        # when routing via usrloc, log the missed calls also
        #setflag(ACC_MISSED);
        #setflag(2);
        route(relay);
}


route[relay] {
        # for INVITEs enable some additional helper routes
        if (is_method("INVITE")) {
                t_on_branch("per_branch_ops");
                t_on_reply("handle_nat");
                t_on_failure("missed_call");
                if (isflagset(5)) {
                        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Engage Media-Proxy here\n");
                        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: InBound-OR-OutBound Call Check!!\n");
                        if(avp_db_query("select dst_uri from load_balancer where dst_uri like '%$dd%'")){
                        #INCOMING CALL NEEDS TO GOTO PRIVATE-IP FreeSWITCH USE - IE
                                engage_rtp_proxy("rie");

                         }else if(avp_db_query("select dst_uri from load_balancer where dst_uri='sip:$si:$sp'")){
                        #INCOMING CALL FROM PRIVATE-IP FreeSWITCH USE - EI
                                engage_rtp_proxy("rei");
                        }else{
                                engage_rtp_proxy("r");
                        }
                }
        }

        if (!t_relay()) {
                send_reply("500","Internal Error");
        };
        exit;
}


## Freeswitch
route[2] {

        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: This is Media-Server Route Use Load-balancer NOW!!\n");

         #if (!load_balance("1","calls")) {
        #        sl_send_reply("500","Service full");
        #       exit;
        #}


        if(load_balance("1", "calls", "1")){
                #dst URI points to the new destination
                xlog("Sending call to $du\n");
                t_relay();
                exit;
        }else{
                if(is_method("OPTIONS")){
                        sl_send_reply("200", "OK");
                        exit;
                }
        }
        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Selected destination Media-Server : $du\n");
}


route[REGISTRAR] {
        if(is_method("REGISTER")){
                xlog("Main route: Manage REGISTER requests: $fU");
                if(isflagset(FLI_NATS)){
                        setbflag(FLB_NATB);
                }
                if(!save("location")){
                        sl_reply_error();
                }
        }
}

branch_route[per_branch_ops] {
        xlog("new branch at $ru\n");
}


onreply_route[handle_nat] {

        xlog("incoming reply\n");
}


failure_route[missed_call] {
        if (t_was_cancelled()) {
                exit;
        }

        # uncomment the following lines if you want to block client
        # redirect based on 3xx replies.
        ##if (t_check_status("3[0-9][0-9]")) {
        ##t_reply("404","Not found");
        ##      exit;
        ##}
}
                                                                                                                                                                                 
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Johan De Clercq
What comes from the load balancer, should not be send back to the load balancer.    Add condition before you load balance.





On Thu, May 26, 2016 at 10:08 PM -0700, "Francjos" <[hidden email]> wrote:

I've configured two opensips to load balance incoming calls to freeswitch
servers.One of the two opensips works welle and routes calls to the
destination, but another causes the error "Too many hops".
I have the same configuration file for the two opsnisps.

Any help?

Here is the configuration file:

opensips.cfg


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

#debug=3
debug=4
log_stderror=yes
log_facility=LOG_LOCAL0

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
mhomed=yes


#listen=udp:127.0.0.1:5060   # CUSTOMIZE ME
listen=udp:10.0.0.5:5060


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


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

##### DB_MYSQL module
loadmodule "db_mysql.so"
modparam("db_mysql", "exec_query_threshold", 600000)
modparam("db_mysql", "timeout_interval", 2)

#####  UAC_AUTH module: Authentication module
loadmodule "uac_auth.so"
modparam("uac_auth", "credential", "username:10.0.0.5:password")

###### UAC_REGISTRANT module: module of registration on a remote server
loadmodule "uac_registrant.so"
modparam("uac_registrant", "hash_size", 2)
modparam("uac_registrant", "timer_interval", 100)
modparam("uac_registrant", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("uac_registrant", "table_name", "registrant")
modparam("uac_registrant", "registrar_column", "registrar")
modparam("uac_registrant", "proxy_column", "proxy")
modparam("uac_registrant", "aor_column", "aor")
modparam("uac_registrant", "third_party_registrant_column",
"third_party_registrant")
modparam("uac_registrant", "username_column", "username")
modparam("uac_registrant", "password_column", "password")
modparam("uac_registrant", "binding_URI_column", "binding_URI")
modparam("uac_registrant", "binding_params_column", "binding_params")
modparam("uac_registrant", "expiry_column", "expiry")
modparam("uac_registrant", "forced_socket_column", "forced_socket")

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

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

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 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)


###### Text Operations Module
loadmodule "textops.so"


#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)
modparam("uri", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")

#### REGISTRAR module
loadmodule "registrar.so"
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
modparam("registrar", "tcp_persistent_flag", 7)

#### 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")


#########AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db",
"db_url","mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
modparam("auth_db", "load_credentials", "")


########### Doamian module
loadmodule "domain.so"
modparam("domain",
"db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("domain", "db_mode", 1)   # Use caching
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain_name")
modparam("domain", "attrs_col", "attributes")

modparam("auth_db|usrloc|uri", "use_domain", 1)

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

##### RTPPROXY module
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "udp:10.0.0.5:37000")

###### AVPs operations module
loadmodule "avpops.so"
modparam("avpops", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("avpops", "avp_table", "New_usr_preferences")
modparam("avpops", "use_domain", 1)

##### NATHELPER module
loadmodule "nathelper.so"
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "received_avp", "$avp(i:42)")
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from", "sip:opensips@10.0.0.5")

####### Load_balancer module
loadmodule "load_balancer.so"
#ping every 30 secs the failesd destinations
modparam("load_balancer", "probing_interval", 30)
modparam("load_balancer", "probing_method", "OPTIONS")
modparam("load_balancer", "db_table", "load_balancer")
# consider positive ping reply the 404
modparam("load_balancer", "probing_reply_codes", "501, 404")

modparam("load_balancer", "probing_from", "sip:opensips@10.0.0.5")
modparam("load_balancer", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")

#### UDP protocol
loadmodule "proto_udp.so"



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

# main request routing logic

route {

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

         if (nat_uac_test("19")) {
                xlog("L_INFO","[$pr:$fU@$si:$sp]: NAT Detection Test-19
Passed Now Fixing-Nat for '$rm' \n");
                if (is_method("REGISTER")) {
                        fix_nated_register();
                } else {
                        fix_nated_contact();
                }
                xlog("L_INFO","[$pr:$fU@$si:$sp]: NAT Fixed for '$rm' \n");
                setflag(5);
        };

        if (has_totag()) {
                # sequential requests within a dialog should
                # take the path determined by record-routing and obey Route
indication
                if (loose_route()) {

                        if(is_method("BYE")) {
                                setflag(ACC_DO); # do accounting ...
                                setflag(ACC_FAILED); # ... even if the
transaction fails
                                unforce_rtp_proxy();   ###### AJOUTE PAR MOI
                        } 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;
        }

        # CANCEL processing
        if (is_method("CANCEL"))
        {
                if (t_check_trans())
                        t_relay();
                exit;
        }

        t_check_trans();

        if ( !(is_method("REGISTER")  ) ) {
                if (from_uri==myself)
                {
                }else{
                        #if caller is not local, then called number must be
local
                        if(!uri==myself){
                                send_reply("403", "Relay forbidden");
                                exit;
                        }
                }
        }

        # 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 routing
        if (!is_method("REGISTER|MESSAGE"))
                  record_route();

        # account only INVITEs
        if (is_method("INVITE")) {

                setflag(ACC_DO); # do accounting
        }


        if (!uri==myself) {
                append_hf("P-hint: outbound\r\n");
                route(relay);
        }

        # requests for my domain
        if (is_method("PUBLISH|SUBSCRIBE"))
        {
                sl_send_reply("503", "Service Unavailable");
                exit;
        }

        if (is_method("REGISTER"))
        {
                if (!save("location"))
                        sl_reply_error();

                exit;
        }

        if ($rU==NULL) {
        # request with no Username in RURI
                sl_send_reply("484","Address Incomplete");
                exit;
        }

        ### FREESWITCH

        # Do lookup with method filtering

        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Call from '$fu' to '$ru' LOOKUP
in 'Location' table\n");

        if(!lookup("location", "m")){
                switch ($retcode) {
                        case -1:
                        case -3:
                                t_newtran();
                                #t_reply("404", "Not Found");
                                xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Call
from '$fu' to '$ru' User Not Found - try Dialing Media-Server\n");
                                route(2);
                                route(relay);
                        case -2:
                                sl_send_reply("405", "Method Not Allowed");
                                exit;
                }
        }

        # when routing via usrloc, log the missed calls also
        #setflag(ACC_MISSED);
        #setflag(2);
        route(relay);
}


route[relay] {
        # for INVITEs enable some additional helper routes
        if (is_method("INVITE")) {
                t_on_branch("per_branch_ops");
                t_on_reply("handle_nat");
                t_on_failure("missed_call");
                if (isflagset(5)) {
                        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Engage
Media-Proxy here\n");
                        xlog("L_NOTICE","[$pr:$fU@$si:$sp]:
InBound-OR-OutBound Call Check!!\n");
                        if(avp_db_query("select dst_uri from load_balancer
where dst_uri like '%$dd%'")){
                        #INCOMING CALL NEEDS TO GOTO PRIVATE-IP FreeSWITCH
USE - IE
                                engage_rtp_proxy("rie");

                         }else if(avp_db_query("select dst_uri from
load_balancer where dst_uri='sip:$si:$sp'")){
                        #INCOMING CALL FROM PRIVATE-IP FreeSWITCH USE - EI
                                engage_rtp_proxy("rei");
                        }else{
                                engage_rtp_proxy("r");
                        }
                }
        }

        if (!t_relay()) {
                send_reply("500","Internal Error");
        };
        exit;
}


## Freeswitch
route[2] {

        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: This is Media-Server Route Use
Load-balancer NOW!!\n");

         #if (!load_balance("1","calls")) {
        #        sl_send_reply("500","Service full");
        #       exit;
        #}


        if(load_balance("1", "calls", "1")){
                #dst URI points to the new destination
                xlog("Sending call to $du\n");
                t_relay();
                exit;
        }else{
                if(is_method("OPTIONS")){
                        sl_send_reply("200", "OK");
                        exit;
                }
        }
        xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Selected destination
Media-Server : $du\n");
}


route[REGISTRAR] {
        if(is_method("REGISTER")){
                xlog("Main route: Manage REGISTER requests: $fU");
                if(isflagset(FLI_NATS)){
                        setbflag(FLB_NATB);
                }
                if(!save("location")){
                        sl_reply_error();
                }
        }
}

branch_route[per_branch_ops] {
        xlog("new branch at $ru\n");
}


onreply_route[handle_nat] {

        xlog("incoming reply\n");
}


failure_route[missed_call] {
        if (t_was_cancelled()) {
                exit;
        }

        # uncomment the following lines if you want to block client
        # redirect based on 3xx replies.
        ##if (t_check_status("3[0-9][0-9]")) {
        ##t_reply("404","Not found");
        ##      exit;
        ##}
}
                                                                                                                                                                                 



--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Too-many-Hops-error-tp7603151.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Francjos
Thank you Johan,

In fact, i have this scenario:

1) i have to do load balancing
2) i have to verify opensips servers using sipsak. sipsak is used to moniter and verify the state of opensips servers.

So, how can i perform the two actions without generating errors?
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Johan De Clercq
1_ in loadbalancing module there is a function :

lb_is_destination(ip,port[,group[,active]])


this one should be used to check if the invite is not coming back from the servers on which you loadbalance.



2_ Monitoring state of servers is easy : just check fi they respond to options.


br,


2016-05-28 12:15 GMT+02:00 Francjos <[hidden email]>:
Thank you Johan,

In fact, i have this scenario:

1) i have to do load balancing
2) i have to verify opensips servers using sipsak. sipsak is used to moniter
and verify the state of opensips servers.

So, how can i perform the two actions without generating errors?



--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Too-many-Hops-error-tp7603151p7603171.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Francjos
Hello,

I really failed to use lb_is_destination (.....) function.
In fact, when i do this:

if(!load_balance("1", "calls", "1")){
sl_send_reply("500", "Service full");
exit;
}
without any other condiiton before load balancing, it success on the first server, but it failed on the second server saying "Service Full". I think this error is caused by the sipsak i'm using to send OPTIONS.

I dont understand why it is ok on one server and fails on the other?
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Johan De Clercq
You need to configure the number of sessions per server.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Francjos
Sent: Friday, June 3, 2016 1:51 PM
To: [hidden email]
Subject: Re: [OpenSIPS-Users] Too many Hops error

Hello,

I really failed to use lb_is_destination (.....) function.
In fact, when i do this:

if(!load_balance("1", "calls", "1")){
sl_send_reply("500", "Service full");
exit;
}
without any other condiiton before load balancing, it success on the first
server, but it failed on the second server saying "Service Full". I think
this error is caused by the sipsak i'm using to send OPTIONS.

I dont understand why it is ok on one server and fails on the other?




--
View this message in context:
http://opensips-open-sip-server.1449251.n2.nabble.com/Too-many-Hops-error-tp
7603151p7603300.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Francjos
Hello,

Yes I configure up to 100 sessions per server, but i still have the same error on the second server.
I'm gonna explain the scenario once again, what i'm trying to do is to put in place redundancy with Opensips servers and do load balancing.

I'm using sipsak to send OPTIONS to Opensips servers and load_balancer module to do load balancing.
And i think that the error "service fuul" occurs when OPTIONS are sent, because Opensips is supposed to sent OPTIONS to FeeSwitch servers only.

So how can i tell Opensips server to sent OPTIONS to the other Opensips server without generating any error?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Too many Hops error

Bogdan-Andrei Iancu-2
Hi,

Keep in mind you must call LB function only for the initial INVITE
requests and not for anything else.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 04.06.2016 12:21, Francjos wrote:

> Hello,
>
> Yes I configure up to 100 sessions per server, but i still have the same
> error on the second server.
> I'm gonna explain the scenario once again, what i'm trying to do is to put
> in place redundancy with Opensips servers and do load balancing.
>
> I'm using sipsak to send OPTIONS to Opensips servers and load_balancer
> module to do load balancing.
> And i think that the error "service fuul" occurs when OPTIONS are sent,
> because Opensips is supposed to sent OPTIONS to FeeSwitch servers only.
>
> So how can i tell Opensips server to sent OPTIONS to the other Opensips
> server without generating any error?
>
> Thanks.
>
>
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Too-many-Hops-error-tp7603151p7603314.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users