Hello,

$var(...) cannot be deleted. Its implementation relies on startup replacement of the name with a pointer in memory, at runtime being used only the pointer (for speed considerations). You should use $avp() if you want to deal with $null.

For the second, it depends on transformation, afaik, most transformations don't return null, but empty string (at least the string transformations). If you implement a new one and want to return $null, the value must have the flag PV_VAL_NULL set, like: val->flags  |= PV_VAL_NULL

Cheers,
Daniel

On 05/01/15 13:36, Luis Azedo wrote:
HI Daniel,

thanks, so in the first case instead of assigning the value to the $var(x) can i delete the $var(x) so that comparison works ?

in the second case (returned value from transform) what value should i compare against to check if returned value was null ?


From: sr-dev [sr-dev-bounces@lists.sip-router.org] on behalf of Daniel-Constantin Mierla [miconda@gmail.com]
Sent: Monday, January 05, 2015 3:51 AM
To: Kamailio (SER) - Development Mailing List
Subject: Re: [sr-dev] need help understanding $null

Hello,

$var(...) cannot be null by design, setting it to $null makes it 0.

$null is more for variables that don't exist, e.g., you don't have the $avp(x), then it is null if you compare it.

Cheers,
Daniel

On 04/01/15 12:35, Luis Azedo wrote:
Hi Daniel,

can you help on this ?

Thank you

From: sr-dev [sr-dev-bounces@lists.sip-router.org] on behalf of Luis Azedo [luis@2600hz.com]
Sent: Wednesday, December 31, 2014 4:19 AM
To: sr-dev@lists.sip-router.org
Subject: [sr-dev] need help understanding $null

Hi,

if we return val.flags = PV_VAL_NULL, does the == $null comparison work ?

script example

my_function("some param","$var(result)");
if( $var(result) == $null {
  do something
}
in code => dst_pv->setf(msg, &dst_pv->pvp, (int)EQ_T, &dst_val);
 should the comparison work if we set dst_val.flags = PV_VAL_NULL ?


if( $(myPvar{my.mytransform,transformParameter}) == $null) {
  ....
}
should this work if the transform returns val.flags = PV_VAL_NULL ?


thank you







_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda