How to install pjsua2 packages for python?
Asked Answered
H

3

7

I am trying to create softphone using Python. I found this link describing pjsua2 but there are no any clear steps that define how to install pjsua2 package for python.

Can any one please define me clear steps on installing pjsua2 that can be used in python ?

Hakodate answered 12/12, 2018 at 4:51 Comment(0)
S
9

These steps shall work

Step1: Create a directory. /PJSUA2/pjproject/src

Step2: install required modules

sudo apt-get install libasound2-dev libssl-dev libv4l-dev libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libx264-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libavresample-dev libavutil-dev libavcodec-extra libopus-dev libopencore-amrwb-dev libopencore-amrnb-dev libvo-amrwbenc-dev subversion

Step 3: Download source code svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject

Step 4: Compile main library and install. If you are trying it on RPI, refer to this link. Basically you need to set proper CFLAGS and ensure third_party/build/os-auto.mak.in is properly configured for your platform.

$ cd pjproject
$ ./configure  --enable-shared
$ make dep
$ make
$ sudo make install

Step 5: Compile and install python module. Again ensure you have proper user.mak, if you are compiling it for RPI

$ cd pjsip-apps/src/swig/
$ make
$ make install

Step 6: Check installed module

$ python
> import pjsua2

These steps are exactly mentioned here, except for that RPI twist

Update #1:

And dont forget to set ep_cfg.uaConfig.threadCnt = 0, else you will get Segmentation fault. So the sample code in PJSUA2 page shall have change

 def pjsua2_test():
  # Create and initialize the library
  ep_cfg = pj.EpConfig()

  ep_cfg.uaConfig.threadCnt = 0; #Python does not like PJSUA2's thread. It will result in segment fault
  ep = pj.Endpoint()
  ep.libCreate()
  ep.libInit(ep_cfg)
Shizukoshizuoka answered 29/12, 2018 at 10:27 Comment(1)
Windows 10: installed msys2 64bit, chose 64bit mingw-w64, ActiveState python36 (not msys2 python36), jdk-14, msys2 swig, editing cygwincompiler.py to return [] for unrecognized MSVER, added python36 and jdk/bin to path, and it built! Then DLL errors, but using dependency walker found all the pjsip DLLs and made sure they were in the path... success!Bousquet
A
1

#System details freshly build

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal



$ sudo apt-get install libasound2-dev libssl-dev libv4l-dev libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libx264-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libavresample-dev libavutil-dev libavcodec-extra libopus-dev libopencore-amrwb-dev libopencore-amrnb-dev libvo-amrwbenc-dev subversion python2.7-dev gcc build-essential 

$ wget https://github.com/pjsip/pjproject/archive/refs/tags/2.13.tar.gz && tar -xzvf 2.13.tar.gz && rm 2.13.tar.gz
$ cd pjproject-2.13
$ ./configure  --enable-shared
$ make dep
$ make
$ make install
$ cd pjsip-apps/src/python/
$ python2.7 setup.py install
$ cd

Now test installation of module

$ python2.7

run this inside shell

import pjsua

Check version of module

$ cat /usr/local/lib/python2.7/dist-packages/pjsua-2.13.egg-info
Andesine answered 24/4, 2023 at 16:17 Comment(0)
C
0

The steps look like they are listed here: https://trac.pjsip.org/repos/wiki/Python_SIP/Build_Install

I ran through them and they seemed to work without any problem on Mac Os X. What as the exact issue you were running into?

Condemn answered 12/12, 2018 at 4:56 Comment(2)
If you look clear fully then those are the steps for pjsua not pjsua2.Hakodate
ahh you're right. apologies. I was trying that instruction set again and replacing it with pjsua2 and yup that didn't really workCondemn

© 2022 - 2024 — McMap. All rights reserved.