if (uri==myself) {
if (method=="REGISTER" && (!search("expires=0"))) {
xlog("L_INFO","mylog: starting to process REGISTER.Info: [$au].\n");
if (!www_authorize("", "subscriber")) {
xlog("L_INFO","mylog: REGISTER came without auth, sending challenge.\n");
www_challenge("", "0");
exit;
};
save("location");
xlog("L_INFO","mylog: save-location successful.\n");
exit;
} else if (method=="INVITE") {
xlog("L_INFO","mylog: Processing INVITE.\n");
if (!proxy_authorize("","subscriber")) {
xlog("L_INFO","mylog: INVITE came without auth, sending challenge.\n");
proxy_challenge("","0");
exit;
};
consume_credentials();
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
xlog("L_INFO","mylog: lookup-location failed, sending 404 Not Found. Method: [$rm].\n");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
}
route[1] {
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (t_relay()) {
xlog("L_INFO","mylog: Route 1 section. Method [$rm].");
} else {
sl_reply_error();
xlog("L_INFO","mylog: Route 1 section. T_Relay failed. Method [$rm].");
};
exit;
}