[SR-Users] Add header on failure Route

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 30 12:50:11 CEST 2010


Hello,

On 4/30/10 11:07 AM, Alex Rendour wrote:
> Hi,
> We need to add  header on the failure route.
>
> Exemple:
> On failure  404 Not found, we need add header
>                         Reason: Q.850; cause=1
>
>
> We tried this in failure_route:
>
> if(t_check_status("404")){
>     xlog("L_ERR", "404 Not found\n");
>         append_to_reply("Reason: Q.850; cause=1\r\n");
>     xlog("L_ERR", "404 Not found apres\n");
>         exit;
>   }
>
>
> and
>
> if(t_check_status("404")){
>     xlog("L_ERR", "404 Not found\n");
>         append_hf("Reason: Q.850; cause=1\r\n");
>     xlog("L_ERR", "404 Not found apres\n");
>         exit;
>   }
>
> The twice doesn't work.
>
> Someone can help me?
is it a received 404? Or you enforce it with t_reply() from failure route?

If it is received, you cannot do much on failure_route() since you 
process the request there. If it is enforced, then append_to_reply() 
should work, just confirm is not working and I will investigate.

For received replies the solution is to use a onreply_route[x]. Before 
relaying the request, use t_on_reply("x") and then in the 
onreply_route[x] use append_hf(...)

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/
* http://twitter.com/miconda
* http://www.linkedin.com/in/danielconstantinmierla





More information about the sr-users mailing list