How to install pjsua2 packages for python?

回眸只為那壹抹淺笑 提交于 2020-06-11 05:31:58

问题


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 ?


回答1:


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)



回答2:


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?




回答3:


Usually you just need to go to your Command Line and type in :

pip install [packagename]

So, in this case, its probably:

pip install pjsua2

Then just import pjsua2 in python



来源:https://stackoverflow.com/questions/53736284/how-to-install-pjsua2-packages-for-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!