[Serusers] handling failure after directing to application server

Greg Martin Greg.Martin at TELUS.COM
Thu Apr 28 00:12:34 CEST 2005


I'm trying to direct requests to registered users to another proxy which has an application server. Right now the proxy simply sends a 404 back. In that case I want to simply complete the call. What I am doing is looping until the ser has had enough. I've tried to set a flag to prevent it but the
flag is in fact never set although the logs indicate it's the same transaction. Any comments?

debug=3
fork=yes
log_stderror=no
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"

loadmodule "/usr/local/lib/ser/modules/mysql.so"
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/exec.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"

modparam("usrloc", "db_mode",   1)
modparam("rr", "enable_full_lr", 1)

route {

	# ------------------------------------------------------------------------
	# Sanity Check Section
	# ------------------------------------------------------------------------
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483", "Too Many Hops");
		break;
	};

	if (msg:len > max_len) {
		sl_send_reply("513", "Message Overflow");
		break;
	};

	xlog("L_NOTICE", "Method <%rm> r-uri <%ru>\n");
	
	# ------------------------------------------------------------------------
	# Record Route Section
	# ------------------------------------------------------------------------
	if (method != "REGISTER") {
		record_route();
	};

	# ------------------------------------------------------------------------
	# Loose Route Section
	# ------------------------------------------------------------------------
	if (loose_route()) {
		route(1);
		break;
	};

	# ------------------------------------------------------------------------
	# Call Type Processing Section
	# ------------------------------------------------------------------------
	if (uri != myself) {
		route(1);
		break;
	};

	if (uri == myself) {
		if (method == "REGISTER") {
			route(2);
			break;
		};

		if (!lookup("location")) {
			sl_send_reply("404", "User Not Found");
			break;
		};

		route(1);
	};
}

route[1] {
        # ------------------------------------------------------------------------
        # Default Message Handler
        # ------------------------------------------------------------------------
 	xlog("L_NOTICE", "route[1] *****\n");
        
    t_on_reply("1");

	if(isflagset(1))
	{
		xlog("L_NOTICE", "RELAYING.\n");
		resetflag(1);
		if (!t_relay()) {
			sl_reply_error();
			break;
		};	
	};
	
    t_on_failure("1");
	
	t_relay_to_udp("app_servers_address", "5060");
	    

}

route[2] {
	# ------------------------------------------------------------------------
	# REGISTER Message Handler
	# ------------------------------------------------------------------------
	if (!save("location")) {
		sl_reply_error();
	};
}

onreply_route[1] {
	xlog("L_NOTICE", "Reply status %rs: Reason %rr\n");
}

failure_route[1] {
		setflag(1);
		xlog("L_NOTICE", "FAILURE LOGIC.\n");
        revert_uri();
        append_branch(); 
        t_relay();
}

Greg Martin 
Technology & Operations
TELUS Communication Inc.
office: 780-493-2786 
cell: 780-718-4139




More information about the sr-users mailing list