|
@@ -104,7 +104,30 @@ modparam("app_python3s", "load", "/usr/local/etc/kamailio/myscript.py")
|
|
</programlisting>
|
|
</programlisting>
|
|
</example>
|
|
</example>
|
|
</section>
|
|
</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>
|
|
|
|
|
|
<section>
|
|
<section>
|
|
@@ -170,7 +193,7 @@ app_python3s_exec("my_python_function", "$rU");
|
|
<para>
|
|
<para>
|
|
Note that reload is done for the Python script provided as parameter
|
|
Note that reload is done for the Python script provided as parameter
|
|
to this &kamailio; module. To reload the Python libraries imported
|
|
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>
|
|
</para>
|
|
<programlisting format="linespecific">
|
|
<programlisting format="linespecific">
|
|
...
|
|
...
|
|
@@ -179,7 +202,7 @@ import mod1
|
|
import modN
|
|
import modN
|
|
from importlib import reload
|
|
from importlib import reload
|
|
|
|
|
|
-def mod_init():
|
|
|
|
|
|
+def ksr_script_init():
|
|
reload(mod1)
|
|
reload(mod1)
|
|
...
|
|
...
|
|
reload(modN)
|
|
reload(modN)
|
|
@@ -231,7 +254,6 @@ cfgengine "python"
|
|
For more details about KEMI, see:
|
|
For more details about KEMI, see:
|
|
<ulink url="https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/">https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/</ulink>
|
|
<ulink url="https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/">https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/</ulink>
|
|
</para>
|
|
</para>
|
|
-
|
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
</chapter>
|
|
</chapter>
|