Hello,

On 1/25/10 3:13 PM, Alex Balashov wrote:
Daniel,

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:

loadmodule abc
modparam(abc, ...)

loadmodule xyz
modparam(xyz, ...)

So you can set the parameters immediately you load the module.

Cheers,
Daniel

--
Daniel-Constantin Mierla
* http://www.asipto.com/


_______________________________________________
Kamailio (OpenSER) - Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users

Reply via email to