<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Think of a branch as something that can be used and then must be
discarded, so in failure route you must append a new branch. This is
how SER keeps track of status for each.<br>
The appending of branches works a bit strange unless you know how it
works (a bit simplified): Each time you call append_branch(), a copy of
the whole message (i.e. transaction state) is copied and everything in
there is inaccessible from ser.cfg. So, you need to change the
request-uri before you append a branch. In regular route, if you want
to parallel branch, you thus need to change the request-uri to where
you want to branch, append_branch() and then change the request-uri to
another destination. When the script hits t_reply(), two INVITEs will
be sent.<br>
<br>
In failure route, the current transaction has failed and can thus not
be forwarded again. You change the request-uri and then
append_branch(). Now, as there is one failed and one new, only one will
be sent when you hit t_reply(). If you want to add more parallel
branches, you do the same: change request-uri, then append_branch().
Now you have three, where one has failed.<br>
<br>
So, after calling append_branch(), you have spun off a new branch,and
are back to the original branch, regardless of where you are in the
script.<br>
<br>
Note that on_branch route in SER 2.0 is called once for each parallel
branch, so you can do extra stuff there (but not change everything).<br>
<br>
g-)<br>
<br>
Ranganath B wrote:
<blockquote
 cite="mid:b7ee13050705170503w23ee030dyf0d97c434b878e1d@mail.gmail.com"
 type="cite">
  <div>Hi Greger,</div>
  <div>&nbsp;</div>
  <div>Thanks for replying&nbsp;and your help.&nbsp;I was able to solve the
issue. But now the call forward on no answer and busy&nbsp;are failing&nbsp;due
to&nbsp;a different reason. I get the following error message on the
/var/log/messages</div>
  <div>&nbsp;</div>
  <div>May 17 15:22:54 localhost /usr/local/sbin/ser[28719]: ERROR:
t_forward_nonack: no branched for forwarding <br>
May 17 15:22:54 localhost /usr/local/sbin/ser[28719]: ERROR: w_t_relay
(failure mode): forwarding failed&nbsp; <br>
May 17 15:22:54 localhost /usr/local/sbin/ser[28719]: ERROR:
sl_reply_error used: I'm terribly sorry, server error occurred (1/SL)</div>
  <div>&nbsp;</div>
  <div>I observed in one of the mailing list that the solution for this
