[Serusers] Implementing call fwd

Kamal.Mann at t-systems.com Kamal.Mann at t-systems.com
Wed Sep 27 12:34:03 CEST 2006


Hi All
Call fwd still not working I am attaching my ser.cfg. Please help me
out.

Regards
Kamal Mann

# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#

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

debug=4         # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no	# (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/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
#loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/textops.so"
loadmodule "/usr/lib/ser/modules/acc.so"
loadmodule "/usr/lib/ser/modules/acc_db.so"
#loadmodule "/usr/lib/ser/modules/acc_syslog.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"

# Using following modules for CALL FWD
loadmodule "/usr/lib/ser/modules/uri.so"
loadmodule "/usr/lib/ser/modules/uri_db.so"
loadmodule "/usr/lib/ser/modules/domain.so"
loadmodule "/usr/lib/ser/modules/avpops.so"
loadmodule "/usr/lib/ser/modules/permissions.so"
# Call Fwding modules END

# MSG STORE MODULE
loadmodule "/usr/lib/ser/modules/msilo.so"
# MSG STORE MODULE END

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

# -- usrloc params --

modparam("usrloc", "db_mode", 2) 

# Uncomment this if you want to use SQL database 
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
#modparam("usrloc", "use_domain", 1)
#modparam("registrar", "use_domain", 1)
#modparam("acc", "log_missed_flag", 3)
#modparam("acc_db", "db_missed_flag", 3)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
#modparam("acc", "db_flag", 1)
#modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("acc", "report_cancels", 1)
modparam("auth_db|domain|group|uri_db|usrloc",
"db_url","mysql://ser:heslo@localhost/ser")
modparam("acc", "log_fmt", "miocfsp")
#modparam("usrloc", "use_domain", 1)
modparam("auth_db", "use_domain", 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")

# For Call Fwd
modparam("avpops", "avp_url", "mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences")
# For MSG STORE
modparam("msilo", "registrar", "sip:registrar at iptel.org")
modparam("msilo", "db_url", "mysql://ser:heslo@localhost/ser")

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


# -------------------------  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(loose_route()) 
	#{	
	#	t_relay(); 
	#	break; 
	#};

	#setflag(1);

	#if(method=="INVITE") record_route();
	#if(!t_relay()) {
	#sl_reply_error();
	#break;
	#};

	# we record-route all messages -- to make sure that
	# subsequent messages will go through our proxy; that's
	# particularly good if upstream and downstream entities
	# use different transport protocol
	setflag(1);
	if (!method=="REGISTER") record_route();	

	# subsequent messages withing a dialog should take the
	# path determined by record-routing
	if (loose_route()) {
		# mark routing logic in request
		append_hf("P-hint: rr-enforced\r\n");
		t_relay();
		#route(1);
		break;
	};
	
	if (!uri==myself) {
		# mark routing logic in request
		append_hf("P-hint: outbound\r\n"); 
		route(1);
		break;
	};

	# if the request is for other domain use UsrLoc
	# (in case, it does not work, use the following command
	# with proper names and addresses in it)
	if (uri==myself) {

		if (method=="REGISTER") {

		# Uncomment this if you want to use digest
authentication
			if (!www_authorize("iptel.org", "subscriber")) {
				www_challenge("iptel.org", "0");
				break;
			};

			save("location");
			break;
		};

		lookup("aliases");
		if (!uri==myself) {
			append_hf("P-hint: outbound alias\r\n"); 
			route(1);
			break;
		};
		
		# native SIP destinations are handled using our USRLOC
DB
		#if (!lookup("location")) {
		#	sl_send_reply("404", "Not Found");
		#	break;
		#};


	 ################# MISSED CALL REPORTING########################

	if(!lookup("location")) {
	
	if((method=="INVITE" || method=="ACK") && t_newtran()) {
			t_reply("404", "Not Found");
			acc_db_request("404 missed call","
missed_calls");
			#acc_db_request("404 missed_call","acc");
			#acc_log_request("404 Not Found");
			break;
		}
		sl_send_reply("404", "Not Found");
		break;
	} else {
	
		setflag(3);
		#acc_db_request("missed_calls","acc");
		#acc_db_request("missed call", "missed_calls");
		t_relay();
		break;
	}
	
	################# MISSED CALL REPORTING END
########################
	################# Sending INVITE FOR CHECKING CALL-FWD
############
	if (method=="INVITE") 
	{
		route(3);
		break;
	};
	if(method=="REFER") 
	{
		route(6);
#		t_relay();		
	};
	################# Sending INVITE FOR CHECKING CALL-FWD END
############
	};
	append_hf("P-hint: usrloc applied\r\n"); 
	route(1);
}

route[1] 
{
	# send it out now; use stateful forwarding as it works reliably
	# even for UDP2TCP
	t_on_reply("1");
	if (!t_relay()) {
		sl_reply_error();
	};
}
route[3]
{
	# ----------------------------------------------------------
	# INVITE Message Handler
	# ----------------------------------------------------------
	
	##### CALL FWDING LOGIC ####
	if (avp_db_load("$ruri/username", "s:callfwd")) 
	{
		setflag(22);
		avp_pushto("$ruri", "s:callfwd");
		route(6);
		break;
	};
	if (avp_db_load("$ruri/username", "s:fwdbusy")) 
	{
		if (!avp_check("s:fwdbusy", "eq/$ruri/i")) 
		{
		setflag(26);
		};
	};
	if (avp_db_load("$ruri/username", "s:fwdnoanswer")) 
	{
		if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) 
		{
			setflag(27);
		};
	};
	t_on_failure("1");
#	route(4);
	route(1);
	##### CALL FWDING LOGIC END ####
}
route[6] 
{
	# ----------------------------------------------------------
	# Call Forwarding Handler
	#
	# This must be done as a route block because sl_send_reply()
cannot be
	# called from the failure_route block
	# ----------------------------------------------------------
	if (uri=~"^sip:1[0-9]{10}@") 
	{ 
		strip(1);
	};
	lookup("aliases");
	
	if (!is_uri_host_local()) 
	{ 
		if (!isflagset(22)) 
		{
			append_branch();
		};
	#	route(4);
		route(1);
		break;
	};
	
	##### PSTN PROCESSING ONLY #####
#	if (uri=~"^sip:011[0-9]*@") 
#	{
#		route(4); 
#		route(5);
#		break;
#	};
	##### PSTN PROCESSING ONLY #####
	
	if (!lookup("location")) 
	{ 
		if (uri=~"^sip:[0-9]{10}@") 
		{
	#		route(4);
			route(1);
			break;
		};
		sl_send_reply("404", "User Not Found");
	};
 #	route(4);
	route(1);
}
/*
onreply_route[1] 
{
	if ((isflagset(6) || isflagset(7)) &&
(status=~"(180)|(183)|2[0-9][0-9]")) 
	{
		if (!search("^Content-Length:[ ]*0")) 
		{
	        	 use_media_proxy();
		 };
	};
	if (client_nat_test("1")) 
	{
		fix_nated_contact();
	};
}
*/				
# CALL FWD Failure route
failure_route[1] 
{
	if (t_check_status("487")) 
	{ 
		break;
	};
	if (isflagset(26) && t_check_status("486")) 
	{ 
		if (avp_pushto("$ruri", "s:fwdbusy")) 
		{
			avp_delete("s:fwdbusy");
			resetflag(26);
			route(6);
			break;
		};
	};
	if (isflagset(27) && t_check_status("408")) 
	{ 
		if (avp_pushto("$ruri", "s:fwdnoanswer")) 
		{ 
			avp_delete("s:fwdnoanswer");
			resetflag(27);
			route(6); 
			break;
		};
	};
	#end_media_session();
}


