<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">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 ---------------<br></span><span style="color:rgb(128,128,128);font-style:italic"><br></span><span style="color:rgb(128,128,128);font-style:italic"># ----- tm params -----<br></span><span style="color:rgb(128,128,128);font-style:italic"># auto-discard branches from previous serial forking leg<br></span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"failure_reply_mode"</span>, 3)<br><span style="color:rgb(128,128,128);font-style:italic"># default retransmission timeout: 30sec<br></span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"fr_timer"</span>, 30000)<br><span style="color:rgb(128,128,128);font-style:italic"># default invite retransmission timeout after 1xx: 120sec<br></span>modparam(<span style="color:rgb(106,135,89)">"tm"</span>, <span style="color:rgb(106,135,89)">"fr_inv_timer"</span>, 120000)<br><br><span style="color:rgb(128,128,128);font-style:italic"># ----- debugger params -----<br></span>modparam(<span style="color:rgb(106,135,89)">"debugger"</span>, <span style="color:rgb(106,135,89)">"cfgtrace"</span>, 1)<br><br><span style="color:rgb(128,128,128);font-style:italic">####### Routing Logic ########<br></span><span style="color:rgb(128,128,128);font-style:italic"><br></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>)<br><br>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<br><span style="color:rgb(204,120,50)">import </span>KSR <span style="color:rgb(204,120,50)">as </span>KSR<br><br><br><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">dumpObj</span>(obj):<br>    <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):<br>        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)))<br><br><br><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">mod_init</span>():<br>    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>)<br>    dumpObj(KSR)<br>    <span style="color:rgb(204,120,50)">return </span>kamailio()<br><br><br><span style="color:rgb(204,120,50)">class </span>kamailio:<br>    <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>):<br>        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>)<br><br>    <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):<br>        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)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">0<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        KSR.setdsturi(<span style="color:rgb(106,135,89)">"<a href="http://sip:alice@127.0.0.1:5080">sip:alice@127.0.0.1:5080</a>"</span>)<br>        KSR.tm.t_on_branch(<span style="color:rgb(106,135,89)">"ksr_branch_route_one"</span>)<br>        KSR.tm.t_on_reply(<span style="color:rgb(106,135,89)">"ksr_onreply_route_one"</span>)<br>        KSR.tm.t_on_failure(<span style="color:rgb(106,135,89)">"ksr_failure_route_one"</span>)<br>        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>)<br>        <span style="color:rgb(204,120,50)">if </span>KSR.tm.t_relay() < <span style="color:rgb(104,151,187)">0 </span>:<br>            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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></span><span style="color:rgb(104,151,187)"><br></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>):<br>        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>)<br>        <span style="color:rgb(204,120,50)">return </span><span style="color:rgb(104,151,187)">1<br></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>