[Kamailio-Users] Kamailio 3.0.0: configuration request regarding VARIABLES usage (custom variables + $var(x))

Alex Balashov abalashov at evaristesys.com
Mon Feb 22 12:30:39 CET 2010


On 02/22/2010 06:26 AM, Henning Westerholt wrote:


> Its possible to define them also on your own:
> http://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-4-cfg.html

Aha!  Thanks!  I missed that one.  This is actually very useful.

What would be even more useful is if these values could be used as input 
to modparams.  Are modparam values evaluated for PV spec?

In other words, let's say I want to define a global 'db_url' for all 
modules, but I do not know which modules I am going to load in advance 
because I am using preprocessor macros to determine that, so the usual 
formula

    modparam("mod1|mod2|mod3|...", "db_url", "...")

will not work.

Can I do something like this instead?

    modparam("usrloc", "db_url", "$sel(cfg_get.db_url)");


> With regards to the question of the OP, if you need to access this variable
> only in one place then perhaps you could just ommit the temporary definition.
> If you only have the problem of visibility, what about using another type of
> storage, like Alex suggested, '$shv' or perhaps '$avp'?

If the values need to be loaded from a database and postprocessed 
somehow, or something like that, then this problem could also be 
elegantly solved if there existed an additional type of 'route' that was 
not module or event-specific, e.g. not like route[htable:mod-init], but 
was tied to Kamailio booting up, like an 'onload_route'.  Was there not 
a little talk of this some time ago?


-- 
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