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;
}
}