From cf77d88069407512c7d2ff234607ab6e3fc9c784 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 3 Dec 2015 12:31:01 +0100 Subject: [PATCH] app_python: basic documentation for params and functions - based on quick look at the code (cherry picked from commit e2853a8ac22bc26d47153731f65479f03a756c52) --- modules/app_python/doc/app_python_admin.xml | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/app_python/doc/app_python_admin.xml b/modules/app_python/doc/app_python_admin.xml index 56aa4df2e84..ef726c4664a 100644 --- a/modules/app_python/doc/app_python_admin.xml +++ b/modules/app_python/doc/app_python_admin.xml @@ -20,6 +20,11 @@ This module allows executing Python scripts from config file, exporting functions to access the SIP message from Python. + + For some basic examples of Python scripts that can be used with + this module, look at the files inside source tree located at + 'modules/app_python/python_examples/'. +
Dependencies @@ -56,18 +61,19 @@
<varname>script_name</varname> (string) - TBD. + The path to the fiel with Python code to be executed + from configuration file. - Default value is /usr/local/etc/sip-router/handler.py. + Default value is /usr/local/etc/kamailio/handler.py. Set <varname>script_name</varname> parameter ... -modparam("app_python", "script_name", "/usr/local/etc/sip-router/myscript.py") +modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py") ... @@ -76,7 +82,8 @@ modparam("app_python", "script_name", "/usr/local/etc/sip-router/myscript.py")
<varname>mod_init_function</varname> (string) - TBD. + The Python function to be executed by this module when + it is initialied by &kamailio;. @@ -96,7 +103,8 @@ modparam("app_python", "mod_init_function", "my_mod_init")
<varname>child_init_method</varname> (string) - TBD. + The Python function to be executed by this module when + a new worker process (child) is initialied by &kamailio;. @@ -119,17 +127,19 @@ modparam("app_python", "child_init_method", "my_child_init") Functions
- <function moreinfo="none">python_exec(method [, mystr])</function> + <function moreinfo="none">python_exec(method [, args])</function> - TBD. + Execute the Python function with the name given by the parameter 'method'. + Optionally can be provided a second string with parameters to be passed + to the Python function. <function>python_exec</function> usage ... -python_exec("..."); -python_exec("...", "..."); +python_exec("my_python_function"); +python_exec("my_python_function", "my_params"); ...