From 0f36ffb2c5a5cd21761c0e8edea7ef66cbab9477 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 5 Dec 2022 15:53:56 +0100 Subject: [PATCH] app_python3s: docs for script_init parameter --- .../app_python3s/doc/app_python3s_admin.xml | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/modules/app_python3s/doc/app_python3s_admin.xml b/src/modules/app_python3s/doc/app_python3s_admin.xml index 90bd17393e6..6d7af04a608 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") - +
+ <varname>script_init</varname> (string) + + The name of the Python function to be executed when the script is + loaded or reloaded. + + + + Default value is (not set). + + + + Set <varname>script_init</varname> parameter + +... +modparam("app_python3s", "script_init", "ksr_script_init") +... +def ksr_script_init(): + KSR.info("init python script\n") + return 1 +... + + +
@@ -170,7 +193,7 @@ app_python3s_exec("my_python_function", "$rU"); 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: ... @@ -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: https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/ -