[SR-Users] Difference between shared and script variable

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 14 08:35:24 CET 2013


Hello,

$shv(...) is referred as shared memory variable because it stores the 
value in shared memory. That means if you set $shv(x) in one process, 
you can read its value from another process. You have to be sure you 
don't have races in setting the variable, that could be achieved with 
locks from cfgutils.

$var(...) is referred as private memory variable because it stores the 
value in private memory. That means its value is valid in the context of 
the same process (e.g., use it while processing the same sip message on 
a single routing block type, like running the main request route block, 
or reply route block, etc). It is not safe to use it for transactions, 
like setting it in request route block and reading it in failure route 
block (use avps for that case).

$var(...) is faster to use and does not need locking at all. These are 
usually referred as script variable, but this term can be confused with 
all the config file variables.

Cheers,
Daniel

On 2/12/13 3:13 PM, Mino Haluz wrote:
> Hi,
>
> what is the difference between shared and script variable ? Thanks
>
> Mino
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130214/6eadeffc/attachment.htm>


More information about the sr-users mailing list