Table of Contents
List of Examples
Table of Contents
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/'.
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") ...
This is same as "load" parameter, kept for backward compatibility with the older versions of the module.
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"); ...
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 ...