modparam("…|…", "…", "…") - pipe symbol is not documented
dilyanpalauzov opened this issue · 7 comments
The core cookbook - https://www.kamailio.org/wikidocs/cookbooks/devel/core/ - contains this example:
modparam("acc|auth_db|usrloc", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio_testbed")
Examples with the pipe symbol in the first parameter of modparam are shown also on other places.
It is not documented, by means of written down words, what does the pipe symbol in modparam("|")
do.
The pipe operator in the context of the modparam means that the parameter should be configured for all the listed modules.
In the example given above, the "db_url" parameter will be configured for the acc, auth_db and usrloc modules. The motivation is to combine some common parameters. You can make a PR with some docs extensions for that, if its missing in the wiki.
When I set
modparam("blub", "qop", "auth")
the error is:
0(1) ERROR: [core/modparam.c:187]: set_mod_param_regex(): No module matching found
0(1) CRITICAL: [core/cfg.y:3790]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 240, column 31: Can't set module parameter
ERROR: bad config file (1 errors) (parsing code: 0)
If I use instead
modparam("auth|blub", "qop", "auth")
or
modparam("blub|auth", "qop", "auth")
then there is no error. Provided that the error-checking is loose on modparam called with a pipe, this usage form shall be discouraged.
iirc, presence of |
turns into regexp matching over the list of loaded modules, like matching against ^(mod1|mod2)$
, it is not like providing the list of names for modules.
I do not understand the role of |
.
If you are not familiar with regular expressions, you should read a bit about, there are many good online tutorials. The role of |
for modparam is to be used as a regexp format. Regexps are used in many places in kamailio, with =~
operator, for functions like search, subst, ...
I do understand regex, but I do not inderstand the impact of having or not a |
here, when it comes to setting a parameter to module(s).
Docs updated.