<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>What version of Kamailio are you using (kamailio -v)?</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 29.05.22 08:18, Nigel Daniels wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOikNcX+ob1WiZmSV91F0zQTW3UkxH6B3SiCOmM9NuBWA55EhA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>The logs appear as follows:</div>
        <div><br>
        </div>
        <div>Fatal Python error: failed releasing import lock after fork</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div> Current thread 0x 7(13) DEBUG: <core>
          [core/utils/sruid.c:121]: sruid_init(): root for sruid is
          [srid-62930e67-d-] (0 / 16)<br>
          kamailio             | 00007fe8fb8a4180 (most recent call
          first):<br>
          kamailio             | <no Python frame><br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: tm
          [ctl handler]<br>
          kamailio             |  7(13) DEBUG: tm [callid.c:136]:
          child_init_callid(): callid: '<a
            href="mailto:06d932e436730fa0-13@10.10.0.4"
            moz-do-not-send="true" class="moz-txt-link-freetext">06d932e436730fa0-13@10.10.0.4</a>'<br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: tmx
          [ctl handler]<br>
          kamailio             |  7(13) DEBUG: tmx [tmx_mod.c:262]:
          child_init(): rank is (-2)<br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: sl
          [ctl handler]<br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: ctl
          [ctl handler]<br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2:
          debugger [ctl handler]<br>
          kamailio             |  7(13) DEBUG: debugger
          [debugger_mod.c:224]: child_init(): rank is (-2)<br>
          kamailio             |  7(13) DEBUG: <core>
          [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2:
          app_python3 [ctl handler]<br>
          kamailio             |  7(13) DEBUG: app_python3
          [apy_kemi.c:234]: sr_apy_kemi_exec_func_ex(): execution of
          method: .info<br>
          kamailio             |  7(13) DEBUG: app_python3
          [apy_kemi.c:266]: sr_apy_kemi_exec_func_ex(): param[1] for:
          info is str: ===== kamailio.child_init(-2)<br>
          kamailio             | <br>
          kamailio             |  7(13) INFO: <core>
          [core/kemi.c:106]: sr_kemi_core_info(): =====
          kamailio.child_init(-2)<br>
          kamailio             |  7(13) DEBUG: ctl [ctl.c:329]:
          mod_child(): ctl: mod_child(0), fork_process=0,
          csl=0x556774893180<br>
          kamailio             |  7(13) DEBUG: ctl [ctl.c:336]:
          mod_child(): ctl: 0 io_listen_loop(1, 0x556774893180)<br>
          kamailio             |  7(13) INFO: ctl [io_listener.c:213]:
          io_listen_loop(): io_listen_loop:  using epoll_lt io watch
          method (config)<br>
          kamailio             |  7(13) DEBUG: ctl [io_listener.c:245]:
          io_listen_loop(): io_listen_loop: adding socket 8, type 2,
          transport 3 (/var/run/kamailio//kamailio_ctl)<br>
          kamailio             |  7(13) DEBUG: ctl
          [../../core/io_wait.h:374]: io_watch_add(): processing
          io_watch_add(0x7fe8f9aef380, 8, 2, 0x556774893180) - fd_no=0<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Running python 3.8.10 <br>
        </div>
        <div><br>
        </div>
        <div>using the suggested.<br>
        </div>
        <div>
          <pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(128,128,128);font-style:italic"># ----------------- setting module-specific parameters ---------------
</span><span style="color:rgb(128,128,128);font-style:italic">
</span><span style="color:rgb(128,128,128);font-style:italic"># ----- tm params -----
</span><span style="color:rgb(128,128,128);font-style:italic"># auto-discard branches from previous serial forking leg
</span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"failure_reply_mode"</span>, 3)
<span style="color:rgb(128,128,128);font-style:italic"># default retransmission timeout: 30sec
</span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"fr_timer"</span>, 30000)
<span style="color:rgb(128,128,128);font-style:italic"># default invite retransmission timeout after 1xx: 120sec
</span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"fr_inv_timer"</span>, 120000)

