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.sm...@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
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to