[Kamailio-Users] Global constants
miconda at gmail.com
Tue Jan 26 10:23:26 CET 2010
On 1/25/10 3:13 PM, Alex Balashov wrote:
> What is the recommended way (if any) to have a "global constant" that
> exists outside of any particular routes, in K3?
> My objective is to define a global DB_URL that can be used by all
> modules everywhere, but I can't just 'and' the modules together, e.g.
> modparam("mod1|mod2|mod3|...", "db_url", "...")
> because the modules are dynamically included (thanks to include_file!)
> and I do not know the list of all loaded modules easily at runtime. So
> instead, db_url is configured on a per-module basis.
> I thought preprocessor constants (e.g. #!define and friends) would
> allow me to set values for them, but they don't, so that's out. What
> other options are available that do not involve an event/local route,
> and operate instead in the completely global namespace?
> Right now, I am using a Perl script that manually substitutes the
> value of the db_url modparam everywhere in a large directory tree. :/
> What am I not thinking of?
indeed define does not take values, maybe in the future... the option is
to stick with perl for now.
Note that you can do:
So you can set the parameters immediately you load the module.
More information about the sr-users