<br>
I am not necessarily looking for somebody to tell me how to fix my
code, more for somebody to suggest how it might be done or how they
have done it.<br>
<br>
Thoughts:<br>
<br>
1. Is there a way for one branch to check the status of another?<br>
<br>
2. Do you think it is possible with AVP to lookup from original ruri and then append_brach only if lookup suceeds? <br>
<br>
<br><div><span class="gmail_quote">On 8/3/05, <b class="gmail_sendername">Daniel Poulsen</b> <<a href="mailto:dpoulsen@gmail.com">dpoulsen@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
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?<br>
<br>
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 callid.<br>
<br>
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.<br>
<br>
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).<br>
<br>
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 something?<br>
<br>
<br>
<br>
route {<br>
<br>
/* Registration and other logic snipped for brevity */<br>
<br>
# Translate local address according to aliases table<br>
xlog("L_INFO", "%ci: Preparing to look up alias for %ru\n");<br>
if(lookup("aliases")) {<br>
xlog("L_NOTICE", "%ci: alias lookup changed uri to %ru\n");<br>
<br>
if (!(uri==myself)) {<br>
xlog("L_NOTICE", "%ci: Outbound aliases %ru\n");<br>
route(4);<br>
break;<br>
};<br>
<br>
};<br>
<br>
<br>
if ( (uri=~"^sip:411@.*") |
(uri=~"^sip:911@.*") | (uri=~"^sip:011[0-9]+@.*") |
(uri=~"^sip:1[0-9]{10}@.*") ) {<br>
route(3); # 3: PSTN with authentication<br>
break;<br>
};<br>
<br>
# Anything left is a local call.<br>
<br>
xlog("L_INFO", "%ci: Preparing to look up location for %ru\n");<br>
if (!lookup("location")) {<br>
xlog("L_NOTICE", "%ci: no location for %ru\n");<br>
setflag(5);<br>
} else {<br>
# Had a sucessful lookup<br>
setflag(6);<br>
};<br>
<br>
route(4);<br>
<br>
}<br>
<br>
<br>
<br>
route[4] {<br>
# If an invitation, we want to hunt on failure<br>
<br>
if(method == "INVITE") {<br>
t_on_failure("1"); # first hunt<br>
};<br>
<br>
append_hf("P-hint: relay\r\n");<br>
<br>
xlog("L_NOTICE", "%ci: r4: t_relay %ru\n");<br>
if (!t_relay()) {<br>
xlog("L_NOTICE", "%ci: %ru r4: Relay Failed\n");<br>
sl_reply_error();<br>
break;<br>
};<br>
<br>
}<br>
<br>
<br>
failure_route[1] { revert_uri(); route(7); } ### Handle hunt sequences.<br>
<br>
<br>
<br>
<br>
</blockquote></div><br>