[Serusers] a question about "cancel" in forwarding scenario

zhangshuai zhangshuai at goldentek.biz
Fri Feb 10 11:18:45 CET 2006


Dear All,


I want to make use of avpops module to achieve forward on-no-reply. When ua1 calls ua2 and ua2 is off-line, or busy, or doesn't answer the phone, the invite should be forwarded to ua3 and ua3 begins ringing. 

In my tests, first, ua1 sends "cancel" when ua2 is ringing. Ua1 receives "487 Request Terminated" from SER. Second, ua1 sends "cancel" when ua3 is ringing. So, theoretically, ua1 should receive "487 Request Terminated" after "200 canceling" from SER, right? But, ua1 received "408 Request Timeout" instead. So strange. How come?

I think something is wrong with my ser.cfg. Could anyone help me about this? Thanks in advance.

Here is my ser.cfg:

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

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/avp.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/dbtext.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
#loadmodule "/usr/local/lib/ser/modules/postgres.so"
#loadmodule "/usr/local/lib/ser/modules/flatstore.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
#loadmodule "/usr/local/lib/ser/modules/auth_db.so"

loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
loadmodule "/usr/local/lib/ser/modules/group_radius.so"
loadmodule "/usr/local/lib/ser/modules/uri_radius.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", 1)

# -- 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)
modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 20)
modparam("tm", "noisy_ctimer", 1)	

modparam("auth_radius|uri_radius|group_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")

modparam("avpops","avp_url","mysql://ser:heslo@localhost/ser")
modparam("avpops","avp_table","usr_preferences")
# -------------------------  request routing logic -------------------

# main routing logic

route{
        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                break;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                break;
        };

        if (!method=="REGISTER") record_route();

        if (loose_route()) { 
                t_relay(); 
                break;
        }; 

        if (method=="INVITE") {
                lookup("location");
                #if (!lookup("location")) {
	            #       sl_send_reply("404", "Not Found");
		        #       break;
	            #};
        }

	    if (method=="REGISTER") {
		        log("REGISTER\n");
                if (!radius_www_authorize("localhost.localdomain")) {
                         www_challenge("localhost.localdomain", "0");
                         break;
                };
                save("location");
		        break;
	    };

        if (method=="INVITE") {
                if (!radius_proxy_authorize("localhost.localdomain")) {
                        proxy_challenge("localhost.localdomain", "1");
                        break;
                };
        }

	    # if we do not get a positive reply, continue at failure_route[1]
        t_on_failure("1");
	    # forward the request to all destinations in destination set now 
	    t_relay();

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

failure_route[1] {

        #when caller cancel, terminate the call
	    if (t_check_status("487")) {
		      t_reply("487", "Request Terminated");
		      break;
	    };

	    if ( ( avp_db_load("$ruri","s:redirect_on_failure")  && avp_check("redirect_on_failure","eq/i:1"))) {
		      # User need to forward
		      log(1, "User wants redirection.\n");
		      if ( ( avp_db_load("$ruri","s:redirectnumber") && !avp_check("redirectnumber","re/^$"))) {
                        log(1,"first redirect\n");
                        #avp_print();
			            attr2uri("redirect number");
                        lookup("location");
			            append_branch();
			            #t_on_failure("2");
			            t_relay();
		      }
		      else {
			            t_reply("408", "TimeOut");
			            break;
		      };
	    }
	    else {
		      t_reply("404", "Not Found");
		      break;
	    };
}





More information about the sr-users mailing list