On 3/22/12 6:12 PM, Alex Balashov wrote:
On 03/22/2012 01:00 PM, Robert R wrote:
When I am trying to modify FROM field in the
"failure_route" block I
get an error message:
failure_route[1]
{
...
uac_replace_from("$avp(i:204)");
append_branch();
t_relay();
}
Not starting openser: invalid configuration file!
Mar 22 10:51:39 [6457] CRITICAL:core:yyerror: parse error in config
file, line 662, column 32-33: Command cannot be used in the block
Mar 22 10:51:39 [6457] ERROR:core:main: bad config file (1 errors)
You can probably get around it this way:
failure_route[1]
{
...
append_branch();
route(STUFF);
t_relay();
}
route[STUFF]
{
uac_replace_from(...);
}
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.
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.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/