Small part of	USR_PREFRENCES table 

+------+----------+-----------+-----------+---------------------+------+
---------------+

| uuid | username | domain    | attribute | value               | type |
modified       |

+------+----------+-----------+-----------+---------------------+------+
----------------+

|      | bhaskar  | debian    | callfwd   | kamal at iptel.org
|    0 | 20060926165852 |

|      | mann     | iptel.org | callfwd   | sip:kamal at iptel.org |    0 |
20060926150443 |

|      | prateek  | iptel.org | callfwd   | kamal at iptel.org     |    0 |
20060926170701 |

+------+----------+-----------+-----------+---------------------+------+
----------------+

 
		

-----Original Message-----
From: Steve Blair [mailto:blairs at isc.upenn.edu] 
Sent: Wednesday, September 27, 2006 2:26 PM
To: Mann, Kamal
Cc: serusers at lists.iptel.org
Subject: Re: [Serusers] Implementing call fwd



Does your config file relay REFER messages? It needs to in order to 
perform the transfer.

Kamal.Mann at t-systems.com wrote:

> Hi all
>
> Please help out
>
>
------------------------------------------------------------------------
>
> *From:* Mann, Kamal
> *Sent:* Tuesday, September 26, 2006 5:46 PM
> *To:* 'serusers at lists.iptel.org'
> *Subject:* RE: [Serusers] Implementing call fwd
>
> Hi all
>
> I am implementing Blind call forwarding with 0.9.6 SER version. But 
> with current configuration it's not working. Please help on same.
>
> I am enclosing small part of usr_prefrences table & my ser.cfg.
>
>-----------------------------------------------------------------------
-
>
>_______________________________________________
>Serusers mailing list
>Serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>  
>



More information about the sr-users mailing list