<span style="font-family:courier new,monospace">Hi,</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Even though when I try to use &quot;uac_replace_from( )&quot; in branch_route block I get the same error message:</span><br>
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">branch_route[2]</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">   if ( $avp(i:204) )</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">   {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">      uac_replace_from(&quot;hello&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">   }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">error message:</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Not starting openser: invalid configuration file!</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">Mar 23 09:03:00 [7542] CRITICAL:core:yyerror: parse error in config file, line 623, column 26-27: Command cannot be used in the block</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">Mar 23 09:03:00 [7542] ERROR:core:main: bad config file (1 errors)</span><br><br>PS: I am running an old release of openser 1.3.<br><br>Thanks,<br>R<br><br><br><br><br><div class="gmail_quote">
On Thu, Mar 22, 2012 at 1:23 PM, Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
On 3/22/12 6:12 PM, Alex Balashov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/22/2012 01:00 PM, Robert R wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When I am trying to modify FROM field in the &quot;failure_route&quot; block I<br>
get an error message:<br>
<br>
failure_route[1]<br>
{<br>
    ...<br>
uac_replace_from(&quot;$avp(i:204)&quot;<u></u>);<br>
    append_branch();<br>
    t_relay();<br>
}<br>
<br>
Not starting openser: invalid configuration file!<br>
Mar 22 10:51:39 [6457] CRITICAL:core:yyerror: parse error in config<br>
file, line 662, column 32-33: Command cannot be used in the block<br>
Mar 22 10:51:39 [6457] ERROR:core:main: bad config file (1 errors)<br>
</blockquote>
<br>
You can probably get around it this way:<br>
<br>
failure_route[1]<br>
{<br>
   ...<br>
<br>
   append_branch();<br>
<br>
   route(STUFF);<br>
   t_relay();<br>
}<br>
<br>
<br>
route[STUFF]<br>
{<br>
    uac_replace_from(...);<br>
}<br>
<br>
</blockquote></div>
indeed this should work -- it is no reason of not being usable in failure_route, perhaps is so from the time of development. The function itself is allowed in branch_route which is called from inside t_relay() (when t_on_branch(...) is used), therefore we can relax the restriction for failure_route, imo.<br>

<br>
One thing to take care of, if you use uac_replace_from() in request route and then in failure route, you may end in malformed format, so it is recommended to use it in branch_route, then the changes done by the function will be per each forwarded branch.<br>

<br>
Cheers,<br>
Daniel<br><font color="#888888">
<br>
-- <br>
Daniel-Constantin Mierla<br>
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany<br>
<a href="http://www.asipto.com/index.php/kamailio-advanced-training/" target="_blank">http://www.asipto.com/index.<u></u>php/kamailio-advanced-<u></u>training/</a></font><div><div></div><div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</div></div></blockquote></div><br>