How can handle bye event in Opensips+wesip

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How can handle bye event in Opensips+wesip

arundeking
HI all,

I am install opensips 1.5 and configure the wesip with opensips.
Every thing is working fine.

The call is working fine with using x-lite phone.
I am using voip provider for single leg call and two leg call, call is happening properly.

But the problem is that the opensips+wesip can't able to handle BYE request.

this is my opensips config file.

*********************************************************************************



# $Id: openser.cfg 1676 2007-02-21 13:16:34Z bogdan_iancu $
#
# simple quick-start config script
# Please refer to the Core CookBook at http://www.openser.org/dokuwiki/doku.php
# for a explanation of possible statements, functions and parameters.
#

# ----------- global configuration parameters ------------------------

debug=3            # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes   # (cmd line: -E)
sip_warning=yes
log_facility=LOG_LOCAL0
children=4

# Uncomment these lines to enter debugging mode

#log_stderror=yes
#



port=5080

# uncomment the following lines for TLS support
#disable_tls = 0
#listen = tls:your_IP:5061
#tls_verify_server = 1
#tls_verify_client = 1
#tls_require_client_certificate = 0
#tls_method = TLSv1
#tls_certificate = "//etc/openser/tls/user/user-cert.pem"
#tls_private_key = "//etc/openser/tls/user/user-privkey.pem"
#tls_ca_list = "//etc/openser/tls/user/user-calist.pem"

# ------------------ module loading ----------------------------------
#set module path
mpath="//lib/opensips/modules/"
# Uncomment this if you want to use SQL database

loadmodule "db_mysql.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"

loadmodule "seas.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "uri.so"
loadmodule "uri_db.so"
loadmodule "permissions.so"
loadmodule "group.so"
loadmodule "mi_fifo.so"
loadmodule "lcr.so"
loadmodule "avpops.so"
loadmodule "xlog.so"
loadmodule "dialog.so"
loadmodule "nat_traversal.so"
loadmodule "nathelper.so"
loadmodule "mi_datagram.so"
loadmodule "acc.so"
loadmodule "call_control.so"
loadmodule "siptrace.so"
# ----------------- setting module-specific parameters ---------------
/* uncomment next lines for MySQL based authentication support
   NOTE: a DB (like mysql) module must be also loaded */

loadmodule "auth.so"
loadmodule "auth_db.so"

/* uncomment next line for aliases support
   NOTE: a DB (like mysql) module must be also loaded */
#loadmodule "alias_db.so"

/* uncomment next line for multi-domain support
   NOTE: a DB (like mysql) module must be also loaded
   NOTE: be sure and enable multi-domain support in all used modules
         (see "multi-module params" section ) */
loadmodule "domain.so"

/* Loading presence module */
/*loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "presence_mwi.so"*/

/* Loading DRouting modules*/
loadmodule "drouting.so"

/* Loading mi_xmlrpc module */
loadmodule "avp_radius.so"
#loadmodule "mi_xmlrpc.so"
loadmodule "msilo.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)


# ----- rr params -----
modparam("registrar", "method_filtering", 1)
/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)


# ----- uri_db params -----
/* by default we disable the DB support in the module as we do not need it
   in this configuration */
modparam("uri_db", "use_uri_table", 0)
modparam("uri_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")


# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
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_extra", "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd;src_ip=$si")
#modparam("acc", "db_extra", "from_uri=$fu; to_uri=$tu")

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


# ----- 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://openser:openserrw@localhost/openser")


# ----- 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_db", "use_domain", 1)

# ----- presence params (Simple configuration)-----
/* 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:mobimoov.com:5080")*/

#--------------LCR params
modparam("lcr", "flags_avp", "$avp(i:712)")
modparam("lcr", "fr_inv_timer_avp", "$avp(i:704)")
modparam("lcr", "gw_uri_avp", "$avp(i:709)")
modparam("lcr", "ruri_user_avp", "$avp(i:500)")
modparam("lcr", "contact_avp", "$avp(i:711)")
modparam("^auth$|lcr", "rpid_avp", "$avp(i:302)")

