Browse Source

app_python3s: docs for script_init parameter

Daniel-Constantin Mierla 2 years ago
parent
commit
0f36ffb2c5
1 changed files with 26 additions and 4 deletions
  1. 26 4
      src/modules/app_python3s/doc/app_python3s_admin.xml

+ 26 - 4
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-framework/">https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/</ulink>
             </para>
-
 	</section>
 
 </chapter>