[SR-Users] 404 Not Found - If User Not Registered

Klaus Darilion klaus.mailinglists at pernau.at
Wed Dec 22 09:40:59 CET 2010



Am 22.12.2010 04:13, schrieb David J.:
>
>
> if I do lookup()
>
> What case does lookup return if entry exists but user not registered?

Ask the manual:
http://www.kamailio.org/docs/modules/3.1.x/modules_k/registrar.html#id2527514

> 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?

True. In your case you could simply use

if (!lookup("location")) {
   # for any reason the lookup failed, send to voicemail
   # e.g. forward to voicemail server at 1.2.3.4 but leave
   # the request URI unchanged:
   $du = "sip:1.2.3.4";
   t_relay();
   exit;
}
# continue with normal call routing
...


regards
klaus



More information about the sr-users mailing list