[OpenSIPS-Users] BYE does not work / Opensips stops working

Alberto Listas listas at b2br.net
Tue Nov 10 20:12:19 CET 2009


Hello,

I am installing the new 1.6 and getting a strange behavior.
When the call ended on one side the other side does not get disconnected,
and the log shows:

Nov 10 18:40:38 en4 /sbin/opensips[20610]: WARNING:dialog:dlg_onroute: 
unable to find dialog for BYE with route param 'a94.cd4c751'
Nov 10 18:40:39 en4 /sbin/opensips[20609]: WARNING:dialog:dlg_onroute: 
unable to find dialog for BYE with route param 'a94.cd4c751'
Nov 10 18:40:41 en4 /sbin/opensips[20611]: WARNING:dialog:dlg_onroute: 
unable to find dialog for BYE with route param 'a94.cd4c751'
Nov 10 18:40:45 en4 /sbin/opensips[20609]: WARNING:dialog:dlg_onroute: 
unable to find dialog for BYE with route param 'a94.cd4c751'


I did a ngrep and the SIP Route: shows the correct param.
Eventually the Opensips starts not to accept INVITEs or creates a very long 
setup time for INVITEs (20-40s).
I think I am doing something wrong, could someone please check my config 
below.

Thanks,
Alberto

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

debug=3
log_stderror=no
log_facility=LOG_LOCAL0

fork=yes
children=4

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

/* uncomment the next line to disable TCP (default on) */
#disable_tcp=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

/* uncomment the next line to disable the auto discovery of local aliases
   based on revers DNS on IPs (default on) */
#auto_aliases=no

/* uncomment the following lines to enable TLS support  (default off) */
#disable_tls = no
#listen = tls:your_IP:5061
#tls_verify_server = 1
#tls_verify_client = 1
#tls_require_client_certificate = 0
#tls_method = TLSv1
#tls_certificate = "/usr/local/etc/opensips/tls/user/user-cert.pem"
#tls_private_key = "/usr/local/etc/opensips/tls/user/user-privkey.pem"
#tls_ca_list = "/usr/local/etc/opensips/tls/user/user-calist.pem"


port=5060

/* 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:192.168.1.2:5060


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

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

/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri.so"
loadmodule "xlog.so"
loadmodule "acc.so"
loadmodule "aaa_radius.so"
loadmodule "auth.so"
loadmodule "auth_db.so"

#loadmodule "alias_db.so"

#loadmodule "domain.so"

#loadmodule "presence.so"
#loadmodule "presence_xml.so"

loadmodule "dialog.so"

#
# ----- nat_traversal
#**
loadmodule "nat_traversal.so"
#**
modparam("nat_traversal", "keepalive_interval", 90)
modparam("nat_traversal", "keepalive_method", "OPTIONS")
modparam("nat_traversal", "keepalive_from", "sip:keepalive at mydomain.com")


#
# --> nathelper
#**
loadmodule "nathelper.so"
#**
modparam("nathelper", "natping_interval", 60)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "received_avp", "$avp(i:801)")
modparam("nathelper", "sipping_from", "sip:pinger at mydomain.com")

#
#**
loadmodule "mediaproxy.so"
#**
#--------------- Default Values
modparam("mediaproxy", "mediaproxy_socket", 
"/var/run/mediaproxy/dispatcher.sock")
modparam("mediaproxy", "mediaproxy_timeout", 500)
modparam("mediaproxy", "signaling_ip_avp", "$avp(s:nat_ip)")
modparam("mediaproxy", "media_relay_avp", "$avp(s:media_relay)")

loadmodule "drouting.so"
loadmodule "permissions.so"

# ----- permissions params -----
modparam("permissions", "db_url", 
"mysql://opensips:opensipsrw@127.0.0.1/opensips")

loadmodule "call_control.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)


# ----- registrar params -----
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)


# ----- usrloc params -----
#modparam("usrloc", "db_mode",   0)
/* uncomment the following lines if you want to enable DB persistency
   for location entries */
modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
 "mysql://opensips:opensipsrw@localhost/opensips")
modparam("usrloc", "nat_bflag", 6)


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


