Skip to content

Rust bindings for pjsip with examples. Install pjsua2 for python using pip

Notifications You must be signed in to change notification settings

tkang007/THE-PJPROJECT

 
 

Repository files navigation

THE PJPROJECT

Introduction

The PJPROJECT is a free and open source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.

Contents

  • Rust bindings for pjsua
  • Pip-installable pjsua2 python module
  • Installing pjsip on Debian
  • Pjsua usage examples in c and rust
  • Pjsua2 usage examples in c++ and python3
  • A ready to use docker image with pjsua and pjsua2 installed
  • A ready to use docker image with a dev kamailio sip server

Dependencies

  • For the Installation of pjsip on Debian, you need to install gcc, g++ and make
sudo apt install -y gcc g++ make
  • For generating the rust bindings for pjsau, you need to install rust and clang
sudo apt install -y curl clang
sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
  • For building the pjsua2 python module, you need to install python3, python3-dev and swig
sudo apt install -y swig python3 python3-dev

Installing pjsip on Debian

  • Navigate to pjproject directory
cd pjproject
  • Configure the build
./configure --enable-shared
  • Build the project
make dep
make
  • Install the project
sudo make install

Installing pjsua2 python module

  • Navigate to pjsua2 swig python directory
cd pjproject/pjsip-apps/src/swig/python
  • Build the module
make
  • Install the module
sudo make install

Installing pjsua2 python module using pip

sudo pip3 install git+https://github.com/JadKHaddad/THE-PJPROJECT.git --verbose

Running the examples

  • C
cd c
make
./out
make clean
  • C++
cd cpp
make
./out
make clean
  • Rust
cd rust
cargo run
cargo clean
  • Python3
cd python3
python3 main.py

Libraries not found?

  • Set the environment variable LD_LIBRARY_PATH to the directory where the libraries are located
export LD_LIBRARY_PATH=/usr/local/lib

Don't know where the libraries are located?

  • Run the following command to collect your libraries and headers
chmod u+x ./copy-lib-include.sh
./copy-lib-include.sh
  • Now you can set the environment variable LD_LIBRARY_PATH to the directory where the libraries are located

Don't have a sip server or Debian?

  • Create a docker network
docker network create net
  • Build and run the kamailio docker image
docker build -t kamailio5.5.0-trusty -f dockerfiles/Dockerfile.kamailio .

docker run -it --rm --name kamailio5.5.0-trusty --network net -p 5060:5060/udp kamailio5.5.0-trusty
  • Build and run the debian docker image
docker build -t pjsip -f dockerfiles/Dockerfile.debian .

docker run -it --rm --name pjsip --network net --add-host=host.docker.internal:host-gateway pjsip
  • Inside the pjsip container, run the examples using kamailio5.5.0-trusty:5060 as a sip domain

References

Notes

  • pjproject downloaded from the official release page in version 2.13 on 2022-12-06
  • PJSUA_MAX_CALLS, PJSUA_MAX_ACC, PJSUA_MAX_PLAYERS and PJSUA_MAX_RECORDERS are set in pjproject/pjsip/include/pjsua-lib/pjsua.h to 32. You can change them to any value less than 32 to save memory.
  • PJ_IOQUEUE_MAX_HANDLES is set in pjproject/pjlib/include/pj/config.h to 128.
  • RTP_RETRY is set in pjproject/pjsip/src/pjsua-lib/pjsua_media.c to 10000 to try bind to 5000 ports when establishing calls.
  • You have to recompile the project after changing any value.

About

Rust bindings for pjsip with examples. Install pjsua2 for python using pip

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 81.6%
  • C++ 8.9%
  • Python 3.1%
  • Shell 2.1%
  • Objective-C 1.6%
  • Makefile 0.6%
  • Other 2.1%