本文介绍了如何为Python安装pjsua2软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Python创建软件电话.我发现此链接描述了pjsua2 ,但没有任何明确的说明定义如何为python安装pjsua2软件包的步骤.

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.

任何人都可以为我定义安装可在python中使用的pjsua2的清晰步骤吗?

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

推荐答案

这些步骤应该有效

第1步:创建目录. /PJSUA2/pjproject/src

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

第2步:安装所需的模块

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

第3步:下载源代码svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject

第4步:编译主库并安装.如果要在RPI上尝试,请参考此链接.基本上,您需要设置适当的CFLAGS并确保为您的平台正确配置了third_party/build/os-auto.mak.in.

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

第5步:编译并安装python模块.再次确保您具有正确的user.mak(如果要针对RPI进行编译

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

第6步:检查已安装的模块

Step 6: Check installed module

$ python
> import pjsua2

此处完全提到了这些步骤,除了RPI扭曲

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

更新#1:

并且不要忘记设置ep_cfg.uaConfig.threadCnt = 0,否则您将得到Segmentation fault.因此,PJSUA2页面中的示例代码将有所更改

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)

这篇关于如何为Python安装pjsua2软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 17:21