[Users] Call forward when no answer

Howard Tang howard615 at gmail.com
Thu May 17 06:42:35 CEST 2007


Hi All,

I have followed a tutorial and set up Asterisk as a voice mail server.

http://www.voip-info.org/wiki/view/Realtime+Integration+Of+Asterisk+With+OpenSER

It works fine when the UA is offline. Now, I want a call forwarded to the
Voice mail server when there is no answer from the UA after 60 seconds(UA is
registered on the openser).

What should I do? Below is my config (copy from the above link).


		# requests for Media server
		if(is_method("INVITE") && !has_totag() && uri=~"sip:\*9") {
			route(3);
			exit;
		}

		# mark transaction if user is in voicemail group
		if(is_method("INVITE") && !has_totag()
			&& is_user_in("Request-URI","voicemail"))
		{
			xdbg("user [$ru] has voicemail redirection enabled\n");
			# backup R-URI
			avp_write("$ruri", "i:10");
			setflag(2);
		};


		# native SIP destinations are handled using our USRLOC DB
		if (!lookup("location")) {
			if(isflagset(2)) {
				# route to Asterisk Media Server
				prefix("1");
				rewritehostport("10.10.10.11:5060");
				route(1);
			} else {
				sl_send_reply("404", "Not Found");
				exit;
			}
		};

# voicemail access
# - *98 - listen caller's voice messages, being prompted for pin
# - *981 - listen voice messages, being promted for mailbox and pin
# - *98XXXX - leave voice message to XXXX
#
route[3] {
  	# direct voicemail
	if (uri =~ "sip:\*98@" ) {
        	rewriteuser("1");
		xdbg("voicemail access\n");
	} else if (uri =~ "sip:\*981@" ) {
 		strip(4);
		rewriteuser("11");
	} else if (uri =~ "sip:\*98.+@" ) {
 		strip(3);
		prefix("1");
	} else {
		xlog("unknown media extension $rU\n");
		sl_send_reply("404", "Unknown media service");
		exit;
	}

	# route to Asterisk Media Server
	rewritehostport("10.10.10.11:5060");
	route(1);
}

failure_route[1] {
	if (t_was_cancelled()) {
		xdbg("transaction was cancelled by UAC\n");
		return;
	}
	# restore initial uri
	avp_pushto("$ruri", "i:10");
	prefix("1");
	# route to Asterisk Media Server
	rewritehostport("10.10.10.11:5060");
	resetflag(2);
	route(1);

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20070517/c446754c/attachment.htm>


More information about the sr-users mailing list