[OpenSIPS-Users] when does a var goes out of scope.

Liviu Chircu liviu at opensips.org
Wed Sep 2 11:28:15 EST 2020


On 02.09.2020 13:35, johan wrote:
>
> I seem to get strange and incomprehensible results : 

Hi, johan!

This behavior is clearly stated in the $var() documentation [1].  The 
idea is that the $var() variables are *super*-optimized, to the point 
where the OpenSIPS workers perform *no cleanup *of the previous state of 
their $var() variables when beginning to process a new SIP request.  
This immediately explains why your $var(fU) contains the random value of 
"+3246020570", despite the dp_translate(33757935187) produces "false" 
(it does not match against any dp rule).

TL;DR: this is a feature, not a bug.  If you really need $var(fU) to be 
initialized, then do "$var(fU) = NULL;" before you use it.

Best regards,

[1]: https://www.opensips.org/Documentation/Script-CoreVar-3-2#toc1

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

OpenSIPS Summit 2020 Distributed
   www.opensips.org/events/Summit-2020Distributed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200902/7ee28abe/attachment.html>


More information about the Users mailing list