This module is an alternative 'app_python3' module with static export of 'KSR' object and functions, without instantiating the SIP message object. This module cannot be loaded together with 'app_python3' as some global symbols conflict. This module allows executing Python3 scripts from the config file, exporting functions to access the SIP message from Python3. Note: if symbols exported to KEMI (module or function names) conflict with Python's reserved keywords, use the 'getattr()' function or the '__dict__' attribute for 'KSR' (e.g., 'KSR.__dict__["async"].task_route("myroute")').
| Parámetro | Tipo | Descripción |
|---|---|---|
| load | string | 3.2. script_init (string) 3.3. script_child_init (string) 3.4. threads_mode (int) |
| script_init | string | 3.3. script_child_init (string) 3.4. threads_mode (int) |
| script_child_init | string | 3.4. threads_mode (int) |
| threads_mode | int | 3.1. load (string) |
| load | string | The path to the file with Python code to be executed from configuration file. |
| script_init | string | The name of the Python function to be executed when the script is loaded or reloaded. |
| script_child_init | string | The name of the Python function to be executed when Kamailio forks child processes at startup and when the script is reloaded. |
| threads_mode | int | Control how locking for Python interpreter threads in done. If set to 1, use Py_BLOCK_THREADS/Py_UNBLOCK_THREADS (new mode added for v6.0.x). If set to 0, use PyGILState_Ensure()/PyGILState_Release() |
4.1. app_python3s_exec(method [, param])
Execute the Python function with the name given by the parameter 'method'. Optionally can be provided a second string with the parameter to be passed to the Python function.
Copyright © 2022 kamailio.org