#---------------avpops param
modparam("avpops", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("avpops", "avp_table", "usr_preferences")


#-----------------------------Permission params
modparam("permissions", "db_mode", 1)
modparam("permissions", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("permissions", "trusted_table", "trusted")


#-------------------------mi_datagram params--------------------------------
modparam("mi_datagram", "socket_name", "/var/run/opensips/opensips.sock")
modparam("mi_datagram", "children_count", 3)
modparam("mi_datagram", "unix_socket_mode", 0666)
modparam("mi_datagram", "unix_socket_group", "root")
modparam("mi_datagram", "unix_socket_user", "root")

#-------------------------Dialog Params---------------------------
modparam("dialog", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("dialog", "db_mode", 1)
modparam("dialog", "dlg_flag", 5)

#----------------NAT Helper Params

modparam("nathelper","natping_interval", 0)
modparam("usrloc", "nat_bflag", 3)
modparam("nathelper","received_avp", "$avp(i:42)")
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899")
modparam("nathelper", "force_socket", "udp:localhost:8899")

#--------------------drouting Params-------------------------

modparam("drouting","db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("drouting", "ruri_avp", '$avp(s:ruri)')

#---------------------Radius params------------------

modparam("acc", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_flag", 3)
modparam("acc", "radius_missed_flag", 4)
modparam("acc", "service_type", 15)
modparam("auth_radius|group_radius|avp_radius", "radius_config","/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("avp_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_extra", "User-Name=$Au; \
                               Calling-Station-Id=$from; \
                               Called-Station-Id=$to; \
                               Sip-Translated-Request-URI=$ruri; \
                               Sip-RPid=$avp(s:rpid); \
                               Source-IP=$si; \
                               Source-Port=$sp; \
                               Canonical-URI=$avp(s:can_uri); \
                               Billing-Party=$avp(s:billing_party); \
                               Divert-Reason=$avp(s:divert_reason); \
                               X-RTP-Stat=$hdr(X-RTP-Stat); \
                               Contact=$hdr(contact); \
                               Event=$hdr(event); \
                               SIP-Proxy-IP=$avp(s:sip_proxy_ip); \
                               ENUM-TLD=$avp(s:enum_tld)")

#-------------------------------SIP TRACE -------------------------------
modparam("siptrace", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam("siptrace", "trace_flag",20)
modparam("siptrace", "trace_on",1)

#---------------Call Control---------------------

modparam("call_control", "disable", 0)
#modparam("call_control", "socket_name", "/var/run/callcontrol/socket")
#modparam("call_control", "signaling_ip_avp", "$avp(s:signaling_ip)")

#--------------------seas param-----------------
modparam("seas", "listen_sockets", "mobimo.com:5090")
listen = tcp:mobimo.com:5080
listen = udp:mobimo.com:5080

#--------------------msilo params------------------------=
modparam("msilo","db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("msilo", "from_address", "sip:$rU@mobimoov.com:5080")
modparam("msilo", "expire_time", 345600)
modparam("msilo", "offline_message", "*** User $rU is offline!")
modparam("msilo","contact_hdr","Contact: sip:$rU@mobimoov.com:5080\r\n")
modparam("msilo","content_type_hdr","Content-Type: text/plain\r\n")
modparam("msilo", "sc_to", "dst_addr")

# -------------------------  request routing logic -------------------
route[15]{
        if(is_present_hf("X-WeSIP-SPIRAL")){
  #account, log, register, or whatever
               t_relay();
       }else{
               as_relay_t("app_server_1");
            }
 }/*

 route[15]{
 if(!as_relay_t("app_server_1")){
        t_reply("500","No App Server");
 }
 }

# main routing logic*/
route{
    log(1,"*******************--ENTERING--*********\n");
#    xlog("L_INFO","\n user agent header is  $ua");
    #
    # -- 1 -- Request Validation
    #
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        exit;
    };
    if (msg:len >=  2048 ) {
        sl_send_reply("513", "Message too big");
        exit;
    };
    #
    # -- 2 -- Routing Preprocessing
    #
    ## Record-route all except Register
    ## Mark packets with nat=yes
    ## This mark will be used to identify the request in the loose  
    ## route section
    if(!is_method("REGISTER")){
        if(nat_uac_test("19")){
            record_route(";nat=yes");
        } else {
            record_route();
        };
    };

    ##Loose_route packets
    if (has_totag()) {
        #sequential request withing a dialog should
        # take the path determined by record-routing
        if (loose_route()) {
#---------------------------RADIUS LOGING----------------------------------------#
                if(method=="BYE") {
    # #Account BYE transactions
                        log(1,"\nFLAG IS SET TO 2\n");
    setflag(1);
                        ## for free radius logging
                        setflag(3);
                        setflag(20);     # For sip trace;
                };

#------------------------END OF RADIUS LOGING------------------------------------#


            #Check authentication of re-invites
            if(method=="INVITE" && (!allow_trusted())) {
                if (!proxy_authorize("","subscriber")) {
                   proxy_challenge("","1");
                   exit;
                } else if (!check_from()) {
                   sl_send_reply("403", "Forbidden, use From=ID");
                   exit;
                };
            };
            if(method=="BYE" || method=="CANCEL") {
                 setflag(3);
                 log(1,"\n Is seding the bye/ Cancel \n");
                 unforce_rtp_proxy();
                 log(1,"\n Is seding the bye/ Cancel after unforce_rtp_proxy \n");
        #end_media_session();
            };
            ##Detect requests in the dialog behind NA, flag with 6
            if(nat_uac_test("19") || search("^Route:.*;nat=yes")){
                append_hf("P-hint: LR|fixcontact,setflag6\r\n");
                fix_contact();
                setbflag(6);
            };
            route(1);
        } else {
            /* uncomment the following lines if you want to enable presence */
                /* if (is_method("SUBSCRIBE") && $rd == "mobimoov.com") {
                                # in-dialog subscribe requests
                                route(16);
                                exit;
                        }
                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()) {
            unforce_rtp_proxy();
            #end_media_session();
            t_relay();
        };  
            exit;
      }
    t_check_trans();
    #
    # -- 3 -- Determine Request Target
    #
/* ## uncomment this if you want to enable presence server
        ##   and comment the next 'if' block
        ##   NOTE: uncomment also the definition of route[2] from  below
        if( is_method("PUBLISH|SUBSCRIBE"))
                        route(16);

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

    if (method=="REGISTER") {
    log(1,"--------REGISTER LOOP IN MAIN ROUTE\n");
        route(2);
    } else {
         if ((method=="INVITE" && !has_totag())) {
        # you need to call this function at the first INVITE
        $var(retcode) = call_control();
                xlog("L_INFO","\n 1. ***************** RETURN CODE=$var(retcode)");
                xlog("L_INFO","\n 2. ***************** RETURN CODE=$var(retcode)");
                xlog("L_INFO","\n 3. ***************** RETURN CODE=$var(retcode)");
               
                switch ($var(retcode)){
                       
                case -1:
                       # Not enough credit (prepaid call)
                       xlog("L_INFO", "Call control: not enough credit for prepaid call\n");
                       acc_rad_request("402");
                       sl_send_reply("402", "Not enough credit");
                       exit;
                       break;
                case -2:
                       # Locked by call in progress (prepaid call)
                       xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");
                       acc_rad_request("403");
                       sl_send_reply("403", "Call locked by another call in progress");
                       exit;
                       break;

                case 1:
                       # Call with a limit under callcontrol management (either prepaid or postpaid)
                        xlog("L_INFO", "Call control: Inside 1 for pre paid\n");
                        break;

                case 2:
                        xlog("L_INFO", "Call control: Inside 2 for post paid\n");
                       # Call with no limit
                        break;

              default:
                       # Internal error (message parsing, communication, ...)
                       xlog("L_INFO", "Call control: internal server error\n");
                       acc_rad_request("500");
                sl_send_reply("500", "Internal server error");
                       exit;
                }      
                 xlog("L_INFO", "Call control: outside switch\n");
    }
        route(3);
    };
}
route[1] {
    #
    # -- 4 -- Forward request to target
    #
    # Forward statefully
    log(1, "------------------------------------> ROUTE 1 \n");
    t_on_reply("1");
    t_on_failure("1");
    if (!t_relay()) {
        sl_reply_error();
    };
    exit;
}
route[2] {
   
   ## Register request handler
    if (is_uri_host_local()) {
        if (!www_authorize("", "subscriber")) {
            www_challenge("", "1");
            exit;
        };
        if (!check_to()) {
            sl_send_reply("403", "Forbidden");
            exit;
        };
        if(!search("^Contact:[ ]*\*") && client_nat_test("7")) {
            log(1,"-------NAT Checking\n");
            setbflag(6);
            fix_nated_register();
            force_rport();
        };
        save("location");
#------------------------------------------msilo code
        log(1, "\nREGISTER received -> dumping messages with MSILO------------------- 1\n");
        # MSILO - dumping user's offline messages
        xlog("L_INFO","\nDESTINATION PORT VALUE: $dp\n");
#----------------------------------------------------------------------------------
        xlog("L_INFO","\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FROM URI: $fu%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
                if (m_dump("$fu"))
                {
                        log(1, "\nMSILO: offline messages dumped - if they were----------------------------------- 2\n");
                }else{
                        log(1, "\nMSILO: no offline messages dumped\n");
                };
                xlog("L_INFO,", "\n Method: [$rm] From-URI: [$fu] To URI [$tu]  REply Status is : [$rs] ************************** Reply reason is: [$rr]\n");
#---------------------------------------------------------------------------------------------------------------------------------------------------

        exit;
    } else if {
     sl_send_reply("403", "Forbidden");
    };
}
route[3] {
    ## Requests handler
#------------------------------RADIUS HANDLER IN INVITE----------------------------------------#
        if (method=="INVITE") {
  # # Account INVITE packets
                log(1,"\nFLAG IS SET FOR 2 in INVITE ROUTE\n");
      setflag(1);
                ## For free radius logging
                setflag(3);
          $avp(s:can_uri) = $ru;
      # # Account Missed calls
                log(1,"\nFLAG SET FOR 3 for missed calls\n");
      setflag(2);
                ## For free Radius logging
                setflag(4);
      # Radius Extra
      $avp(s:sip_proxy_ip)="mobimoov.com";
         #       log(1,"\n SIP_PROXY_IP is $avp(s:sip_proxy_ip) \n");
                setflag(20); # For sip trace
        };


#---------------------------------END OF RADIUS LOGGING-----------------------------------------#

    if (is_from_local()){
        # From an internal domain -> check the credentials and the FROM
        if (method=="MESSAGE") {
                log(1,"\n--------------------------------------> ROUTE 3 MESSAGE Looop-----------------------\n");
                                route(17);
        };

        if(!allow_trusted()){
            if (!proxy_authorize("","subscriber")) {
                proxy_challenge("","0");
                exit;
            } else if(!check_from()) {
          sl_send_reply("403", "Forbidden, use From=ID");
          exit;
        };
        };
        if (client_nat_test("3")) {
            append_hf("P-hint: setflag7|forcerport|fix_contact\r\n");
            setbflag(7);
            force_rport();
            fix_contact();
        };
        #unconditional call forward
        if(avp_db_load("$ru/username","$avp(s:callfwd)")) {
            avp_pushto("$ru", "$avp(s:callfwd)");
            route(1);
            exit;
        }
            consume_credentials();
    #verify aliases, if found replace R-URI.
    lookup("aliases");
   
    if (is_uri_host_local()) {
        # -- Inbound to Inbound
        route(10);
    } else {
        # -- Inbound to outbound
        route(11);
    };
} else {
    #From an external domain ->do not check credentials
       #Verify aliases, if found replace R-URI.
        lookup("aliases");
            if (is_uri_host_local()) {
                #-- Outbound to inbound
                route(12);
            } else {
                # -- Outbound to outbound
                route(13);
            };
    };
}
route[4] {
                log(1,"---------------------------> Entering dynamic routing route function \n");
                $avp(i:1)=1;
                do_routing("$avp(i:1)");
                xlog("L_INFO","********************************** Request URI is $ru\n");
                log(1,"---------------------------> After dynamic routing route function \n");
                if(use_next_gw()) {
    log(1,"-------------------------> I am entering the next gateway that is in the list\n");
                   #     sl_send_reply("503", "Unable to find a gateway");
                        t_relay();
                        exit;
                };
                route(1);
/*                t_on_failure("2");
                if (!t_relay()) {
                        sl_reply_error();
                };
                exit;*/
         }

route[41] {
    # routing to the public network
/*    if (!load_gws()) {
        sl_send_reply("503", "Unable to load gateways");
   exit;
    }
        if(!next_gw()){
        sl_send_reply("503", "Unable to find a gateway");
   exit;
    }
    t_on_failure("2");
    if (!t_relay()) {
        sl_reply_error();
    };
    exit;*/
    rewritehostport("208.163.33.132");
   


    # rewritehostport("sip.voip-proxy.com");
     route(1);
}
route[6] {
    #
    # -- NAT handling --
    #
    if (isbflagset(6) || isbflagset(7)) {
        append_hf("P-hint: Route[6]: RTP proxy\r\n");
                force_rtp_proxy();
                #use_media_proxy();
    };
}
route[10] {
    #from an internal domain -> inbound
    #Native SIP destinations are handled using the location table
    #Gateway destinations are handled by regular expressions
    append_hf("P-hint: inbound->inbound \r\n");
           
/*    if (is_user_in("credentials","quota")) {
            sl_send_reply("403", "Your Quota for the Month is spent. Hence call is denied");
            exit;
    } else {*/
    log(1,"***********************I AM IN  route 10");
    if (uri=~"^sip:00[0-9]{6,20}@") {
        if (is_user_in("credentials","local")) {
      #      prefix("+1305");
 #          strip(2);
# prefix("111");
            route(6);
                 log(1,"\n*********************** I AM GOING TO ENTER ROUTE 4");
                        route(4);
            exit;
        } else {
            sl_send_reply("403", "No permissions for local calls");
            exit;
        };
    };
/*    if (uri=~"^sip:[1-9][0-9]{9,20}@") {
        if (is_user_in("credentials","ld")) {
#            strip(1);
#            prefix("+1");
            route(6);
            route(4);
            exit;
        } else {
            sl_send_reply("403", "No permissions for long distance");
            exit;
        };
    };
    if (uri=~"^sip:[1-9][0-9]{6,20}") {
        if (is_user_in("credentials","int")) {
#            strip(3);
            prefix("+");
            route(6);
            route(4);
            exit;
                    } else {
            sl_send_reply("403", "No permissions for  
                          international calls");
        };
    };*/
           
    if (!lookup("location")) {
        if (does_uri_exist()) {
            ## User not registered at this time.
            ## Use the IP Address of your e-mail server
            revert_uri();
            prefix("u");
            rewritehostport("192.168.1.149"); #Use the IP address of your voicemail server
            route(6);
       route(1);
        } else {
            sl_send_reply("404", "Not Found");
       exit;
        }  
        sl_send_reply("404", "Not Found");
        exit;
            };
    route(6);
    route(1);
#   }
}
route[11] {
     # from an internal domain -> outbound
     # Simply route the call outbound using DNS search
     append_hf("P-hint: inbound->outbound \r\n");
     route(1);
}
route[12] {
     # From an external domain -> inbound
     # Verify aliases, if found replace R-URI.
     lookup("aliases");
     if (!lookup("location")) {
          sl_send_reply("404", "Not Found");
          exit;
     };
     route(1);
}
route[13] {
     #From an external domain outbound
     #we are not accepting these calls
     append_hf("P-hint: outbound->inbound \r\n");
     sl_send_reply("403", "Forbidden");
     exit;
}
/*
route[16]
{
        if (!t_newtran())
        {
                sl_reply_error();
                exit;
        };

        if(is_method("PUBLISH"))
        {
                handle_publish();
        }
        else
        if( is_method("SUBSCRIBE"))
        {
                handle_subscribe();
        }

        exit;
}
*/
route[17] {
        $avp(i:11)=$ru;
        if(!lookup("location")) {
            #----------Storing Offline Messages----------------------------
            log(1,"\n------------------------------------------------------------------------------------------> INSIDE Location(MESSAGE) route 17 loop\n");
            if (!t_newtran())
            {
                sl_reply_error();
                exit;
            };
            log(1, "MESSAGE received -> storing using MSILO\n");
            xlog("L_INFO", "-----------------------------------------RURI-----$ru\n");
            xlog("L_INFO", "-----------------------------------------From-----$fu\n");
            xlog("L_INFO", "-----------------------------------------To-----$tu\n");
            # MSILO - storing as offline message
          #  $avp(s:req_uri)=$tu:5080;
            if (m_store("$tu"))
            {
                log(1, "MSILO: offline message stored\n");
                log(1,"MSILO: ---------------------------------------> in lookup location------------------------------- 4\n");
                if (!t_reply("202", "Accepted"))
                {
                    sl_reply_error();
                };
            }else{
                log(1, "MSILO: offline message NOT stored\n");
                if (!t_reply("503", "Service Unavailable"))
                {
                    sl_reply_error();
                };
            };
            exit; #new line added
#-------------Finished, Storing Offline Messages------------------------------------
        };
        t_on_failure("3");
        route(1);
        exit;
}

failure_route[1] {
        ##--
        ##-- If cancelled, exit.
        ##--
        if (t_was_cancelled()) {
            exit;
        };
        ##--
        ##-- If busy send to the e-mail server, prefix the "b"
        ##-- character to indicate busy.
        ##--
        if (t_check_status("486")) {
            revert_uri();
            prefix("b");
            xlog("L_ERR","Stepped into the 486 ruri=<$ru>");
            rewritehostport("192.168.1.149");
            append_branch();
            route(1);
            exit;
        };
                ##--
        ##-- If timeout (408) or unavailable temporarily (480),
        ##-- prefix the uri with the "u"character to indicate
        ##-- unanswered and send to the e-mail
        ##-- sever
        ##--
        if (t_check_status("408") || t_check_status("480")) {
           revert_uri();
           prefix("u");
           xlog("L_ERR","Stepped into the 480 ruri=<$ru>");
           rewritehostport("192.168.1.149");
           append_branch();
           route(1);
           exit;
        };
}
failure_route[2] {
    if(!next_gw()) {
        t_reply("503", "Service not available, no more gateways");
        exit;
    };
    t_on_failure("2");
    t_relay();
}

failure_route[3] {
    # forwarding failed -- check if the request was a MESSAGE
    if (!method=="MESSAGE")
    {
        exit;
    };

    log(1,"MSILO:the downstream UA doesn't support MESSAGEs\n");
    # we have changed the R-URI with the contact address, ignore it now
    if (m_store("$ou"))
    {
        log(1, "MSILO: offline message stored\n");
        log(1,"MSILO: ---------------------------------------> in failure_route 3\n");
        t_reply("202", "Accepted");
    }else{
        log(1, "MSILO: offline message NOT stored\n");
        t_reply("503", "Service Unavailable");
    };
}



onreply_route[1] {
#
#-- On-replay block routing --
#
    if (client_nat_test("1")) {
        append_hf("P-hint: Onreply-route - fixcontact \r\n");
        fix_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|useRTPproxy \r\n");
            force_rtp_proxy();
            #use_media_proxy();
        };
    };
    exit;
}

local_route {

        if ( method == "BYE")
{

                log(1,"\n ***************************************************** Internal BYE is sent to radius");

                setflag(3);

        # unforce_rtp_proxy();
       
        acc_db_request("Internally generated BYE", "acc");

                acc_rad_request("BYE");

        };

}

****************************************************************************













There is my server.conf file which i am using in  wesip



*****************************************************************************

<Server port="5005" shutdown="SHUTDOWN" debug="0">
        <Service name="Tomcat-Standalone">
      <Connector className="org.apache.catalina.connector.http.HttpConnector"
          port="8030" minProcessors="5" maxProcessors="75"
          enableLookups="true" acceptCount="10" debug="0" />
 
                <Connector className="com.voztele.sipservlet.connector.SipConnector"
          minProcessors="5" maxProcessors="75"
          enableLookups="true" acceptCount="10" debug="0"
          addresses="70.32.121.31:5080" pathName="com.voztele" protocol="udp" >
                  <ExtraProperties>
                          <Property key="com.voztele.javax.sip.SER_ADDRESS" value="mobimo.com" />
                          <Property key="com.voztele.javax.sip.SER_PORT" value="5090" />
                          <Property key="com.voztele.STATISTICS" value="false" />
                                        <Property key="javax.sip.STACK_NAME" value="app_server_1" />
                                        <Property key="javax.sip.THREAD_POOL_SIZE" value="100" />
                                        <Property key="com.voztele.javax.sip.THREAD_POOL_SIZE" value="100" />
                                        <Property key="com.voztele.javax.sip.REENTRANT_LISTENER" value="true" />
                                        <Property key="javax.sip.AUTOMATIC_DIALOG_SUPPORT" value="false" /> 
                                        <Property key="com.voztele.javax.sip.TRACE_LEVEL" value="0" /> 
                  </ExtraProperties>
          </Connector>
         
      <Engine name="Standalone" defaultHost="localhost" debug="0" className="com.voztele.sipservlet.core.ConvergedEngine">
         
                        <Mapper className="org.apache.catalina.core.StandardEngineMapper" protocol="HTTP/1.1"/>
                        <Mapper className="org.apache.catalina.core.StandardEngineMapper" protocol="HTTP/1.0"/>
          <Mapper className="com.voztele.sipservlet.core.EngineSipMapper" protocol="SIP/2.0"/>
                        <Logger className="org.apache.catalina.logger.FileLogger" timestamp="true"/>
                        <Realm className="org.apache.catalina.realm.MemoryRealm" />
         
                        <Host name="localhost" nameSip="70.32.121.31_5080" debug="0"  appBase="wesipapps" className="com.voztele.sipservlet.core.ConvergedHost">
                               
                                <Logger className="org.apache.catalina.logger.FileLogger" timestamp="true"/>
                                <Mapper className="com.voztele.sipservlet.core.SipHostMapper" protocol="SIP/2.0"/>
                                <Mapper className="org.apache.catalina.core.HttpHostMapper" protocol="HTTP/1.1"/>
                                <Mapper className="org.apache.catalina.core.HttpHostMapper" protocol="HTTP/1.0"/>
                               
              </Host>
   
    </Engine>
        </Service>
</Server>
*************************************************************************


Can any when please tell me how can i handle the Bye Event  or where i am wrong that opensips can't able to handle the bye event.

Please take this as request and Replay me asap...


Thanks in advance

Arun singh.