# ----- acc params -----
/* what sepcial events should be accounted ? */
#modparam("acc", "early_media", 1)
#modparam("acc", "report_ack", 1)
#modparam("acc", "report_cancels", 1)
/* by default ww 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)
/* account triggers (flags) */
#modparam("acc", "failed_transaction_flag", 3)
#modparam("acc", "log_flag", 1)
#modparam("acc", "log_missed_flag", 2)
/* uncomment the following lines to enable DB accounting also */
#modparam("acc", "db_flag", 1)
#modparam("acc", "db_missed_flag", 2)
#modparam("acc", "db_url",
#       "mysql://opensips:opensipsrw@localhost/opensips")
#modparam("acc", "log_extra", 
"src_uri=$fU;callee_domain=$fd;dst_uri=$rU;caller_domain=$rd")
#modparam("acc", "db_extra", 
"src_uri=$fU;callee_domain=$fd;dst_uri=$rU;caller_domain=$rd")


# ----- radius acc parameters ------
modparam("aaa_radius", "radius_config", 
"/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "aaa_flag",        2)
modparam("acc", "aaa_missed_flag", 3)
modparam("acc", "aaa_extra",       "User-Name=$Au; \
                                       Calling-Station-Id=$avp(i:706); \
                                       Called-Station-Id=$to; \
                                       Sip-Translated-Request-URI=$ru; \
                                       Sip-RPid=$avp(s:rpid); \
                                       Source-IP=$avp(s:source_ip); \
                                       Source-Port=$avp(s:source_port); \
                                       SIP-Proxy-IP=$avp(s:sip_proxy_ip); \
                                       Canonical-URI=$avp(s:can_uri); \
                                       Billing-Party=$avp(s:billing_party); 
\
                                       Divert-Reason=$avp(s:divert_reason); 
\
                                       User-Agent=$hdr(user-agent); \
                                       Contact=$hdr(contact); \
                                       Event=$hdr(event); \
                                       ENUM-TLD=$avp(s:enum_tld)")

# ----- auth_db params -----
/* uncomment the following lines if you want to enable the DB based
   authentication */
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url",
 "mysql://opensips:opensipsrw@localhost/opensips")
modparam("auth_db", "load_credentials", "")


# ----- alias_db params -----
/* uncomment the following lines if you want to enable the DB based
   aliases */
#modparam("alias_db", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")


# ----- domain params -----
/* uncomment the following lines to enable multi-domain detection
   support */
#modparam("domain", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")
#modparam("domain", "db_mode", 1)   # Use caching


# ----- multi-module params -----
/* uncomment the following line if you want to enable multi-domain support
   in the modules (dafault off) */
#modparam("alias_db|auth_db|usrloc|uri", "use_domain", 1)


# ----- presence params -----
/* uncomment the following lines if you want to enable presence */
#modparam("presence|presence_xml", "db_url",
# "mysql://opensips:opensipsrw@localhost/opensips")
#modparam("presence_xml", "force_active", 1)
#modparam("presence", "server_address", "sip:192.168.1.2:5060")

# ----- drouting params -----
modparam("drouting", "db_url",
        "mysql://opensips:opensipsrw@localhost/opensips")
modparam("drouting", "ruri_avp", '$avp(i:33)')
modparam("drouting", "attrs_avp", '$avp(i:67)')
modparam("drouting", "use_domain", 1)
modparam("drouting", "fetch_rows", 1500)
modparam("drouting", "force_dns", 0)

# ----- callcontrol params -----
modparam("call_control", "disable", 0)
modparam("call_control", "diverter_avp_id", 805)


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


# main request routing logic

route{

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

 if (has_totag()) {
  if (loose_route()) {
   if (is_method("BYE")) {
    setflag(1); # do accounting ...
    setflag(3); # ... even if the transaction fails
   } else if (is_method("INVITE")) {
    record_route();
   }
   route(1);
  } else {
   if ( is_method("ACK") ) {
    if ( t_check_trans() ) {
     t_relay();
     exit;
    } else {
     exit;
    }
   }
   sl_send_reply("404","Not here");
  }
  exit;
 }

 #initial requests

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

 t_check_trans();

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

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


 if (is_method("PUBLISH"))
 {
  sl_send_reply("503", "Service Unavailable");
  exit;
 }

        if (is_method("MESSAGE"))
        {
                sl_send_reply("503", "Service Unavailable");
                exit;
        }

 if (is_method("REGISTER"))
 {
                # authenticate the REGISTER requests (uncomment to enable 
auth)
                if (!www_authorize("", "subscriber"))
                {
                        www_challenge("", "0");
                        exit;
                }

                if (!db_check_to())
                {
                        sl_send_reply("403","Forbidden auth ID");
                        exit;
                }

                if(!search("^Contact:[ ]*\*") && nat_uac_test("7")) {
                    setbflag(6);
                    fix_nated_register();
                    force_rport();
                };

                if (!save("location")){
                        sl_reply_error();
                exit;
                }
 }

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

 if (is_method("INVITE")) {
                setflag(2); # do accounting
                setflag(3); # ... even if the transaction fails
                $avp(i:706)=$from;
                $avp(s:sip_proxy_ip)="187.0.197.171";
                $avp(s:can_uri) = $ru;
                $avp(s:source_ip) = $si;
                $avp(s:source_port) = $sp;
  route(3);
 }


 route(1);
}


