[Serusers] failure route and ERROR: t_should_relay: status rewrite by UAS: stored: 408, received: 487

Alan Crosswell alan at columbia.edu
Wed Jan 28 22:42:30 CET 2004


Jim,

I've been catching up to where you have already been with respect to failure 
route and the single global fr_inv_timer.  It just doesn't work if the same SER 
is fielding invites for those having voicemail and those not.  Before I go ahead 
and add a Wait 20 to my Asterisk voicemail, I had one other idea I wanted to ask 
about:

What if I run two ser instances?  The main one checks is_user_in("Request-URI", 
"voicemail") and then punts any Invites for that user to a second ser which 
implements the fr_inv_timer, t_on_failure, etc. transfer to voicemail. 
Meanwhile all the non-voicemail subscribers (including stuff sent to our PSTN 
gateway, etc.) continues to chug along without the timer stuff happening.

Does this sound like a reasonable approach?

/a


Jim Burwell wrote:
> I've found that the whole system works better when you don't use 
> failure_route() to do "time out" style voicemail. 
> 
> I have a test setup where I just add a call to Asterisk immediately if 
> the user is registered (has location entry) with a special prefix that 
> gets matched in the * extensions.conf file, and causes * to simply wait 
> for X seconds before answering.  If the calee phone(s) is answered, SER 
> cancels the call to * and any other phones registered to the user.  If 
> no phones are answered, * answers and sends the call to voicemail.
> 
> For whatever reason, this approach seems more stable so far, and seems 
> more compatible with more phones, etc, than the failure_route approach.  
> For instance, if you have a locations entry that points a user to 
> another user, or more than one user (e.g. mainline at domain.com -> 
> receptionist at domain.com -> receptionist@<phone-IP:port>), SER seems to 
> get confused and sends a CANCEL to the voicemail system you've just 
> triggered the INVITE to in your failure_route.  When doing it the other 
> way, it doesn't seem to have this problem. 
> 
> As for mapping user names to numeric extensions in Asterisk, I wrote an 
> AGI script which does this by reverse-mapping the username to aliases in 
> the SER script.  It requires that your users have numerical extensions 
> assigned in the SER aliases database (e.g. 1234 -> joe at domain.com).  If 
> there are multiple #s mapped to the user, it just returns the lowest 
> one.  Not sure if I can give this out though, since I wrote it for a client.
> 
> - Jim
> 
> 
> Alan Crosswell wrote:
> 
>> I'm trying to do failure route to voicemail (which is working) but 
>> this error is logged:
>>
>> ERROR: t_should_relay: status rewrite by UAS: stored: 408, received: 487
>>
>> I googled this and see that this came up last in October 
>> (http://lists.iptel.org/pipermail/serusers/2003-October/002921.html) 
>> but I don't see any evidence of a solution in the thread.
>>
>> I suspect mine is the same problem as I have two UAs registered so the 
>> initial dset is two places and then the append_branch on timeout is 
>> just the voicemail uri.
>>
>> BTW, I am doing this with asterisk for the usual DTMF access reasons 
>> (altough I haven't yet figured out how to map sip:alan at columbia.edu to 
>> DTMF.  Maybe I'll have to give up and do numeric mailboxes:-(
>> I am rewriting with a prefix of "vm*u" before punting over to asterisk 
>> which has
>> exten => _vm*u.,1,Wait,1
>> exten => _vm*u.,2,Voicemail(${EXTEN:3})   
>> exten => _vm*u.,3,Goto(#,1)
>>
>> Any pointers would be appreciated.  My not-yet-complete ser.cfg is 
>> attached (not yet punting voicemail for unregistered subscribers; just 
>> registered subscribers who time out the invite).
>>
>> /a
>>
>>------------------------------------------------------------------------
>>
>>#
>># $Id: ser.cfg,v 1.21.2.1 2003/07/30 16:46:18 andrei Exp $
>>#
>># simple quick-start config script
>>#
>>
>># ----------- global configuration parameters ------------------------
>>
>>debug=2         # debug level (cmd line: -dddddddddd)
>>fork=yes
>>log_stderror=no	# (cmd line: -E)
>>#listen=128.59.39.127
>>
>>check_via=yes	# (cmd. line: -v)
>>dns=no           # (cmd. line: -r)
>>rev_dns=no      # (cmd. line: -R)
>>port=5060
>>children=4
>>fifo="/tmp/ser_fifo"
>>alias="columbia.edu"
>># ------------------ module loading ----------------------------------
>>
>># Uncomment this if you want to use SQL database
>>loadmodule "/usr/lib/ser/modules/mysql.so"
>>loadmodule "/usr/lib/ser/modules/acc.so"
>>loadmodule "/usr/lib/ser/modules/sl.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"
>>
>># 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"
>>
>>loadmodule "/usr/lib/ser/modules/exec.so"
>>
>># ----------------- setting module-specific parameters ---------------
>># -- transaction timers --
>>modparam("tm", "fr_inv_timer", 15 )
>>modparam("tm", "fr_timer", 10 )
>>
>># -- usrloc params --
>>#
>>modparam("usrloc", "db_mode", 2)
>>modparam("usrloc", "timer_interval", 10)
>>
>># -- auth params --
>>modparam("auth_db", "calculate_ha1", yes)
>>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", "log_level", 1)
>>modparam("acc", "log_flag", 1 )
>>modparam("acc", "log_missed_flag", 2)
>># -------------------------  request routing logic -------------------
>>
>># main routing logic
>>
>>route{
>>
>>        /* ********* ROUTINE CHECKS  ********************************** */
>>	# 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 > max_len ) {
>>		sl_send_reply("513", "Message too big");
>>		break;
>>	};
>>
>>	lookup("aliases");
>>
>>	# 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
>>	record_route();	
>>	
>>	# loose-route processing
>>	if (loose_route()) {
>>		t_relay();
>>		break;
>>	};
>>
>>	setflag(2);
>>
>>	# 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=~"^sip:(.+@)?columbia.edu") {
>>
>>		if (method=="REGISTER") {
>>			log(1, "REGISTER received\n");
>>			if (!www_authorize("columbia.edu", "subscriber")) {
>>				www_challenge("columbia.edu", "0");
>>				break;
>>			};
>>
>>			save("location");
>>			break;
>>		}; 
>>
>>
>>/* ********** Dial out to PSTN logic ************* */ 
>>
>>
>>                # 5 Digit dialing, interior calls
>>                if (uri=~"^si"^sip:[1347][0-9]{4}@columbia\.edu") {
>>                        rewritehostport("128.59.59.242:5060");
>>                        log(1,"5 digit expression match");
>>                        route(2);
>>                        break;
>>                };
>>
>>
>>		# 10 Digit dialing with outlide line
>>		if (uri=~"^si"^sip:931[0-9]{10}@columbia\.edu") {
>>	        	if(!(src_ip=="128.59.59.242") 
>>			& !(proxy_authorize("columbia.edu","subscriber"))) {
>>			proxy_challenge("columbia.edu", "1");
>>			break;
>>
>>		} else {
>>                        rewritehostport("128.59.59.242:5060");
>>                        log(1," 93 Outside line with 10 digit expression match");
>>                        route(2);
>>                        break;
>>		};
>>                };
>>
>>/* voicemail access */
>>		if (uri=~"^sip:\*86 at columbia\.edu" 
>>		    |uri=~"^sip:vm at columbia\.edu" 
>>		    |uri=~"^sip:voicemail at columbia\.edu") {
>>			route(3);
>>			break;
>>		};
>>
>>		# native SIP destinations are handled using our USRLOC DB
>>		if (!lookup("location")) {
>>			if (!exec_dset("/etc/ser/sipldap")) {
>>				sl_send_reply("404", "Not Found");
>>				break;
>>			} else {
>>	                        log(1," sipldap call");
>>			};
>>		}; #!lookup
>>
>>	}; 
>>
>>	if (method == "INVITE") {
>>	        t_on_failure("1");
>>	};
>>	# forward to current uri now; use stateful forwarding; that
>>	# works reliably even if we forward from TCP to UDP
>>	if (!t_relay()) {
>>		sl_reply_error();
>>	}; 
>>	
>>}
>>
>>route[2] {       
>>        log(1,"route[2]:SIP-to-PSTN call routed");
>>        if (!t_relay()) {
>>                sl_reply_error();
>>        };
>>}
>># ---- voicemail user access ----
>>route[3] {
>>	rewritehostport("127.0.0.1:5069");
>>	log(1,"voicemail access");
>>        if (!t_relay()) {
>>                sl_reply_error();
>>        };
>>}
>># ------------- handling of unregistered user ------------------
>>route[4] {
>>
>>	log(1,"route[4]: user not registered");
>>        # non-Voip -- just send "off-line"
>>        if (!(method == "INVITE" || method == "ACK" || method == "CANCEL")) {
>>                sl_send_reply("404", "Not Found");
>>                break;
>>        };
>>
>>        # not voicemail subscriber
>>#        if (!isflagset(4)) { 
>>#                sl_send_reply("404", "Not Found and no voicemail turned on");
>>#               break;
>>#       };
>>
>>        # forward to voicemail now
>>	prefix("vm*u");
>>        rewritehostport("127.0.0.1:5069");
>>        t_relay_to_udp("127.0.0.1", "5069");
>>}
>>failure_route[1] {
>>	# transfer to asterisk voicemail with uMAILBOX for unavailable.
>>	# sip:USER at columbia.edu -> sip:vm*uUSER at 127.0.0.1:5069
>>        t_on_failure("2");
>>	prefix("vm*u");
>>        rewritehostport("127.0.0.1:5069");
>>	append_branch();
>>	log(1,"redirection to voicemail\n");
>>	t_relay();
>>}
>>
>>failure_route[2] {
>>	# forwarding failed (voicemail down?)
>>	log(1,"voicemail failed\n");
>>	t_reply("500","Weasels have eaten voicemail again");
>>}
>>
>>
>>  
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Serusers mailing list
>>serusers at lists.iptel.org
>>http://lists.iptel.org/mailman/listinfo/serusers
>>  
>>
> 
> -- 
> +---------------------------------------------------------------------------+
> |         Jim Burwell - Sr. Systems/Network/Security Engineer, JSBC         |
> +---------------------------------------------------------------------------+
> | "I never let my schooling get in the way of my education." - Mark Twain   |
> | "UNIX was never designed to keep people from doing stupid things, because |
> |  that policy would also keep them from doing clever things." - Doug Gwyn  |
> | "Cool is only three letters away from Fool" - Mike Muir, Suicyco          |
> | "..Government in its best state is but a necessary evil; in its worst     |
> |  state an intolerable one.." - Thomas Paine, "Common Sense" (1776)        |
> +---------------------------------------------------------------------------+
> |   Email:  jimb at jsbc.cc                              ICQ UIN:  1695089     |
> +---------------------------------------------------------------------------+
> |  Reply problems ?  Turn off the "sign" function in email prog.  Blame MS. |
> +---------------------------------------------------------------------------+
> 




More information about the sr-users mailing list