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 ?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With