[OpenSIPS-Users] setting global variables and selecting among them

Vlad Paiu vladpaiu at opensips.org
Wed Dec 7 11:15:08 CET 2011


Hello,

Please check out the rand_event [1] function exported by the cfgutils 
module.

[1] http://www.opensips.org/html/docs/modules/devel/cfgutils.html#id250076

Regards,

Vlad Paiu
OpenSIPS Developer


On 12/07/2011 11:42 AM, Jayesh Nambiar wrote:
> Hi All,
> I was thinking of a requirement and wanted to know if it is possible. 
> For example:
> I define two variables,
> var(media-relay){1} = 1.2.3.4
> var(media-relay){2} = 4.3.2.1
> Now I wish to use both these relays randomly or in a 50-50 manner. So 
> for example, if I have something like this in my script:
>
> modparam("mediaproxy", "media_relay_avp", "$avp(media_relay)")
>
> $avp(media_relay) = $var(media-relay);
>
> It should either randomly select between 1.2.3.4 and 4.3.2.1 or use 
> some algorithm to do a round-robin between them. Is this in someway 
> possible in the current setup?
> Thanks in advance for any suggestion.
>
> --- Jayesh
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111207/f1482e1e/attachment.htm>


More information about the Users mailing list