<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Also, I found the 'workdir' parameter that can be defined in the configuration script.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Leonid Fainshtein<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 1, 2020 at 8:29 PM Henning Westerholt <<a href="mailto:hw@skalatan.de">hw@skalatan.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="DE">
<div class="gmail-m_4244233920774642460WordSection1">
<p class="MsoNormal"><span>Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">-- <u></u>
<u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning Westerholt –
</span><span><a href="https://skalatan.de/blog/" target="_blank"><span lang="EN-GB" style="color:rgb(5,99,193)">https://skalatan.de/blog/</span></a></span><span lang="EN-GB"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kamailio services –
</span><span><a href="https://gilawa.com/" target="_blank"><span lang="EN-GB" style="color:rgb(5,99,193)">https://gilawa.com</span></a></span><span>
<span lang="EN-GB"><u></u><u></u></span></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>Leonid Fainshtein<br>
<b>Sent:</b> Wednesday, September 30, 2020 6:01 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
<b>Subject:</b> Re: [SR-Users] Kamailio fails to start when tls module parameter 'config' contains a folder name<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif">Actually, it is possible to use the libc 'P_tmpdir' macro in order to get the temporary folder name.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Best regards,<br>
Leonid Fainshtein<u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">On Wed, Sep 30, 2020 at 6:35 PM Leonid Fainshtein <<a href="mailto:leonid.fainshtein@xorcom.com" target="_blank">leonid.fainshtein@xorcom.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif">Hi,<br clear="all">
<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif">I am using Kamailio 5.4.1 installed from the packages on Ubuntu 18.04.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif">When I define 'modparam("tls", "config", "<folder>")', Kamailio fails to start:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif"><u></u> <u></u></span></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:"Courier New";color:black">ERROR: tls [tls_config.c:418]: tls_load_config(): cannot make tmp file configrcCczj
</span><span style="font-family:"Courier New""><br>
ERROR: <core> [core/sr_module.c:849]: init_mod(): Error while initializing module tls (/usr/lib/x86_64-linux-gnu/kamailio/modules/tls.so)
<br>
<br>
</span><span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">I checked the
</span></span>tls_load_config()<span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif"> 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.</span></span><u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">I succeeded to launch Kamailio in two ways:</span></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif">Method 1<span class="gmail-m_4244233920774642460gmaildefault">: </span> copy
<span class="gmail-m_4244233920774642460gmaildefault">'</span>kamailio<span class="gmail-m_4244233920774642460gmaildefault">'</span> to /tmp and modify
</span>kamalio.service<span style="font-family:Arial,sans-serif"> accordingly<span class="gmail-m_4244233920774642460gmaildefault">. This experiment result made me think that the working folder is the folder where kamailio is started.</span></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">Method 2: add Kamailio command line parameter "-w /tmp"</span></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">(I also tried to define the Systemd 'WorkingDirectory' parameter but it didn't have any effect.)</span></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">I think that the ultimate solution for this problem is to modify the </span></span>tls_load_config()<span class="gmail-m_4244233920774642460gmaildefault"><span style="font-family:Arial,sans-serif">
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. </span></span><u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:Arial,sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:35.4pt">
Best regards,<br>
Leonid Fainshtein<u></u><u></u></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote></div>