<span style="color:rgb(128,128,128);font-style:italic"># ----- debugger params -----
</span>modparam(<span style="color:rgb(106,135,89)">"debugger"</span>, <span style="color:rgb(106,135,89)">"cfgtrace"</span>, 1)

<span style="color:rgb(128,128,128);font-style:italic">####### Routing Logic ########
</span><span style="color:rgb(128,128,128);font-style:italic">
</span>modparam(<span style="color:rgb(106,135,89)">"app_python3"</span>, <span style="color:rgb(106,135,89)">"load"</span>, <span style="color:rgb(106,135,89)">"/opt/kamailio/etc/kamailio.py"</span>)

cfgengine <span style="color:rgb(106,135,89)">"python"a</span></pre>
        </div>
        <div>
          <div><br>
          </div>
          <div>
            <pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(204,120,50)">import </span>sys
<span style="color:rgb(204,120,50)">import </span>KSR <span style="color:rgb(204,120,50)">as </span>KSR


<span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">dumpObj</span>(obj):
    <span style="color:rgb(204,120,50)">for </span>attr <span style="color:rgb(204,120,50)">in </span><span style="color:rgb(136,136,198)">dir</span>(obj):
        KSR.info(<span style="color:rgb(106,135,89)">"obj.%s = %s</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">" </span>% (attr<span style="color:rgb(204,120,50)">, </span><span style="color:rgb(136,136,198)">getattr</span>(obj<span style="color:rgb(204,120,50)">, </span>attr)))


<span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">mod_init</span>():
    KSR.info(<span style="color:rgb(106,135,89)">"===== from Python mod init</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
    dumpObj(KSR)
    <span style="color:rgb(204,120,50)">return </span>kamailio()


<span style="color:rgb(204,120,50)">class </span>kamailio:
    <span style="color:rgb(204,120,50)">def </span><span style="color:rgb(178,0,178)">__init__</span>(<span style="color:rgb(148,85,141)">self</span>):
        KSR.info(<span style="color:rgb(106,135,89)">'===== kamailio.__init__</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">'</span>)

    <span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">child_init</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span>rank):
        KSR.info(<span style="color:rgb(106,135,89)">'===== kamailio.child_init(%d)</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">' </span>% rank)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">0
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_request_route</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== request - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        KSR.setdsturi(<span style="color:rgb(106,135,89)">"<a href="http://sip:alice@127.0.0.1:5080" moz-do-not-send="true">sip:alice@127.0.0.1:5080</a>"</span>)
        KSR.tm.t_on_branch(<span style="color:rgb(106,135,89)">"ksr_branch_route_one"</span>)
        KSR.tm.t_on_reply(<span style="color:rgb(106,135,89)">"ksr_onreply_route_one"</span>)
        KSR.tm.t_on_failure(<span style="color:rgb(106,135,89)">"ksr_failure_route_one"</span>)
        KSR.sl.send_reply(<span style="color:rgb(104,151,187)">100</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"Trying"</span>)
        <span style="color:rgb(204,120,50)">if </span>KSR.tm.t_relay() < <span style="color:rgb(104,151,187)">0 </span>:
            KSR.sl.send_reply(<span style="color:rgb(104,151,187)">500</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"Server error"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_reply_route</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== response - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_onsend_route</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== onsend route - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_branch_route_one</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== branch route - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_onreply_route_one</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== onreply route - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span><span style="color:rgb(104,151,187)">
</span><span style="color:rgb(104,151,187)">    </span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">ksr_failure_route_one</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(114,115,122)">msg</span>):
        KSR.info(<span style="color:rgb(106,135,89)">"===== failure route - from kamailio python script</span><span style="color:rgb(204,120,50)">\n</span><span style="color:rgb(106,135,89)">"</span>)
        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1
</span></pre>
          </div>
          <div><br>
          </div>
          <div>Any help is appreciated, thanks. <br>
          </div>
          <div><br>
          </div>
          <div><br>
            -- <br>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">- Nigel </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online: June 20-23, 2022
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
  </body>
</html>