problem is to change the uri to the new, then append_branch. Any
suggestions on how to do this? Please point me to the change that is
needed to solve this issue. Here's the chunk of code for your reference
from my ser.cfg:</div>
  <div>&nbsp;</div>
  <div><font size="2">
  <p># -----------------------------------------------------------------</p>
  <p># INVITE Message Handler</p>
  <p># -----------------------------------------------------------------</p>
  <p>if (client_nat_test("3")) {</p>
  <p>setflag(7);</p>
  <p>force_rport();</p>
  <p>fix_nated_contact();</p>
  <p>};</p>
  <p>if (!allow_trusted()) {</p>
  <p>if (!proxy_authorize("","subscriber")) {</p>
  <p>proxy_challenge("","0");</p>
  <p>break;</p>
  <p>} else if (!check_from()) {</p>
  <p>sl_send_reply("403", "Use From=ID");</p>
  <p>break;</p>
  <p>};</p>
  <p>consume_credentials();</p>
  <p>};</p>
  <p>if (uri=~"^sip:1[0-9]{10}@") {</p>
  <p>strip(1);</p>
  <p>};</p>
  <p>lookup("aliases");</p>
  <p>if (!is_uri_host_local()) {</p>
  <p>route(4);</p>
  <p>route(1);</p>
  <p>break;</p>
  <p>};</p>
  <p>if (uri=~"^sip:011[0-9]*@") {</p>
  <p>route(4);</p>
  <p>route(5);</p>
  <p>break;</p>
  <p>};</p>
  <p>if (avp_db_load("$ruri/username", "s:callfwd")) {</p>
  <p>setflag(22);</p>
  <p>avp_pushto("$ruri", "s:callfwd");</p>
  <p>route(6);</p>
  <p>break;</p>
  <p>};</p>
  <p>if (!lookup("location")) {</p>
  <p>if (uri=~"^sip:[0-9]{10}@") {</p>
  <p>route(4);</p>
  <p>route(5);</p>
  <p>break;</p>
  <p>};</p>
  <p>sl_send_reply("404", "User Not Found");</p>
  <p>break;</p>
  <p>};</p>
  <p>if (avp_db_load("$ruri/username", "s:fwdbusy")) {</p>
  <p>if (!avp_check("s:fwdbusy", "eq/$ruri/i")) {</p>
  <p>setflag(26);</p>
  <p>};</p>
  <p>};</p>
  <p>if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {</p>
  <p>if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {</p>
  <p>setflag(27);</p>
  <p>};</p>
  <p>};</p>
  <p>t_on_failure("1");</p>
  <p>route(4);</p>
  <p>route(1);</p>
  <p>}</p>
  <p>route[4] {</p>
  <p># -----------------------------------------------------------------</p>
  <p># NAT Traversal Section</p>
  <p># -----------------------------------------------------------------</p>
  <p>if (isflagset(6) || isflagset(7)) {</p>
  <p>if (!isflagset(8)) {</p>
  <p>setflag(8);</p>
  <p>use_media_proxy();</p>
  <p>};</p>
  <p>};</p>
  <p>}</p>
  <p>route[5] {</p>
  <p># -----------------------------------------------------------------</p>
  <p># PSTN Handler</p>
  <p># -----------------------------------------------------------------</p>
  <p>rewritehost("<a moz-do-not-send="true" href="http://192.0.2.245">192.0.2.245</a>");
# INSERT YOUR PSTN GATEWAY IP ADDRESS</p>
  <p>avp_write("i:45", "inv_timeout");</p>
  <p>t_on_failure("1");</p>
  <p>route(1);</p>
  <p>}</p>
  <p>route[6] {</p>
  <p>#
------------------------------------------------------------------------</p>
  <p># Call Forwarding Reply Route Handler</p>
  <p>#</p>
  <p># This must be done as a route block because sl_send_reply()
cannot be</p>
  <p># called from the failure_route block</p>
  <p>#
------------------------------------------------------------------------</p>
  <p>if (uri=~"^sip:1[0-9]{10}@") {</p>
  <p>strip(1);</p>
  <p>};</p>
  <p>lookup("aliases");</p>
  <p>if (!is_uri_host_local()) {</p>
  <p>if (!isflagset(22)) {</p>
  <p>append_branch();</p>
  <p>};</p>
  <p>route(4);</p>
  <p>route(1);</p>
  <p>break;</p>
  <p>};</p>
  <p>if (uri=~"^sip:011[0-9]*@") {</p>
  <p>route(4);</p>
  <p>route(5);</p>
  <p>break;</p>
  <p>};</p>
  <p>if (!lookup("location")) {</p>
  <p>if (uri=~"^sip:[0-9]{10}@") {</p>
  <p>route(4);</p>
  <p>route(1);</p>
  <p>break;</p>
  <p>};</p>
  <p>sl_send_reply("404", "User Not Found");</p>
  <p>};</p>
  <p>route(4);</p>
  <p>route(1);</p>
  <p>}</p>
  <p>onreply_route[1] {</p>
  <p>if ((isflagset(6) || isflagset(7)) &amp;&amp; </p>
  <p>(status=~"(180)|(183)|2[0-9][0-9]")) {</p>
  <p>if (!search("^Content-Length:[ ]*0")) {</p>
  <p>use_media_proxy();</p>
  <p>};</p>
  <p>};</p>
  <p>if (client_nat_test("1")) {</p>
  <p>fix_nated_contact();</p>
  <p>};</p>
  <p>}</p>
  <p>failure_route[1] {</p>
  <p>if (t_check_status("487")) {</p>
  <p>break;</p>
  <p>};</p>
  <p>if (isflagset(26) &amp;&amp; t_check_status("486")) {</p>
  <p>if (avp_pushto("$ruri", "s:fwdbusy")) {</p>
  <p>avp_delete("s:fwdbusy");</p>
  <p>resetflag(26);</p>
  <p>route(6);</p>
  <p>break;</p>
  <p>};</p>
  <p>};</p>
  <p>if (isflagset(27) &amp;&amp; t_check_status("408")) {</p>
  <p>if (avp_pushto("$ruri", "s:fwdnoanswer")) {</p>
  <p>avp_delete("s:fwdnoanswer");</p>
  <p>resetflag(27);</p>
  <p>route(6);</p>
  <p>break;</p>
  <p>};</p>
  <p>};</p>
  <p>end_media_session();</p>
  <p>}</p>
  </font></div>
  <div>Thanks again,</div>
  <div>Ranganath B</div>
  <div>&nbsp;</div>
  <div><br>
&nbsp;</div>
  <div><span class="gmail_quote">On 5/17/07, <b
 class="gmail_sendername">Greger Viken Teigre</b> &lt;<a
 moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:greger@teigre.com" target="_blank">greger@teigre.com
  </a>&gt; wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Well,
    <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="http://ser.iptel.org/" target="_blank">ser.iptel.org</a> does
not exist in dns, so that's a uri that fails. Try a working uri. <br>
g-)<br>
    <br>
------- Original message -------<br>
From: Ranganath B &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:ranganath.b@gmail.com" target="_blank">
ranganath.b@gmail.com</a>&gt;<br>
Sent: 16.5.'07,&nbsp;&nbsp;19:42<br>
    <br>
&gt; Hi,<br>
&gt;<br>
&gt; I could get the blind (unconditional) call forward option working
with the configuration that is provided in the IPTEL website but using
the same config file <br>
and the ideas provided I couldn't get the call forward on busy and no
answer working. I get the following error in the /var/log/messages:<br>
&gt;<br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: ERROR:
mk_proxy: could not resolve hostname: " <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="http://ser.iptel.org/" target="_blank">ser.iptel.org</a>"<br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: ERROR:
uri2proxy: bad host name in URI &lt; <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:sip:1234@ser.iptel.org" target="_blank">sip:1234@ser.iptel.org
    </a>&gt;<br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: ERROR:
t_forward_nonack: failure to add branches
    <br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: ERROR:
w_t_relay (failure mode): forwarding failed <br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
    <br>
&gt; May 16 15:49:52 localhost /usr/local/sbin/ser[17563]: ERROR:
sl_reply_error used: I'm terribly sorry, server error occurred (1/SL) <br>
&gt;<br>
&gt; It would be of great help if anybody provide me input on how to
resolve this issue or a configuration file using which I can get the
call forward on busy and
    <br>
no response working. BTW, I am using the ser verison: 0.9.6 . I have
populated an entry for call forward no answer/busy in the mysql
database for the table<br>
"usr_preferences". Thanks in advance.<br>
&gt;<br>
&gt; Regards,<br>
&gt; Ranganath B<br>
    <br>
  </blockquote>
  </div>
  <br>
</blockquote>
</body>
</html>