[OpenSIPS-Users] Global Variables

Jeff Kronlage jeff at data102.com
Sun Oct 4 18:41:28 CEST 2009


Brett,

 

The $var variables are persistent per transaction.  For the entire
dialog, use dialog variables:

 

http://www.opensips.org/html/docs/modules/1.5.x/dialog.html

 

The key functions here are store_dlg_value() and fetch_dlg_value(), or
set_dlg_flag() and is_dlg_flag_set().

 

Now if you're looking to share values between different dialogs, you
could have a look at set_dlg_profile() and get_profile_size(), but I'm
not sure that's what you're looking for.  There is some great sample
code here:

 

http://www.opensips.org/Resources/DocsTutConcurrentCalls

 

I had the need to store values across multiple profiles and across
multiple servers in real-time; my solution was to use avp_db_query() and
build my own database-backended storage system that all Opensips
processes, regardless of which server they were on, could access.
Needless to say this is not a lightweight solution and I'm certain it
will require a beefy database server as we get larger, but it was the
only way I could see to make it happen...

 

Jeff

 

From: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] On Behalf Of Brett Nemeroff
Sent: Sunday, October 04, 2009 10:27 AM
To: users at lists.opensips.org
Subject: [OpenSIPS-Users] Global Variables

 

Hey all,

I'm wondering if there is a way to use global variables? I see that $var
variables are persistent across the process, but I need something that
will persist across all processes. Right now, I'm using memcache, but
I'm not sure if I'll have race conditions relying on that as I expect
many processes to be accessing and updating the globals for every call.

 

Thanks,

Brett

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20091004/b6390e60/attachment.htm 


More information about the Users mailing list