%docentities; ]> &adminguide;
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/'.
Dependencies
&kamailio; Modules The following modules must be loaded before this module: none.
External Libraries or Applications The following libraries or applications must be installed before running &kamailio; with this module loaded: python-dev - Python devel library.
Parameters
<varname>script_name</varname> (string) The path to the fiel with Python code to be executed from configuration file. Default value is /usr/local/etc/kamailio/handler.py. Set <varname>script_name</varname> parameter ... modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py") ...
<varname>mod_init_function</varname> (string) The Python function to be executed by this module when it is initialied by &kamailio;. Default value is mod_init. Set <varname>mod_init_function</varname> parameter ... modparam("app_python", "mod_init_function", "my_mod_init") ...
<varname>child_init_method</varname> (string) The Python function to be executed by this module when a new worker process (child) is initialied by &kamailio;. Default value is child_init. Set <varname>child_init_method</varname> parameter ... modparam("app_python", "child_init_method", "my_child_init") ...
Functions
<function moreinfo="none">python_exec(method [, args])</function> 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("my_python_function"); python_exec("my_python_function", "my_params"); ...