Hey all,
I'm using a combination of http_async_client and rtjson to query my API and
retrieve a JSON target route set for an incoming SIP request that Kamailio
will forward to. The HTTP portion of it works great. I'm able to hit my API
and get back a JSON document.
Additionally, the rtjson parsing appears to work, because the request is
hitting my freeswitch instance. However, FS is responding with a 503 (I'm
intentionally doing this for testing), and Kamailio isn't calling my
t_on_failure route. I've pasted the relevant portion of my config below -
would be great if anyone has any insights.
tl;dr: the "REROUTE" route section below isn't being reached even when FS
responds with a 503.
Best,
Colin
route[ROUTING_REPLY] {
if $http_ok && $http_rs == 200 {
xlog("L_INFO", "$ci|log|loaded target route set from document
$http_rb\n");
rtjson_init_routes("$http_rb");
rtjson_push_routes();
xlog("L_INFO", "$ci|log|attempting to relay request towards
$du\n");
t_on_failure("REROUTE");
t_set_fr(0, 1000);
t_relay();
} else {
send_reply("480", "Temporarily Unavailable");
}
}
route[REROUTE] {
xlog("L_WARN", "$ci|log|relay to destination $du failed, checking next
route\n");
if (rtjson_next_route()) {
xlog("L_INFO", "$ci|log|additional route found, directing request to
$du\n");
t_on_failure("REROUTE");
t_set_fr(0, 1000);
t_relay();
} else {
xlog("L_WARN", "$ci|log|route list exhausted, failing
request\n");
send_reply("480", "Temporarily Unavailable");
exit;
}
}