Also, I found the 'workdir' parameter that can be defined in the configuration script.

Best regards,
Leonid Fainshtein

On Thu, Oct 1, 2020 at 8:29 PM Henning Westerholt <hw@skalatan.de> wrote:

Hello,

 

the „-w“ parameter is meant for specifying the working directory. Usually the system specific init scipts are setup in a way to allow Kamailio to write to a proper directory where it is can place files.

 

So, it can be flexible configured as necessary. About code extensions – have not looked into that particular function right now, but pull requests can be always created and will be reviewed by the developers.

 

Cheers,

 

Henning

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

From: sr-users <sr-users-bounces@lists.kamailio.org> On Behalf Of Leonid Fainshtein
Sent: Wednesday, September 30, 2020 6:01 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] Kamailio fails to start when tls module parameter 'config' contains a folder name

 

Actually, it is possible to use the libc 'P_tmpdir' macro in order to get the temporary folder name.

 

Best regards,
Leonid Fainshtein

 

On Wed, Sep 30, 2020 at 6:35 PM Leonid Fainshtein <leonid.fainshtein@xorcom.com> wrote:

Hi,

I am using Kamailio 5.4.1 installed from the packages on Ubuntu 18.04.

When I define 'modparam("tls", "config", "<folder>")', Kamailio fails to start:

 

ERROR: tls [tls_config.c:418]: tls_load_config(): cannot make tmp file configrcCczj
ERROR: <core> [core/sr_module.c:849]: init_mod(): Error while initializing module tls (/usr/lib/x86_64-linux-gnu/kamailio/modules/tls.so)

I checked the tls_load_config() function and found that when a folder is defined in the 'config' parameter, the function tries to open a temporary file in the working directory. I believe that the working directory at that point is the folder where Kamailio was started: /usr/sbin.

I succeeded to launch Kamailio in two ways:

Method 1 copy 'kamailio' to /tmp and modify kamalio.service accordingly. This experiment result made me think that the working folder is the folder where kamailio is started.

Method 2: add Kamailio command line  parameter "-w /tmp"

 

(I also tried to define the Systemd 'WorkingDirectory' parameter but it didn't have any effect.)

 

I think that the ultimate solution for this problem is to modify the tls_load_config() function in such a way that it will open the temporary file in a folder that is intended for the temporary files. For example, the /tmp folder in Linux and *BSD systems. I guess that /tmp is a good place in MacOS as well. 

 

Best regards,
Leonid Fainshtein