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

SourceForge.net noreply at sourceforge.net
Wed Nov 28 18:55:20 CET 2012


Bugs item #3586730, was opened at 2012-11-13 07:03
Message generated for change (Settings changed) made by vladut-paiu
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: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Nick Altmann (nikbyte)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
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: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2012-11-21 08:33

Message:
Hi Nick,

The $var() are on purpose process persistent - they are not ever reset. You
need to take care in script and reset it before using it.

The fact they are process persistent may help you to pass values between
different routes (like requests and branch route) when the routes are
triggered in the same process (in a row, like onreply + failure)

Regards,
Bogdan

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

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