if I do lookup()
What case does lookup return if entry exists but user not registered?
lookup("location"); switch ($retcode) { case -1: case -3: sl_send_reply("404", "Not Found"); exit; case -2: sl_send_reply("405", "Not Found"); exit; };
should I just wrap this like this:
if(registered("location")){
lookup("location"); switch ($retcode) { case -1: case -3: sl_send_reply("404", "Not Found"); exit; case -2: sl_send_reply("405", "Not Found"); exit;
} };
The purpose I ask this rather simple question is because I want to redirect to voicemail if user is not registered. In the default script we have this case;
failure_route[FAIL_ONE] { # uncomment the following lines if you want to redirect the failed # calls to a different new destination ##if (t_check_status("486|408")) { ## sethostport("192.168.2.100:5060"); ## append_branch(); ## # do not set the missed call flag again ## t_relay(); ##} }
But it seems this case is never met;
Because this code
lookup("location"); switch ($retcode) { case -1: case -3: sl_send_reply("404", "Not Found"); exit; case -2: sl_send_reply("405", "Not Found"); exit; };
Seems to send a 404 response to the UA rather than go to failure route?
Maybe I am wrong...
Any advice would be appreciated.