Daniel-Constantin Mierla c59effe36d app_python: readme regenerated 9 سال پیش
..
doc a5de6b2b6a app_python: basic documentation for params and functions 9 سال پیش
python_examples cc9b6cad11 mod_python: Changed Loggers.py to use recent changes (python abstraction layers). 12 سال پیش
Makefile 5e886dbbef all: OPENSER_MOD_INTERFACE replaced with KAMAILIO_MOD_INTERFACE 13 سال پیش
README c59effe36d app_python: readme regenerated 9 سال پیش
README.TestCase-Loggers acbeda46ac app_python: expand log facilities 13 سال پیش
mod_Core.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Core.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Logger.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Logger.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Ranks.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Ranks.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Router.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
mod_Router.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_exec.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_exec.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_iface.c ca60c77acd app_python Avoid collission in name space - rename init_modules to ap_init_modules 11 سال پیش
python_iface.h ca60c77acd app_python Avoid collission in name space - rename init_modules to ap_init_modules 11 سال پیش
python_mod.c 3f297f6bbb app_python: use NAME compile flag for default path to the script 9 سال پیش
python_mod.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_msgobj.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_msgobj.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_support.c 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش
python_support.h 9e1ff4488a all: updated FSF address in GPL text 11 سال پیش

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. script_name (string)
3.2. mod_init_function (string)
3.3. child_init_method (string)

4. Functions

4.1. python_exec(method [, args])

List of Examples

1.1. Set script_name 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. script_name (string)
3.2. mod_init_function (string)
3.3. child_init_method (string)

4. Functions

4.1. python_exec(method [, args])

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. script_name (string)
3.2. mod_init_function (string)
3.3. child_init_method (string)

3.1. script_name (string)

The path to the fiel with Python code to be executed from configuration
file.

Default value is "/usr/local/etc/kamailio/handler.py".

Example 1.1. Set script_name parameter
...
modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py")
...

3.2. mod_init_function (string)

The Python function to be executed by this module when it is initialied
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.3. child_init_method (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".

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.

Example 1.4. python_exec usage
...
python_exec("my_python_function");
python_exec("my_python_function", "my_params");
...