[sr-dev] Distinguish between local 408 generated after "fr_inv_timer" and "fr_timer"
Andrei Pelinescu-Onciul
andrei at iptel.org
Thu Mar 25 18:30:46 CET 2010
On Mar 25, 2010 at 13:44, I??aki Baz Castillo <ibc at aliax.net> wrote:
> Hi, this is a common issue reported by other users. Imagine I do
> failover between two gateways based on request timeout:
>
> ------------------------------
> failure_route[FAILURE_ROUTE_OUT] {
>
> # Locally generated 408 due to transaction timeout:
> if (t_local_replied("last") && $T_reply_code==408) {
> xlog("L_ERROR", "_ERROR_ $T_reply_code local replied => failover\n");
> ... do failover ...
> }
>
> }
> ------------------------------
>
>
> The above code runs when the gateway-1 doesn't reply at all so
> "fr_timer" expires (let's say 5 seconds).
>
> The problem is that such code also runs when no final response at all
> is received from gateway-1 in "fr_inv_timer" (let's say 150 seconds).
> This is, 408 is locallly generated even if the proxy has received
> provisional responses for such transaction.
Try t_any_replied()
(http://sip-router.org/docbook/sip-router/branch/master/modules/tm/tm.html#t_any_replied)
E.g.:
if (t_check_status("408"){
if (!t_any_replied()) {
t_reply(503, "Try again later, busy gws");
exit;
}
}
>
> Main problem this originates is the fact that the list of gateways
> could end without any of them giving a final reply, and when no more
> gateways are available it's common to reply 500/503 to the client.
>
> Two workarounds:
>
> a) When no more gateways are available inspect if $T_reply_code==408
> and then reply 408 rather than 500/503.
> I don't like it as if no one gateways has replied a provisional
> response in "fr_timer" then I have a *real* problem and I should reply
> 500/503.
>
> b) Enable a flag(PROVISIONAL_RECEIVED) when a provisional response is
> received and then reply 408/480 when no more gateways are available.
>
>
> Anyhow, there should be (IMHO) a in-built way to determine if the 408
> occurs after "fr_timer" or "fr_inv_timer". Do I miss something? do you
> consider this a real need?
I don't consider this a real need, however it already can be done easily :-)
Andrei
More information about the sr-dev
mailing list