name mode size
..
doc 040000
python_examples 040000
utils 040000
Makefile 100644 1.24kB
README 100644 4.16kB
README.TestCase-Loggers 100644 315B
app_python_mod.c 100644 13.26kB
app_python_mod.h 100644 1.03kB
apy_kemi.c 100644 75.73kB
apy_kemi.h 100644 1.3kB
apy_kemi_export.c 100644 181.68kB
apy_kemi_export.h 100644 1.24kB
mod_Core.c 100644 1.76kB
mod_Core.h 100644 1.06kB
mod_Logger.c 100644 6.07kB
mod_Logger.h 100644 1.07kB
mod_Ranks.c 100644 2.93kB
mod_Ranks.h 100644 1.06kB
mod_Router.c 100644 1.81kB
mod_Router.h 100644 1.11kB
msgobj_struct.h 100644 1.09kB
python_exec.c 100644 4.93kB
python_exec.h 100644 1.2kB
python_iface.c 100644 1.36kB
python_iface.h 100644 989B
python_msgobj.c 100644 13.58kB
python_msgobj.h 100644 1.08kB
python_support.c 100644 5.84kB
python_support.h 100644 1.15kB
README
app_python Module Maxim Sobolev Edited by Maxim Sobolev Copyright © 2010 Maxim Sobolev __________________________________________________________________ Table of Contents 1. Admin Guide 1. Overview 2. Dependencies 2.1. Kamailio Modules 2.2. External Libraries or Applications 3. Parameters 3.1. load (string) 3.2. script_name (string) 3.3. mod_init_function (string) 3.4. child_init_method (string) 4. Functions 4.1. python_exec(method [, args]) 5. RPC Commands 5.1. app_python.reload 5.2. app_python.api_list List of Examples 1.1. Set load parameter 1.2. Set mod_init_function parameter 1.3. Set child_init_method parameter 1.4. python_exec usage Chapter 1. Admin Guide Table of Contents 1. Overview 2. Dependencies 2.1. Kamailio Modules 2.2. External Libraries or Applications 3. Parameters 3.1. load (string) 3.2. script_name (string) 3.3. mod_init_function (string) 3.4. child_init_method (string) 4. Functions 4.1. python_exec(method [, args]) 5. RPC Commands 5.1. app_python.reload 5.2. app_python.api_list 1. Overview 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/'. 2. Dependencies 2.1. Kamailio Modules 2.2. External Libraries or Applications 2.1. Kamailio Modules The following modules must be loaded before this module: * none. 2.2. External Libraries or Applications The following libraries or applications must be installed before running Kamailio with this module loaded: * python-dev - Python devel library. 3. Parameters 3.1. load (string) 3.2. script_name (string) 3.3. mod_init_function (string) 3.4. child_init_method (string) 3.1. load (string) The path to the file with Python code to be executed from configuration file. Default value is “/usr/local/etc/kamailio/handler.py”. Example 1.1. Set load parameter ... modparam("app_python", "load", "/usr/local/etc/kamailio/myscript.py") ... 3.2. script_name (string) This is same as "load" parameter, kept for backward compatibility with the older versions of the module. 3.3. mod_init_function (string) The Python function to be executed by this module when it is initialized by Kamailio. Default value is “mod_init”. Example 1.2. Set mod_init_function parameter ... modparam("app_python", "mod_init_function", "my_mod_init") ... 3.4. child_init_method (string) The Python function to be executed by this module when a new worker process (child) is initialized by Kamailio. Default value is “child_init”. Example 1.3. Set child_init_method parameter ... modparam("app_python", "child_init_method", "my_child_init") ... 4. Functions 4.1. python_exec(method [, args]) 4.1. python_exec(method [, args]) 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. Both parameters can contain pseudo-variables. Example 1.4. python_exec usage ... python_exec("my_python_function"); python_exec("my_python_function", "my_params"); python_exec("my_python_function", "$rU"); ... 5. RPC Commands 5.1. app_python.reload 5.2. app_python.api_list 5.1. app_python.reload Marks the need to reload the Python script. The actual reload is done by each worker when the next Python method is invoked. Name: app_python.reload Parameters: none Example: ... kamcmd app_python.reload ... 5.2. app_python.api_list List the functions available via Kemi framework. Name: app_python.api_list Parameters: none Example: ... kamcmd app_python.api_list ...