[OpenSIPS-Users] Question about script variables

Denys Pozniak denys.pozniak at crazycall.com
Thu Nov 23 08:57:06 EST 2017


Thank you for the explanation!


On 23 November 2017 at 14:34, Liviu Chircu <liviu at opensips.org> wrote:

> Hi Denys,
>
> The book is doing the correct thing - educating the script writer that he
> must not rely on any $var() holders once an instance of script execution
> ends for a given message.
>
> You, on the other hand, have the additional knowledge of an underlying
> optimization: the $var() values are not reset (actually, they are rarely
> touched at all beyond the script manipulations). The fact that you
> occasionally find the value that you left in the previous message is just a
> coincidence, and you cannot reliably use their initial values. Since this
> is just a "nice to know" developer quirk, I think it would cause confusion
> if the authors were to include it in the book.
>
> If you talk C, you can think of $vars as "uninitialized stack variables".
>
> Regards,
>
> Liviu Chircu
> OpenSIPS Developerhttp://www.opensips-solutions.com
>
> On 23.11.2017 14:13, Denys Pozniak wrote:
>
> Hello!
>
> I am newbie in OpenSIPS and probably my question is stupid, but I could
> not sleep without correct answer :)
> In the book *Building Telephony Systems with OpenSIPS Second Edition* I
> found next part (p. 97):
>
> *The script variables*
> *As the name indicates, these variables are strictly bound to the
> scripting routes. The*
> *variables are visible only in the routing blocks and they have no
> persistency—when*
> *the route (with all its subroutes) ends, the variables are discarded.*
>
> Is it correct explanation?According to this, variable lives on SIP message
> level when script are executing, but I think something is not correct as
> variable lives on proccess level.
>
> Please help me to sort out this!
>
> BR
> Denys
>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 

BR
Denys Pozniak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171123/9dd471d8/attachment-0001.html>


More information about the Users mailing list