← Volver al índice de módulos

app_python3s

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_pytho
⚙️ Scripting e Integración Kamailio 6.1 8 parámetros 2 funciones

Descripción general

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")').

Documentación oficial: https://www.kamailio.org/docs/modules/stable/modules/app_python3s.html
Código fuente: https://github.com/kamailio/kamailio/tree/master/src/modules/app_python3s

Parámetros de configuración

ParámetroTipoDescripció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()

Funciones exportadas

app_python3s_exec(method [, param])

4.1. app_python3s_exec(method [, param])

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.

Autores y contribuidores

Daniel-Constantin MierlaMaxim SobolevAnthony Alba

Copyright © 2022 kamailio.org

Módulos relacionados

app_lua app_perl app_python app_python3 app_ruby app_ruby_proc async evapi