[Kamailio-Users] How to add Retry-After header in 503 response

Alex Hermann alex at speakup.nl
Thu Nov 27 15:49:53 CET 2008


On Thursday 27 November 2008, Henning Westerholt wrote:
> On Thursday 27 November 2008, Alex Hermann wrote:
> > is there a way to add a Retry-After header to a 503 response i'm sending
> > out using t_reply?
> >
> > Use case: t_relay creates an internal 408 on timeout. From failure-route,
> > i want to pass it upstream as 503 with retry-after header. Changing the
> > reply to 503 using t_reply works, but how to add the header?
> >
> > The reply obviously doens't pass through any reply_route.
>
> Hi Alex,
>
> have you tried using append_to_reply("Retry-After: 120\n"); before the
> sl_send_reply or t_reply?

Well, as it is marked to not be usable from failure route I hadn't considered 
it.

The following fragment seems to work, so I'll assume it is safe to call 
append_to_reply from failure_route itself. Attached (tested) patch does this, 
please apply.


<failure route>
if (t_local_replied("all")) {
	route(78);
	t_reply("503", "Service Unavailable");
}


route[78] {
	append_to_reply("Retry-After: 53\r\n");
	return;
}


-- 
Met vriendelijke groet,


Alex Hermann
SpeakUp
T: 088-SPEAKUP (088-7732587)
F: 088-7732588
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allow_append_to_reply_in_failure_route.diff
Type: text/x-diff
Size: 732 bytes
Desc: not available
Url : http://lists.kamailio.org/pipermail/users/attachments/20081127/27ca2f89/attachment.diff 


More information about the Users mailing list