[Kamailio-Users] Global constants

Alex Balashov abalashov at evaristesys.com
Mon Jan 25 15:13:42 CET 2010


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?


-- Alex

Alex Balashov - Principal
Evariste Systems LLC

Tel    : +1 678-954-0670
Direct : +1 678-954-0671
Web    : http://www.evaristesys.com/

More information about the sr-users mailing list