route[CNAM_DIPS] {
# Check call direction. If we're outbound nothing to do here
if ($avp(direction) == "in") {
t_on_branch("CNAM_DIPS");
t_on_reply("CNAM_DIPS");
t_on_failure("CNAM_DIPS");
$avp(cnam_dip_authorized) = 0;
sql_xquery("routing", "SELECT * FROM callRoute WHERE telephoneNumber = '$var(dest_tn)'", "callRoute_cnam_query");
$avp(cnam_dip_authorized) = $xavp(callRoute_cnam_query=>cnamDipAuthorized);
append_branch("sip:
8888888888@444.44.444.44:5060;trans-type=5", "0.5");
t_load_contacts();
t_next_contacts();
t_relay();
break;
}
}
branch_route[CNAM_DIPS] {
uac_replace_from("$var(modified_from)");
}
onreply_route[CNAM_DIPS] {
if (t_check_status("380")) {
xlog("L_INFO", "INFO: Received valid reply from TNSi (on_reply_route[CNAM_DIPS])");
} else {
xlog("L_ERROR", "INFO: Received bad reply from TNSi (on_reply_route[CNAM_DIPS])");
};
drop;
}
failure_route[CNAM_DIPS] {
if (!t_next_contacts()) {
xlog("L_ERR", "ERROR: Gateway failure (failure_route[CNAM_DIPS])");
exit;
} else {
t_next_contacts();
t_relay();
};
}