<div dir="ltr">standby, i have the debug mode spitting out tons of logs now. <div><br></div><div>time for me to review. </div><div><br></div><div>will let you know if i need help.</div><div><br></div><div>thanks,</div><div><br></div><div>karthik</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan <span dir="ltr"><<a href="mailto:ksriniva2002@gmail.com" target="_blank">ksriniva2002@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Unfortunately same result as before:<div><br></div><div><div> $var(myself) = 0;</div><div> if (uri =~ "<regex string to match>" || uri == myself){</div><div> $var(myself) = 1;</div><div> xlog("L_INFO", "[$ci] in uri == myself check: var myself = $var(myself)");</div><div> }</div><div><br></div><div> if (uri =~ "<regex string to match>" || is_myself("$ru")){</div><div> $var(myself) = 1;</div><div> xlog("L_INFO", "[$ci] in is_myself check: var myself = $var(myself)");</div><div> }</div></div><div><br></div><div>The only log that prints out is the one that says 'in is_myself check ...'(the second if statement.)</div><div><br></div><div>I have verified that if there's a regular expression match then both log writes print. Regular expression match happens when a SIP REGISTER request comes across the pipe.</div><div><br></div><div>Something odd is going on with the computation of
<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">uri == myself vs is_myself("$ru").</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>Is there a way i can inspect what myself and uri have in them? </div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Karthik</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>things are different that one may expect from evaluation of an
expression compared with other established scripting/programming
languages. One thing to be sure you are aware of are the return
code evaluation:</p>
<p> -
<a class="m_-3440266912605384131m_1364274761674189114moz-txt-link-freetext" href="https://www.kamailio.org/wiki/tutorials/faq/main#how_is_the_function_return_cod" target="_blank">https://www.kamailio.org/wiki/<wbr>tutorials/faq/main#how_is_the_<wbr>function_return_cod</a></p>
<p>To be sure of proper behaviour, you should do:</p>
<p>if(uri =~ "<regex string to match>" || uri == myself) {</p>
<p>$var(myself) =1;</p>
<p>} else {</p>
<p>$var(myself) = 0;</p>
<p>}</p>
<p>Same with is_myself("$ru") instead of uri == myself.</p>
<p>Try and see if you get different values for $var(myself).<br>
</p>
Cheers,<br>
Daniel<br>
<br>
<div class="m_-3440266912605384131m_1364274761674189114moz-cite-prefix">On 19.07.18 19:09, Karthik Srinivasan
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Yes, they are used at the very same place. here is
a code snippet of where i added it for testing purposes:
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div>route[INIT_VARS] {</div>
</div>
<div><br>
</div>
<div>$var(myself) = uri =~ "<regex string to match>" ||
uri == myself;<br>
</div>
<div>//if i print $var(myself) it prints 0 </div>
<div>$var(myself) = uri =~ "<regex string to match>" ||
is_myself("$ru");<br>
</div>
<div>//if i print $var(myself) it prints 1 </div>
<div><br>
</div>
<div>// in both cases above the regex part isn't supposed to
match and hence correctly returns false.</div>
<div>...</div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
<div>route{</div>
<div><br>
</div>
<div> route(INIT_VARS);</div>
<div><br>
</div>
</div>
<div>...</div>
<div>}</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Karthik</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jul 19, 2018 at 11:46 AM,
Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
<br>
On 19.07.18 18:32, Karthik Srinivasan wrote:<br>
> Hello,<br>
><br>
> Can someone explain to me why statement A returns True
and statement B<br>
> returns False.<br>
><br>
> Statement A:<br>
> is_myself("$ru")<br>
><br>
> Statement B:<br>
> uri == myself<br>
><br>
><br>
> Isn't uri and $ru referencing the same data? <br>
><br>
> With my current config i am expecting the is_myself to
return True; i<br>
> was expecting the same for Statement B but
unfortunately it is<br>
> returning False.<br>
><br>
they are supposed to be the same in this case.<br>
<br>
Are they used at the same place in config? Note that $ru can
be changed<br>
by different functions such as those from registrar,
dispatcher, lcr, ...<br>
<br>
Cheers,<br>
Daniel<span class="HOEnZb"><font color="#888888"><span class="m_-3440266912605384131HOEnZb"><font color="#888888"><br>
<span class="m_-3440266912605384131m_1364274761674189114HOEnZb"><font color="#888888"><br>
-- <br>
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" rel="noreferrer" target="_blank">www.asipto.com</a><br>
<a href="http://www.twitter.com/miconda" rel="noreferrer" target="_blank">www.twitter.com/miconda</a> --
<a href="http://www.linkedin.com/in/miconda" rel="noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
Kamailio World Conference -- <a href="http://www.kamailioworld.com" rel="noreferrer" target="_blank">www.kamailioworld.com</a><br>
<br>
</font></span></font></span></font></span></blockquote><span class="HOEnZb"><font color="#888888"><span class="m_-3440266912605384131HOEnZb"><font color="#888888">
</font></span></font></span></div><span class="HOEnZb"><font color="#888888"><span class="m_-3440266912605384131HOEnZb"><font color="#888888">
<br>
</font></span></font></span></div><span class="HOEnZb"><font color="#888888"><span class="m_-3440266912605384131HOEnZb"><font color="#888888">
</font></span></font></span></blockquote><span class="HOEnZb"><font color="#888888"><span class="m_-3440266912605384131HOEnZb"><font color="#888888">
<br>
<pre class="m_-3440266912605384131m_1364274761674189114moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="m_-3440266912605384131m_1364274761674189114moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a class="m_-3440266912605384131m_1364274761674189114moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="m_-3440266912605384131m_1364274761674189114moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio World Conference -- <a class="m_-3440266912605384131m_1364274761674189114moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank">www.kamailioworld.com</a></pre>
</font></span></font></span></div>
</blockquote></div><br></div>
</blockquote></div><br></div>