[SR-Users] sr-users Digest, Vol 82, Issue 21

Javier Gallart jgallartm at gmail.com
Wed Mar 7 14:47:50 CET 2012


Hello

this is what I normally use:

if (defined $var(x)) {...}

Regards

Javi


> ------------------------------
>
> Message: 4
> Date: Tue, 6 Mar 2012 20:05:32 -0600
> From: Krishna Kurapati <kkurapat at gmail.com>
> Subject: [SR-Users] Improving Kamailo configuration parser ...
> To: kamailio users <sr-users at lists.sip-router.org>
> Message-ID:
>        <CAOzCjAfcaRQ+HT3r+mwckPyaVJH+EVFWNa_Hj6tAhGyD2DaMJA at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> I used
>
> if ($var(x) != null) { ... }
>
> in one of the routes, and tried to run Kamailio server.
> The server exited with an error. I did not know why.
>
> Once I changed it to if ($var(x) != $null) {} the error went away.
> I missed $ infront null. I think it is hard to trace such problems once a
> large chunk
> of logic is written since many of us come from C++ and scripting background
> where $null
> is not a common practice.
>
> Also if I tried to use if (!$var(x)) { ... } Kamailio tries to convert the
> value of $var(x) to integer.
> prints WARNINGS in the log when the $var(x) consists of a string.
>
> Krish Kura
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.sip-router.org/pipermail/sr-users/attachments/20120306/d591f3b0/attachment-0001.htm
> >
>
> ------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120307/7b56e18c/attachment.htm>


More information about the sr-users mailing list