Module: kamailio
Branch: master
Commit: 0f36ffb2c5a5cd21761c0e8edea7ef66cbab9477
URL:
https://github.com/kamailio/kamailio/commit/0f36ffb2c5a5cd21761c0e8edea7ef6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-12-05T15:53:56+01:00
app_python3s: docs for script_init parameter
---
Modified: src/modules/app_python3s/doc/app_python3s_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/0f36ffb2c5a5cd21761c0e8edea7ef6…
Patch:
https://github.com/kamailio/kamailio/commit/0f36ffb2c5a5cd21761c0e8edea7ef6…
---
diff --git a/src/modules/app_python3s/doc/app_python3s_admin.xml
b/src/modules/app_python3s/doc/app_python3s_admin.xml
index 90bd17393e..6d7af04a60 100644
--- a/src/modules/app_python3s/doc/app_python3s_admin.xml
+++ b/src/modules/app_python3s/doc/app_python3s_admin.xml
@@ -104,7 +104,30 @@ modparam("app_python3s", "load",
"/usr/local/etc/kamailio/myscript.py")
</programlisting>
</example>
</section>
-
+ <section id="app_python3s.p.load">
+ <title><varname>script_init</varname> (string)</title>
+ <para>
+ The name of the Python function to be executed when the script is
+ loaded or reloaded.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote></quote> (not set).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>script_init</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("app_python3s", "script_init", "ksr_script_init")
+...
+def ksr_script_init():
+ KSR.info("init python script\n")
+ return 1
+...
+</programlisting>
+ </example>
+ </section>
</section>
<section>
@@ -170,7 +193,7 @@ app_python3s_exec("my_python_function", "$rU");
<para>
Note that reload is done for the Python script provided as parameter
to this &kamailio; module. To reload the Python libraries imported
- in this script, use something like:
+ in this script, leverage "script_init" and use something like:
</para>
<programlisting format="linespecific">
...
@@ -179,7 +202,7 @@ import mod1
import modN
from importlib import reload
-def mod_init():
+def ksr_script_init():
reload(mod1)
...
reload(modN)
@@ -231,7 +254,6 @@ cfgengine "python"
For more details about KEMI, see:
<ulink
url="https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-frame…
</para>
-
</section>
</chapter>