[Serusers] route loop quandary

Daniel Poulsen dpoulsen at gmail.com
Wed Aug 3 18:34:33 CEST 2005

I am having a problem with calls that are parallel forked. The problem 
happens when a call comes in, gets forked using multiple aliases and one UA 
is unavailable. The question is, how do I handle the offline call leg?

I can't do if (!lookup("location")) { break; (or sl_send_reply("404") } 
because then the whole call dies since each branch of the call uses the same 

If I t_relay them both, then the fork works but I the offline leg gets 
repeatedly relayed unltil I get a 483 "Too many hops". This scenario would 
be OK [althought certainly not ideal], except it does not allow me to add a 
condition to hunt to the next number upon a failed lookup("location"). If I 
do, the online UA will ring once and the offline UA will get routed 
immediately to voicemail which picks up after just one ring.

How are other handling these problems? I think the answer lies in letting 
failure_route handle everything, but I don't know how to get that to work 
because if I don't handle the offline users in the (!lookup("location"), I 
end up with routing loops and eventualluy a 483. Anybody that has no online 
contacts whatsoever never makes it to failure_route (where the forward to VM 
is handled).

Below is my ser.cfg. I've been playing around with things like if 
(isflagset(6)) { route(x) } but I still need some way to handle the failed 
portion of the fork. Is there a way to "null route" the failed portion or 

route {

/* Registration and other logic snipped for brevity */

# Translate local address according to aliases table
xlog("L_INFO", "%ci: Preparing to look up alias for %ru\n");
if(lookup("aliases")) {
xlog("L_NOTICE", "%ci: alias lookup changed uri to %ru\n");

if (!(uri==myself)) {
xlog("L_NOTICE", "%ci: Outbound aliases %ru\n");


if ( (uri=~"^sip:411 at .*") | (uri=~"^sip:911 at .*") | 
(uri=~"^sip:011[0-9]+ at .*") | (uri=~"^sip:1[0-9]{10}@.*") ) {
route(3); # 3: PSTN with authentication

# Anything left is a local call.

xlog("L_INFO", "%ci: Preparing to look up location for %ru\n");
if (!lookup("location")) {
xlog("L_NOTICE", "%ci: no location for %ru\n");
} else {
# Had a sucessful lookup



route[4] {
# If an invitation, we want to hunt on failure

if(method == "INVITE") {
t_on_failure("1"); # first hunt

append_hf("P-hint: relay\r\n");

xlog("L_NOTICE", "%ci: r4: t_relay %ru\n");
if (!t_relay()) {
xlog("L_NOTICE", "%ci: %ru r4: Relay Failed\n");


failure_route[1] { revert_uri(); route(7); } ### Handle hunt sequences.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20050803/6f593e3a/attachment.htm>

More information about the sr-users mailing list