[SR-Users] route[LOCATION] is it bug?

Paul Smith paul.smith at claritytele.com
Fri Aug 4 08:29:31 CEST 2017


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170804/073e4d73/attachment.html>


More information about the sr-users mailing list