failure_route[REG_AUTH] {
xlog("L_NOTICE","route[REG_AUTH]\n");
# Handle redirects
if ($T_reply_code == 302) {
get_redirects("*", "Redirected");
t_on_failure("REG_AUTH");
route(RELAY);
} else if ($T_reply_code == 401) {
uac_auth();
t_on_reply("REG_REPLY");
route(RELAY);
}
}
route[RELAY] {
xlog("L_NOTICE","route[RELAY] ($rm)\n");
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
if (!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
if (!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
if (!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}
xlog("L_NOTICE","t_relay()'ing ($rm)\n");
if (!t_relay()) {
sl_reply_error();
}
exit;
}