[OpenSIPS-Users] $var scope clarification

Brett Nemeroff brett at nemeroff.com
Tue Apr 13 18:55:33 CEST 2010


I suppose since a child process only handles one message at a time,
that there is no danger of race conditions using vars, just the
possibility (likelyhood) of uninitialized data laying around..

Am I on track there? :)

Thanks,
Brett



On Tue, Apr 13, 2010 at 11:42 AM, Bogdan-Andrei Iancu
<bogdan at voice-system.ro> wrote:
> Hi Brett,
>
> I see you missed the last webinar on script variables ;).
>
> So, the $var() are script variables - you should not rely on any kind of
> persistence for them. They are intended to be used in script only (in
> route + all its subroutes).
> You should use them for script ops (like iterations, building strings, etc)
>
> This vars are not share at all and, as they are attached to processes,
> it is highly recommended to reset they value before using them in script.
>
> Regards,
> Bogdan
>
> Brett Nemeroff wrote:
>> Hello All,
>> I've always been hesitant to use $var type variables over avps since
>> they have a scope that spans the whole process.. Most of my need for
>> variables is transactional. I'm just concerned about race conditions.
>> Am I misunderstanding their scope? ie: $var(customer) is going to
>> change from transaction to transaction and having that shared across
>> an entire process wouldn't be good..
>>
>>
>> Thanks for your insight.. :)
>> -Brett
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
> --
> Bogdan-Andrei Iancu
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



More information about the Users mailing list