<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hello,</p>
<p>$var(...) don't hold null values, they start initialed to 0 and
they are reset to 0 (when assigning $null to them) -- this is the
design from the beginning which brings benefits in many situation
when one doesn't get a chance to init.</p>
<p>If you want a similar variable that works with null, then use
$vn(...):</p>
<p> -
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#vn_name_-_private_memory_variables_null">https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#vn_name_-_private_memory_variables_null</a></p>
<p>Cheers,<br>
Daniel<br>
</p>
<br>
<div class="moz-cite-prefix">On 27/03/2017 15:22, Ginhoux, Patrick
wrote:<br>
</div>
<blockquote
cite="mid:CO2PR07MB251914D5BAE75903EAF5F911B6330@CO2PR07MB2519.namprd07.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I’m continue my job to
‘migrate’ my 3.3.1 kamailio.cfg script on a RHEL 6.2 server
to the 5.0.x kamailio version on a RHEL 7.1 server, and I
encounter a major problem with the ‘== $null’ test in the
script.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My original script
(3.3.1) contains this sequence :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
$var(i:rangeInx)=0;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
$var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> xlog("
imbxRangeInx value before test : '$var(i:maxRangeInx)' ");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> if
($var(i:maxRangeInx)==$null) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
$var(i:maxRangeInx)=99;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> xlog("
imbxRangeInx after test : '$var(i:maxRangeInx)' ");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:21.3pt"><span
style="font-family:Wingdings" lang="EN-US">è</span><span
lang="EN-US"> The results are :<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
lang="EN-US">imbxRangeInx value before test : ‘0’<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
lang="EN-US">imbxRangeInx value after test : ‘99’<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I run the same script on
my new server and I get ‘0’ before and after the test.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I attempted another kind
of test to try to figure out where the problem is. So I
write the simple test (with kamailio 5.0.x) :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
$var(i:rangeInx)=0;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
$var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> $var(toto) =
$null;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> if ($var(toto)
== $null)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> xlog
("toto true");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> else<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> xlog
("toto false");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The result I got is
always ‘toto false’.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">So it appears to me that
the test ‘== $null’ doens’ that gives a good result with
kamailio 3.3.1, doesn’t return the same with kamailio 5.0.x.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">That is a major issue
for me and it let me confused about the possibility to move
to kamailio 5.0.x.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Have people an idea /
explanation, why this issue ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:FR"
lang="EN-US">Cordialement<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:FR"
lang="EN-US">Patrick GINHOUX</span><span
style="mso-fareast-language:FR"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 8-10, 2017 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>