<div dir="ltr">I understood, thank you!<div>Now I did like that, hope it is right way.</div><div><div><br></div><div>        if (!lookup("location")) {</div><div>                $var(rc) = $rc;</div></div><div><br></div><div><div>                switch ($var(rc)) {</div><div>                        case -1:</div><div>                                xwarn("Contact $rU not registered($var(rc)). Forwarding call to dispatcher");</div><div>                                $rU = "00"+$rU;</div><div>                                break;</div><div>                        case -3:</div><div>                                send_reply("404", "Not Found");</div><div>                                exit;</div><div>                        case -2:</div><div>                                send_reply("405", "Method Not Allowed");</div><div>                                exit;</div><div>                }</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-04 9:29 GMT+03:00 Paul Smith <span dir="ltr"><<a href="mailto:paul.smith@claritytele.com" target="_blank">paul.smith@claritytele.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Aidar,<div>I believe $rc is the return code of the last function called (ref <a href="https://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables#rc_-_returned_code" target="_blank">https://www.kamailio.org/<wbr>wiki/cookbooks/4.4.x/<wbr>pseudovariables#rc_-_returned_<wbr>code</a>)<div><br></div><div>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.</div><div><br></div><div>Try storing $rc in a $var before calling xwarn() instead and see if it works the way you expect it to:</div><div><blockquote type="cite"><div dir="ltr"><div><div>        if (!lookup("location")) {</div><div>                $var(rc) = $rc;</div></div></div></blockquote><blockquote type="cite"><div dir="ltr"><div><span class=""><div>                xwarn("method ($rm) r-uri ($ru)\n");   ################## HERE ##########################</div><div>               </div></span><span class=""><div>                route(TOVOICEMAIL);</div><div>                t_newtran();</div><div>                switch ($var(rc)) {</div><div>                        case -1:</div><div>                        case -3:</div><div>                                send_reply("404", "Not Found");</div><div>                                exit;</div><div>                        case -2:</div><div>                                send_reply("405", "Method Not Allowed");</div><div>                                exit;</div><div>                }</div><div>        }</div></span></div></div></blockquote></div><div><div dir="ltr"><div><div><br></div></div></div></div><div>Paul Smith<br><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><blockquote class="m_7163444346860046428__pbForwardBlockQuote" type="cite" style="border:0px none"><div class="m_7163444346860046428__pbConvBody" style="margin-left:24px;margin-right:24px"><font color="#680900"><br></font><blockquote class="m_7163444346860046428__pbForwardBlockQuote" type="cite" style="border:0px none"><div class="m_7163444346860046428__pbConvBody" style="margin-left:24px;margin-right:24px"><font color="#888888"><br></font><div class="m_7163444346860046428__pbConvBody" style="margin-left:24px;margin-right:24px"><span style="color:rgb(136,136,136)"> </span><br></div></div></blockquote></div></blockquote></div>
</div>
<br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Aydar A. Kamalov</div>
</div>