[SR-Users] route[LOCATION] is it bug?
Aidar Kamalov
aidar.kamalov at gmail.com
Fri Aug 4 10:23:09 CEST 2017
I understood, thank you!
Now I did like that, hope it is right way.
if (!lookup("location")) {
$var(rc) = $rc;
switch ($var(rc)) {
case -1:
xwarn("Contact $rU not
registered($var(rc)). Forwarding call to dispatcher");
$rU = "00"+$rU;
break;
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
2017-08-04 9:29 GMT+03:00 Paul Smith <paul.smith at claritytele.com>:
> Hi Aidar,
> I believe $rc is the return code of the last function called (ref
> https://www.kamailio.org/wiki/cookbooks/4.4.x/
> pseudovariables#rc_-_returned_code)
>
> In your example you call xwarn() and then test $rc… so by the time you
> test $rc it is no longer the result of the lookup() function.
>
> Try storing $rc in a $var before calling xwarn() instead and see if it
> works the way you expect it to:
>
> if (!lookup("location")) {
> $var(rc) = $rc;
>
> xwarn("method ($rm) r-uri ($ru)\n"); ##################
> HERE ##########################
>
> route(TOVOICEMAIL);
> t_newtran();
> switch ($var(rc)) {
> case -1:
> case -3:
> send_reply("404", "Not Found");
> exit;
> case -2:
> send_reply("405", "Method Not Allowed");
> exit;
> }
> }
>
>
> Paul Smith
>
>
>
>
>
>
>
--
Aydar A. Kamalov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170804/06adb2b0/attachment.html>
More information about the sr-users
mailing list