Hi all!
I am using HTTP_CLIENT module, and have created a http configuration file. The module's config_file parameter is set as:
modparam("http_client", "config_file", "/etc/kamailio/http_client.cfg")
and it works OK on my DEV environment, because there is a symlink /etc/kamailio pointing to physical folder /usr/local/etc/kamailio/ (using Kamailio 5.7.4)
However in our integration environment (also using Kamailio 5.7.4), which is identical to production, and due to limitations on access rights, we cannot create a symlink /etc/kamailio pointing /usr/local/etc/kamailio/, so all cfg files are in the installation folder. So I thought that the config_file parameter should be a relative path, starting with " ./ " or by just setting the config file name, without path (as per documentation at http_client (kamailio.org) https://kamailio.org/docs/modules/5.1.x/modules/http_client.html#idp38265140 .
The issue is that even though the file http_client.cfg is present in /usr/local/etc/kamailio/, as well as other cfg files, the cfg_parser fails to load it:
Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: <core>
[core/cfg_parser.c:632]: cfg_parser_init(): cfg_parser: Unable to open file './http_client.cfg' Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: http_client [curlcon.c:782]: http_client_load_config(): Failed to init http_client config file parser Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: http_client [http_client.c:307]: mod_init(): Failed to load http_client connections from [./http_client.cfg] Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: <core> [core/sr_module.c:1030]: init_mod(): Error while initializing module http_client (/usr/local/lib64/kam ailio/modules/http_client.so)
I have set the parameter to
modparam("http_client", "config_file", "./http_client.cfg")
and also to
modparam("http_client", "config_file", "http_client.cfg")
but it only works if I add it as :
modparam("http_client", "config_file", "/usr/local/etc/kamailio/http_client.cfg")
or by adding
chroot="/usr/local/etc/kamailio"
in the main cfg script, which was my final solution.
Also checked for permissions, and all is fine. Note that this only seems to happen with http_client config_file parameter. I have other include commands in the main cfg file with relative paths and all works fine.
I have also analysed the cfg_parser.so file, which loads the configuration file for http_client module, but could not find anything wrong with it (at 1st glance....)
What am I doing wrong? Any clue?
Atenciosamente / Kind Regards / Atentamente / Cordialement,
*Sérgio *