Skip to content

Commit

Permalink
app_python3s: docs for script_init parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Dec 5, 2022
1 parent 4ccd501 commit 0f36ffb
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/modules/app_python3s/doc/app_python3s_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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">
...
Expand All @@ -179,7 +202,7 @@ import mod1
import modN
from importlib import reload

def mod_init():
def ksr_script_init():
reload(mod1)
...
reload(modN)
Expand Down Expand Up @@ -231,7 +254,6 @@ cfgengine "python"
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>
</para>

</section>

</chapter>
Expand Down

0 comments on commit 0f36ffb

Please sign in to comment.