Re: Failover-Failback without any Load-Balancing
Lars Jansson via sr-users <[email protected]> Thu, 9 Apr 2026 19:20:01 +0200
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <[email protected]> |
Good evening,
Here is a vital fact I failed to mention previously: For the condition
(t_branch_timeout() and !t_branch_replied()) to kick in fast when a dead
target gives no repsonse whatsoever you need to tune the fr_timer. The
condition will not be true before fr_timer has expired.
First I think you should read an old but still relevant (AFAIK) document
on transaction timers - https://sip-router.org/wiki/ref_manual/timers
Then you can either change the the vaulue in the module parameter
setting modparam("tm", "fr_timer", xxx),
or you could use t_set_fr(0, xxx); like this:
if (is_method("INVITE|REGISTER")) {
if (!ds_select_dst("1", "4")) {
sl_send_reply("503", "No servers available");
exit;
}
xlog*("Selected Reg Trunk $rd/$du \n");
t_set_fr(0, xxx);
t_on_failure("FAILOVER");
t_relay();
exit;
}
To guarantee fast failover you should set xxx to e.g. 200 - meaning in
practice that you deem the target to be down if you haven't seen a 100
Trying in 200 ms after the INVITE was sent.
You should then use 'if (t_check_status("503|408") or
(t_branch_timeout() and !t_branch_replied()))' as the condition in your
failure_route.
Please have a look at t_branch_timeout() and t_branch_replied() in the
module docs for the TM module.
Taken together as (t_branch_timeout() and !t_branch_replied()) my
interpretation is in plain language: "No response whatsoever has been
received and thus the branch must have timed out because the fr_timer
has expired."
Lars
Den 2026-04-08 kl. 17:20, skrev Kama User via sr-users:
> Hi. Thanks for the answer.
>
> I divided
> "(t_branch_timeout() and !t_branch_replied())"
> into
> "t_branch_timeout() or !t_branch_replied()"
> to get more chanses to trigger ds_next_dst.
> In this case of this
> (t_check_status("503|408") or t_branch_timeout() or !t_branch_replied())
> I believe kamailio should trigger if any of these conditions hit.
>
> I haven't tried t_branch_timeout() yet.
>
> But so far only this code worked pretty much well for me
>
> request_route {
> if (is_method("INVITE|REGISTER")){
> rewritehost("10.0.0.65");
> t_on_failure("FAILOVER");
> t_relay_to_tcp("10.0.0.65","5060");
> exit;
> }
>
> failure_route[FAILOVER] {
> rewritehost("10.0.0.75");
> t_relay_to_tcp("10.0.0.75","5060");
> exit;
> }
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!