Re: Failover-Failback without any Load-Balancing

Henning Westerholt via sr-users <[email protected]> Mon, 6 Apr 2026 15:19:20 +0000
Newsgroups gmane.comp.voip.ser
Message-ID <AS8PR07MB722172B18FD3AADF3D058CCEBF5DA@AS8PR07MB7221.eurprd07.prod.outlook.com>
Hello,

the approach below with the failure_route and the ds_next_dst() should work for you. This is used in many installations.

If its not working, then there is some issue in your configuration. Add some more debugging for example to find out why.

Cheers,

Henning

> -----Original Message-----
> From: Kama User via sr-users <[email protected]>
> Sent: Montag, 6. April 2026 14:52
> To: [email protected]
> Cc: Kama User <[email protected]>
> Subject: [SR-Users] Re: Failover-Failback without any Load-Balancing
> 
> Thanks for the answer.
> I made the changes but unfortunately the result is the same.
> 
> /etc/kamailio/dispatcher.list:
> 1 sip:10.0.0.65:5060 0 2
> 1 sip:10.0.0.75:5060 0 1
> 
> /etc/kamailio/kamailio.cfg:
> # --- Global Parameter ---
> debug=2
> log_stderror=no
> log_facility=LOG_LOCAL0
> fork=yes
> children=4
> 
> # IP Addresses of Kamailio Server
> listen=udp:10.0.0.203:5060
> listen=tcp:10.0.0.203:5060
> 
> # Module Loading
> mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
> 
> # --- Load Modules ---
> loadmodule "tm.so"
> loadmodule "sl.so"
> loadmodule "rr.so"
> loadmodule "pv.so"
> loadmodule "textops.so"
> loadmodule "dispatcher.so"
> loadmodule "maxfwd.so"
> loadmodule "corex.so"
> loadmodule "xlog.so"
> loadmodule "ctl.so"
> 
> # --- Module Parameters ---
> modparam("tm", "fr_timer", 5000)
> modparam("tm", "fr_inv_timer", 30000)
> modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
> modparam("dispatcher", "force_dst", 1)
> modparam("dispatcher", "flags", 2)
> modparam("dispatcher", "ds_ping_method", "OPTIONS")
> modparam("dispatcher", "ds_ping_interval", 10)
> modparam("dispatcher", "ds_probing_mode", 1)
> modparam("dispatcher", "ds_probing_threshold", 2)
> modparam("dispatcher", "ds_inactive_threshold", 4)
> 
> request_route {
>     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_on_failure("FAILOVER");
>         t_relay();
>         exit;
>     }
> }
> 
> failure_route[FAILOVER] {
>     if (t_check_status("503|408") or t_branch_timeout() or
> !t_branch_replied()) {
> 	xlog("Failed Trunk $rd/$du Detected \n");
>         if (ds_next_dst()) {
>             t_on_failure("FAILOVER");
>             t_relay();
>             exit;
>         }
>     }
> }
> 
> Can I do failover-failback with this construction?
> rewritehostport("10.0.0.65:5060");
> forward();
> 
> Thanks in advance.
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- sr-
> [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!