Hello,
On 13.11.23 12:14, Bernd Krueger-Knauber via sr-users wrote:
Hi,
since we use git also for our kamailio stuff, we need to check in also host specific stuff. (same kamailio.cfg but different addresses and ... ) For this I thought an include_file for different hosts would be nice, but I can not check in the different host specific files, because I can not use something like:
|include_file "$HN(n).cfg"
It is not allowed in kamailio 5.6.x Or better: the pseudo variable is not replaced.
Is there a way to work arround, or is it possible to make it possible? |
the variables are mostly runtime elements (evaluated at every execution) for kamailio.cfg, while include is a pre-processor directive which is evaluated at reading the file, even before the file content is understood by the interpreter (think of include_file directive as a copy and paste to build a larger cfg file that is then passed to the interpreter for parsing and understanding).
A way that might work, although I haven't tested it at all, is to leverage environment variables that can be accessed via #!defenv, like:
- in shell
export HOSTFILECFG=abc.cfg
- in config file
#!defenv HOSTFILECFG
include_file HOSTFILECFG
Cheers, Daniel
||