route[1] {
 # for INVITEs enable some additional helper routes
 if (is_method("INVITE")) {
  t_on_branch("2");
  t_on_reply("1");
  t_on_failure("1");
 }

 if (!t_relay()) {
  sl_reply_error();
 };
 exit;
}


route[3] {
                if(nat_uac_test("19")){
                        # record_route(";nat=yes");
                        record_route();
                } else {
                        record_route();
                };
                #record_route();
                # From an internal domain -> check the credentials and the 
FROM
                if(!check_source_address("0")){
                        if (!proxy_authorize("", "subscriber")) {
                                proxy_challenge("", "0");
                                exit;
                        } else {
                                if (!db_check_from()) {
                                        sl_send_reply("403","Forbidden auth 
ID");
                                        exit;
                                }
                        }
                        if (nat_uac_test("3")) {
                            append_hf("P-hint: 
route(3)|setflag7,forcerport,fix_contact\r\n");
                            setbflag(7);
                            force_rport();
                            fix_nated_contact();
                        };
                        consume_credentials();
                        # caller authenticated
                } else {
                        $avp(i:706)=$avp(i:707);
                        log("Request bypassed the auth.using 
allow_trusted");
                }
                if (uri=~"^sip:55[0-9][0-9][2-9][0-9]{7}@") {
                        prefix("00");
                        $avp(s:can_uri) = $ru;
                        strip(2);
                        route(4);
                        exit;
                };
                if (!lookup("location")) {
                sl_send_reply("404", "Not Found 2");
                exit;
                };
                route(1);
}


route[4] {
    # routing to the public network
    xlog("L_INFO","$si $sp $proto");
    if (!do_routing()) {
        sl_send_reply("503", "Unable to Route Destination");
        exit;
    } else {
        # prepare for lcr failover
 route(6);
        t_on_failure("2");
        route(1);
    };
}

route[6] {
    if (isbflagset(6) || isbflagset(7)) {
        append_hf("P-hint: Route[6]: mediaproxy \r\n");
        xlog("L_INFO", "Media Proxy 1");
        use_media_proxy();
    } else {
     xlog("L_INFO", "No Media Proxy 2");
     # use_media_proxy();
    };
}

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

onreply_route[1] {
        xlog("incoming reply\n");
        if (nat_uac_test("1")) {
                append_hf("P-hint: Onreply-route - fixcontact \r\n");
                fix_nated_contact();
        };

        if ((isbflagset(6) || isbflagset(7)) && 
(status=~"(180)|(183)|2[0-9][0-9]")) {
                if (search("^Content-Type:[ ]*application/sdp")) {
                        append_hf("P-hint: onreply_route|usemediaproxy 
\r\n");
                        xlog("L_INFO", "Media Proxy 3");
                        use_media_proxy();
                };
        } else {
                if (search("^Content-Type:[ ]*application/sdp")) {
                        xlog("L_INFO", "Media Proxy 4");
                        use_media_proxy();
                };
        };
        exit;
}

onreply_route[2] {
 xlog("incoming reply\n");
}


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

failure_route[2] {
        if(!use_next_gw()) {
           t_reply("503","Service not available, no more gateways");
           exit;
        }
        t_on_failure("2");
        t_relay();
} 




More information about the Users mailing list