- Note:
- This Python module has been deprecated. Please use the newer tutorial instead
Getting Started
The Python language binding for PJSUA-API is available in PJSIP release 0.5.10 or later.
What is it?
py_pjsua is a Python module implemented in C language to provide PJSUA-API for Python applications. Using py_pjsua enables Python application to exploit the features of PJSIP, for example:
- multiple SIP accounts
- SIP for presence (SIMPLE) and instant messaging
- multiple/unlimited calls
- call hold and transfer (attended or unattended)
- DTMF support
- conferencing with multiple/unlimited sources
- wideband and ultra-wideband audio support
- WAV files playback, playlist, and recording
- adaptive jitter buffer, silence detection, packet lost concealment, etc.
- tone generation
- multiple sound devices (planned)
- ICE support (planned)
- and so on.
Status
The py_pjsua module has just been released on 0.5.10 version and therefore it's expected to contain few bugs, so it's still in alpha/beta stage.
Also since the Python abstraction is created manually (rather than using automated Python abstraction generation tools), it is expected that there will be time lag between introduction of new API in PJSUA-API (the C API) and the implementation in the Python module.
Building py_pjsua Module
Using Microsoft Visual Studio projects:
- Open pjsip-apps.dsw from pjsip-apps\build directory.
- Select py_pjsua project.
- Build the project
- The Python module will be placed in pjsip-apps\lib directory.
Using Python build script:
- Go to pjsip-apps/src/py_pjsua directory.
- Run 'python ./setup.py build'
- The Python module will be placed in build directory inside current directory.
- Alternatively run 'python ./setup.py install' to install the py_pjsua module to Python's site_packages directory.
Developing Python SIP Application
Introduction
The Python API is pretty much the same like PJSUA-API - each Python function corresponds to one function in PJSUA-API, therefore one can use PJSUA-API Documentation or PJSUA Tutorial to learn about the Python API.
To highlight the similarities between PJSUA-API and the py_pjsua API, below are some sample names:
PJSUA-API: py_pjsua API: #include <pjsua-lib/pjsua.h> ==> import py_pjsua pjsua_create() ==> py_pjsua.create() pjsua_init() ==> py_pjsua.init() pjsua_call_make_call() ==> py_pjsua.call_make_call()
Sample Application
Please see pjsua_app.py for a sample/simple Python application.
Documentation
The documentation for the Python module is integrated with PJSUA-API Documentation. Please follow the step by step on how to use the API there, as well as specific instructions to use each PJSUA feature.