Hi Kamailio list,
I hope you are all well?
I am looking for some assistance on a specific error I am trying to work around.
Kamailio 5.5.3 - Ubuntu 20.04
Kemi Python script (but I think this is more default failure_route behaviour)
Dispatcher module which hunts to a group of FreeSWITCH that I have configured to send 503 responses on.
My scenario is fairly simple, I am trying to respond back to a carrier for huntable responses (503 specifically) by calling a failure route below:
def ksr_failure_manage(self, msg):
if KSR.tm.t_any_timeout()>0 :
self.ksr_send_reply_clear_rtpengine(msg, 503, "Timeout to destination")
KSR.err("Timeout to Invite for %s from IP %s" % (KSR.pv.get("$ci"),KSR.pv.get("$si")))
return 1
else:
self.ksr_send_reply_clear_rtpengine(msg, 503, "Unknown error failover to next node")
KSR.err("Failed but not timeout for %s from IP %s" % (KSR.pv.get("$ci"),KSR.pv.get("$si")))
return 1
This works and a 503 with the correct message is sent if the invite doesn't get a response after 2 seconds. (My specific test case here)
# Timers for call setup 2 minutes for any 1xx provisional response received
# If no invite response received in 2 seconds end the call as per failure route.
KSR.tm.t_set_fr(120000, 2000)
self.ksr_route_relay(msg)
KSR.tm.t_on_failure("ksr_failure_manage")
return -255
The issue is after a few more milliseconds after my initial 503 a 408 is sent. Also after the failover if the carrier tries the same Kamailio again it gets a 500 rather than a 408.
408:
500:
My steps to get around this have been to change the default tm code to 503 below, but this has not changed the default response and the above behaviour unfortunately:
# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# setting default reason code and response for general errors to allow failover.
modparam("tm", "default_code", 503)
modparam("tm", "default_reason", "Unknown reason try next node")
My question is: How can I make sure my failure route is the final response here. Or if I cannot make sure of this, how can I change the default mapped response to be a consistent SIP response (503 specifically)
Many thanks in advance as I am scratching my head on this one a bit.
John.