[OpenSIPS-Users] substitute variable names within variables
jayesh.voip at gmail.com
Thu Dec 27 19:52:58 CET 2012
I define some values using the varset parameters of cfgutils module.
modparam("cfgutils", "varset", "media1=22.214.171.124")
modparam("cfgutils", "varset", "media2=126.96.36.199")
modparam("cfgutils", "varset", "media3=188.8.131.52")
I need a logic to dynamically select the the variables. Say for example:
I select a value from DB and store it in an AVP say $avp(db_val) which I
know can be either 1,2 or 3. Based on that value, I need to select among
variables media1, media2 or media3.
I need to find a way where I can substitute the avp(db_val) value in the
name of the variable. Basically something like this:
$avp(variable_to_be_used) = $var(media$avp(db_val))
So here if $avp(db_val) is 1, avp(variable_to_be_used) becomes $var(media1)
which will be 184.108.40.206
Is something like this possible or allowed? Is there an alternative to do
something similar dynamically !! I know, I cud have stored those values in
DB and retrieved directly but I am looking at this feature for many other
purposes too !!
Any help is much appreciated. Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users