[OpenSIPS-Devel] [ opensips-Bugs-3586730 ] $var variables cleanup on new request

SourceForge.net noreply at sourceforge.net
Tue Nov 13 16:44:54 CET 2012


Bugs item #3586730, was opened at 2012-11-13 07:03
Message generated for change (Comment added) made by denodaeus
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3586730&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.8.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nick Altmann (nikbyte)
Assigned to: Nobody/Anonymous (nobody)
Summary: $var variables cleanup on new request

Initial Comment:
I found that in my script I do something like (the same tail of every log message is because of m4 macros):

route {
    xlog("L_INFO", "[MAIN] log message [$var(info)]");
    $var(info) = "blablabla";
    xlog("L_INFO", "[MAIN] another message [$var(info)]");
}

Interesting that in first xlog the $var(info) is not null ! 
And instead of "null" I see there something interesting values from other client's requests.

I think we should clean up all $var variables before request, shouldn't we?


----------------------------------------------------------------------

Comment By: Robert Smith (denodaeus)
Date: 2012-11-13 07:44

Message:
I've been bitten by this before, but it's intentional.  From the docs:

http://www.opensips.org/Resources/DocsCoreVar18#varscript

1.  if you want to start using a script variable in a route, better
initialize it with same value (or reset it), otherwise you may inherit a
value from a previous route that was executed by the same process.
3. the value of script variables persists over a OpenSIPS process.

So you can either initialize it to the same default value every time, or
you can use something transactional instead (like avp's).



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3586730&group_id=232389



More information about the Devel mailing list