<div class="gmail_quote"><div>Hello</div><div><br></div><div>this is what I normally use:</div><div><br></div><div>if (defined $var(x)) {...}</div><div><br></div><div>Regards</div><div><br></div><div>Javi</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
------------------------------<br>
<br>
Message: 4<br>
Date: Tue, 6 Mar 2012 20:05:32 -0600<br>
From: Krishna Kurapati &lt;<a href="mailto:kkurapat@gmail.com">kkurapat@gmail.com</a>&gt;<br>
Subject: [SR-Users] Improving Kamailo configuration parser ...<br>
To: kamailio users &lt;<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>&gt;<br>
Message-ID:<br>
        &lt;<a href="mailto:CAOzCjAfcaRQ%2BHT3r%2BmwckPyaVJH%2BEVFWNa_Hj6tAhGyD2DaMJA@mail.gmail.com">CAOzCjAfcaRQ+HT3r+mwckPyaVJH+EVFWNa_Hj6tAhGyD2DaMJA@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
I used<br>
<br>
if ($var(x) != null) { ... }<br>
<br>
in one of the routes, and tried to run Kamailio server.<br>
The server exited with an error. I did not know why.<br>
<br>
Once I changed it to if ($var(x) != $null) {} the error went away.<br>
I missed $ infront null. I think it is hard to trace such problems once a<br>
large chunk<br>
of logic is written since many of us come from C++ and scripting background<br>
where $null<br>
is not a common practice.<br>
<br>
Also if I tried to use if (!$var(x)) { ... } Kamailio tries to convert the<br>
value of $var(x) to integer.<br>
prints WARNINGS in the log when the $var(x) consists of a string.<br>
<br>
Krish Kura<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://lists.sip-router.org/pipermail/sr-users/attachments/20120306/d591f3b0/attachment-0001.htm" target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20120306/d591f3b0/attachment-0001.htm</a>&gt;<br>

<br>
------------------------------<br><br></blockquote></div>