Hello,
you can implement this by using a failure_route. There is one example in the dispatcher
module configuration how to do it.
Cheers,
Henning
--
Henning Westerholt –
https://skalatan.de/blog/
Kamailio services –
https://gilawa.com<https://gilawa.com/>
From: sr-users <sr-users-bounces(a)lists.kamailio.org> On Behalf Of Unai Rodriguez
Sent: Saturday, December 3, 2022 5:16 PM
To: sr-users(a)lists.kamailio.org
Subject: [SR-Users] How to have Kamailio retry backends
Dear List,
We’re using Kamailio to load balance MRCP requests to multiple backend groups with a
configuration as follows:
# kamailio.cfg
...
...
route[DISPATCH] {
if($ua=="mrcp_backend_1") {
if(!ds_select_dst("1", "4")) {
send_reply("404", "No
destination");
exit;
}
}
if($ua=="mrcp_backend_2") {
if(!ds_select_dst("2", "4")) {
send_reply("404", "No
destination");
exit;
}
}
xlog("L_DBG", "--- SCRIPT: going to <$ru> via
<$du>\n");
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
...
...
# dispatcher.list
1 sip:mrcp01.server.int:8060;transport=tcp
1 sip:mrcp02.server.int:8060;transport=tcp
2 sip:mrcp03.server.int:8060;transport=tcp
2 sip:mrcp04.server.int:8060;transport=tcp
With this configuration, Kamailio load balances the initial SIP INVITE among the MRCP
servers. After the INVITE, the service communicates directly to the MRCP servers via SIP
(for hanging up the call), MRCPv2 (for sending speech control messages), and RTP (for
sending audio).
We would like to implement a configurable number of retries, so that if a particular
backend times out, Kamailio would retry X times to other backend(s). In short, something
equivalent to HAProxy’s
retries<https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#4-retries>,
but for Kamailio. This probably implies having Kamailio always as part of our
communication (not just load balancing the initial SIP INVITE).
I haven’t been able to find much information about this, could someone provide some
pointers?
Thank you so much
With best wishes,
Unai Rodriguez