Hi

I have setup failover on Kamailio 5.1 using Dispatcher module as below. On a round robin algorithm, INVITEs are being sent to BOTH healthy and faulty GW.  When an INVITE is being sent to the faulty GW, a re-transmission will be sent after "t_set_fr" time to the healthy GW and calls are completed successfully.  
I was wondering if I can setup the health check correctly so the faulty IP GW can be out of round robin till the health check pass it again, i.e. no INVITE is being sent to the faulty GW as long as the health check not pass it.

Your help is greatly appreciated,
AL

# dispatcher.list
1 sip:X.X.X.X:5060 0 0
1 sip:Y.Y.Y.Y:5060 0 0

# ----- dispatcher params -----
modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list")
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "ds_ping_interval", 10)
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_ping_reply_codes", "class=2;class=3;class=4")
modparam("dispatcher", "ds_ping_interval", 5)
modparam("dispatcher", "ds_probing_threshold", 1)


# Dispatch requests
route[DISPATCH] {
   if(!ds_select_dst("1", "4")) {
      send_reply("503", "No destination");
      exit;
   }
   t_on_failure("DISPATCH_FAILOVER");
   t_set_fr(0,1000);
   route(RELAY);
   exit;
}

# Failure Route
failure_route[DISPATCH_FAILOVER]{
   if (t_is_canceled()) exit;
   if(!ds_next_dst()) {
      send_reply("503", "Out of gateways");
      exit;
   }
   t_on_failure("DISPATCH_FAILOVER");
   t_relay();
}