[SR-Users] No dispatcher failover
Alex Balashov
abalashov at evaristesys.com
Wed Sep 26 14:38:27 CEST 2018
Hello Gertjan,
The "ingredients" of dispatcher failover are as follows:
1. A "flags" setting that includes the value 2, which enables failover
support:
https://kamailio.org/docs/modules/5.1.x/modules/dispatcher.html#dispatcher.p.flags
2. A failure_route to actually handle your failover logic:
route[MAIN] {
...
if(!ds_select_dst("2", "8")) {
sl_send_reply("503", "Out of gateways");
exit;
}
t_on_failure("DISPATCHER_FAILOVER");
if(!t_relay())
sl_reply_error();
}
failure_route[DISPATCHER_FAILOVER] {
if(t_is_canceled())
exit;
if(!ds_next_dst()) {
send_reply("503", "Out of gateways");
exit;
}
t_on_failure("DISPATCHER_FAILOVER");
t_relay();
}
-- Alex
On Wed, Sep 26, 2018 at 02:15:22PM +0200, Gertjan Wolzak wrote:
> Hello Kamailions,
>
> I want to send traffic to an Asterisk box but when that box fails traffic should be routed to the second Asterisk box.
>
> The dispatcher params are as follows:
>
> # ----- Dispatcher params ------
>
> modparam("dispatcher", "ds_probing_mode", 1)
> modparam("dispatcher", "ds_ping_interval", 20)
> modparam("dispatcher", "ds_ping_reply_codes", "class=2;class=3;class=4")
> modparam("dispatcher", "ds_inactive_threshold", 4)
> modparam("dispatcher", "ds_ping_latency_stats", 1)
> modparam("dispatcher", "ds_probing_threshold", 1)
>
> My dispatcher.list is:
>
> #DBBS PBX
>
> # SBC's
>
> 1 sip:ip_address_sbc:5060 0 0 weight=100
>
> #PBX
>
> 2 sip:ip_pbx_01:5060 0 10 weight=100
> 2 sip:ip_pbx_02:5060 0 5 weight=100
>
> Verry simple request route:
>
> request_route {
>
> if (is_method("OPTIONS")) {
> sl_send_reply("200", "OK");
> exit;
> }
>
> #Call from SBC to PBX
> #Get gateway from dispatcher list
>
> if($si=="ip_address_sbc1" |$si=="ip_address_sbc2" )
> {
> ds_select_dst("2", "8");
> $var(new_uri) = "sip:" + $tU + "@" + $dd + ":5060";
> $ru=($var(new_uri));
> route(RELAY);
> exit;
> }
>
>
> # Call from pbx to SBC
> # Get sbc ip from dispatcher list
> ds_select_dst("1","4");
> $var(new_uri) = "sip:" + $tU + "@" + $dd + ":5060";
> $ru=($var(new_uri));
> route(RELAY);
> }
>
> When I send a call to the kamailio its routed correctly to the first pbx. But when I kill the asterisk process on the first pbx, an invite is still send by Kamailio to the first pbx.
>
> Maybe I am assuming incorrectly that when the dispatcher does not react to the ds_ping it will be set to "inactive" and not be selected by the ds_select_dst command...
>
> Or am I thinking to easy and do I need to configure some actions in the failure route?
>
> Pretty sure I'm doing something wrong, but cant see where and have not been able to find the information.
>
> Tips are appreciated.
>
> Rgds,
> Gertjan Wolzak
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
More information about the sr-users
mailing list