[OpenSER-Users] how to drop sip call when i receive ring

abo abo at artdio.com.cn
Mon Jun 2 04:35:13 CEST 2008


Dear sir:
   i am trying openser 1.2.0 version.and now i want to drop call when i got 180 or 183.this is my openser.cfg.can you help me.
    thanks a lot!
    

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

debug=9            # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes    # (cmd line: -E)

/* Uncomment these lines to enter debugging mode 
fork=no
log_stderror=yes
*/

check_via=no # (cmd. line: -v)
dns=no          # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
children=4
#fifo="/tmp/openser_fifo"

listen=192.168.1.254
alias=openser.org

# Uncomment this to prevent the blacklisting of temporary not available destinations
disable_dns_blacklist=yes


# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
# - MySQL loaded for accounting as well
loadmodule "/usr/local/lib/openser/modules/mysql.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_db.so"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/acc.so"
loadmodule "/usr/local/lib/openser/modules/avpops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"




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

# -- usrloc params --

#modparam("usrloc", "db_mode",   0)

# Uncomment this if you want to use SQL database 
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config), 
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -- acc params --
modparam("acc", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("acc", "db_flag", 7)
modparam("acc", "db_missed_flag", 8)
modparam("acc", "log_level", 3)
modparam("acc", "log_flag", 2)
modparam("acc", "log_missed_flag", 8)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "failed_transaction_flag", 1)
modparam("acc", "early_media", 1)
modparam("acc", "db_extra", "src_ip=$si;dst_user=$tU;dst_domain=$du;src_user=$hdr(User-Agent)")


# -- avpops params --
# avp aliases - define c_uri (canonical uri) as AVP ID 888 and s_ip as ID 999
avp_aliases="c_uri=i:888;s_ip=i:999"


#tm timeout for voicemail params
modparam("tm", "fr_timer", 2)
modparam("tm", "fr_inv_timer", 35)
modparam("tm", "noisy_ctimer", 1)


# -------------------------  request routing logic -------------------
# main routing logic
#Routing Script
route {
 #check for old messages: could mean a problem with the DNS entries or some other loop-causer...
 if (!mf_process_maxfwd_header("10"))
      {
   xlog("L_WARN", "WARNING: Too many hops\n");
   sl_send_reply("483", "Too many hops, forward count exceeded limit\n");
   return;
       };
  
 #check for extremely large messages; we don't need a sip dos attack
 if (msg:len >= 2048)
       {
   xlog("L_WARN", "WARNING: Message too large, >= 12048 bytes\n");
   sl_send_reply("513", "Message too large, exceeded limit\n");
   return;
         };
  
 #record everything besides registers and acks
 if(method!="REGISTER" && method!="ACK")
        {
  setflag(1);
           }; 
  
 #do not send to voicemail if BYE or CANCEL 
 #is used to end call before user pickup or timeout
 if(method=="CANCEL" || method=="BYE")
     {

    setflag(7);
    setflag(8);
      };

 #grant route if route headers already present
 if (loose_route()) 
 {  
   route(1);
   return;
 };
  
 #Always require authentication, which could result in a PSTN, ie $$$
 if (method=="REGISTER")
 {
#   if(!www_authorize("openser.org", "subscriber"))
#   {
#    www_challenge("openser.org", "0");
#    return;
#   }
#   else
#   {
#      if (!check_to()) 
#      {
# sl_send_reply("401", "Unauthorized");
# return;
#      };



    #Save into user database, used below when checking if user is available
    xlog("L_INFO", "REGISTER: User Authenticated Correctly\n");
    save("location");
    return;
#   };
 };
  
 if (method=="INVITE")
     {
    setflag(2);
    setflag(7);
    setflag(8);
    route(1);
  
 
   }
 
}

route[1]
{
#send the call outward
  if(uri=~"sip:[0-9]+ at .*")
      {
   rewritehostport("192.168.1.100:5070");
    #record_route();
    t_on_reply("1");
   # t_relay();
 

       }

 
 if (!t_relay()) 
 {
  xlog("L_WARN", "ERROR: t_relay failed");
  sl_reply_error();
 };

}

onreply_route[1] {

  xlog("----------aaaaaaaaaa-------\n");
  if (t_check_status("183")||t_check_status("180")){

   exit;
  xlog("------------bbbbbbb------- \n");
 }
}





More information about the Users mailing list