Re: [SR-Users] Important problem with this test : if ($var(i:maxRangeInx)==$null)
Hi, Great thanks to answer so quickly. I tested the $vn ….in the 5.0.x script instead of $var…., and the results look good. So I have to review the entire script to change all the ‘$var…. == $null’ entries to ‘$vn…. == $null’. I assume I have to do the same for the ‘!= $null” case. Am I correct ? Now regarding my old kamailio 3.3.1 script, I notice that the ‘$var…. == $null’ works fine but no more with kamailio 5.0.x . So It’s something that has changed more recently. The 3.3.1 cookbooks doesn’t reference a ‘$vn’ variable. But may be I misread it. So if you have comments on this for my understanding, that would be fine. Cordialement Patrick GINHOUX De : sr-users [mailto:sr-users-boun...@lists.sip-router.org] De la part de Daniel-Constantin Mierla Envoyé : lundi 27 mars 2017 15:31 À : Kamailio (SER) - Users Mailing List <sr-users@lists.sip-router.org> Objet : Re: [SR-Users] Important problem with this test : if ($var(i:maxRangeInx)==$null) Hello, $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. If you want a similar variable that works with null, then use $vn(...): - https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#vn_name_-_private_memory_variables_null Cheers, Daniel On 27/03/2017 15:22, Ginhoux, Patrick wrote: Hi, 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. My original script (3.3.1) contains this sequence : $var(i:rangeInx)=0; $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); xlog(" imbxRangeInx value before test : '$var(i:maxRangeInx)' "); if ($var(i:maxRangeInx)==$null) { $var(i:maxRangeInx)=99; } xlog(" imbxRangeInx after test : '$var(i:maxRangeInx)' "); ==> The results are : imbxRangeInx value before test : ‘0’ imbxRangeInx value after test : ‘99’ I run the same script on my new server and I get ‘0’ before and after the test. 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) : $var(i:rangeInx)=0; $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); $var(toto) = $null; if ($var(toto) == $null) xlog ("toto true"); else xlog ("toto false"); The result I got is always ‘toto false’. 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. That is a major issue for me and it let me confused about the possibility to move to kamailio 5.0.x. Have people an idea / explanation, why this issue ? Cordialement Patrick GINHOUX ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org<mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla www.twitter.com/miconda<http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda> Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com<http://www.asipto.com> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com<http://www.kamailioworld.com> ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] Important problem with this test : if ($var(i:maxRangeInx)==$null)
Hello, $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. If you want a similar variable that works with null, then use $vn(...): - https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#vn_name_-_private_memory_variables_null Cheers, Daniel On 27/03/2017 15:22, Ginhoux, Patrick wrote: > > Hi, > > > > 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. > > > > My original script (3.3.1) contains this sequence : > > > > $var(i:rangeInx)=0; > > $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); > > xlog(" imbxRangeInx value before test : '$var(i:maxRangeInx)' "); > > if ($var(i:maxRangeInx)==$null) { > > $var(i:maxRangeInx)=99; > > } > > xlog(" imbxRangeInx after test : '$var(i:maxRangeInx)' "); > > > > èThe results are : > > imbxRangeInx value before test : ‘0’ > > imbxRangeInx value after test : ‘99’ > > > > I run the same script on my new server and I get ‘0’ before and after > the test. > > > > 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) : > > > > $var(i:rangeInx)=0; > > $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); > > $var(toto) = $null; > > if ($var(toto) == $null) > > xlog ("toto true"); > > else > > xlog ("toto false"); > > > > The result I got is always ‘toto false’. > > > > 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. > > > > That is a major issue for me and it let me confused about the > possibility to move to kamailio 5.0.x. > > > > Have people an idea / explanation, why this issue ? > > > > Cordialement > > Patrick GINHOUX > > > > > > ___ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
[SR-Users] Important problem with this test : if ($var(i:maxRangeInx)==$null)
Hi, 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. My original script (3.3.1) contains this sequence : $var(i:rangeInx)=0; $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); xlog(" imbxRangeInx value before test : '$var(i:maxRangeInx)' "); if ($var(i:maxRangeInx)==$null) { $var(i:maxRangeInx)=99; } xlog(" imbxRangeInx after test : '$var(i:maxRangeInx)' "); ==> The results are : imbxRangeInx value before test : '0' imbxRangeInx value after test : '99' I run the same script on my new server and I get '0' before and after the test. 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) : $var(i:rangeInx)=0; $var(i:maxRangeInx) = $sht(mbxrangeHash=>"maxrange"); $var(toto) = $null; if ($var(toto) == $null) xlog ("toto true"); else xlog ("toto false"); The result I got is always 'toto false'. 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. That is a major issue for me and it let me confused about the possibility to move to kamailio 5.0.x. Have people an idea / explanation, why this issue ? Cordialement Patrick GINHOUX ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users