SIP - pjsip Linux & Windows 编译安装
PJSIP是一个包含了SIP、SDP、RTP、RTCP、STUN、ICE等协议实现的开源库, 并集成了丰富的pjsip示例与 softphone pjsua 命令行工具.
此文仅用于Linux&Windows平台编译&安装测试SIP信令使用.
Linux 编译&安装
https://github.com/pjsip/pjproject/releases
libx264
$ git clone https://code.videolan.org/videolan/x264.git
$ cd x264 && mkdir build && cd build
$ ./configure --enable-static --prefix=/usr --libdir=/usr/lib64
$ make && make install-lib-static
ffmpeg
http://ffmpeg.org/
$ git clone git://source.ffmpeg.org/ffmpeg.git
$ cd ffmpeg && mkdir build && cd build
$ ../configure --disable-shared --enable-static --enable-gpl --enable-libx264 --prefix=/usr --libdir=/usr/lib64
$ make && make install
$ git cl
one https://github.com/pjsip/pjproject
$ cd pjproject && git checkout 2.9 -b 2.9
$ ./configure --enable-static --prefix=/usr
$ touche pjlib/include/pj/config_site.h
$ make -j dep
$ make -j install
Windows VS2019 编译&安装
修改平台工具集
pjsip 默认使用VS2015编译工程, Alt+Enter
修改工程属性 平台工具集
为 Visutal Studio 2019 (v142)
即可.
SDL
https://www.libsdl.org/release/SDL2-devel-2.0.16-VC.zip
FFMPEG
https://www.gyan.dev/ffmpeg/builds/
下载 build-shared 版本
编译
编辑pjlib 配置 pjlib\include\pj\config_site.h
:
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_VIDEO_DEV_HAS_SDL 1
#define PJMEDIA_HAS_FFMPEG 1
将SDL2
& FFMPEG
include
与lib
目录分别加入 pjmedia_videodev/pjmedia/pjmedia_codec/pjsua
VC++ 包含目录与库目录, 注意x86和x64分别对应不同的文件. 这里选择 release
与 x64
编译 pjsua
即可
pjsua
pjsua 是基于 pjsip 的命令行 SIP user agent(sofphone), 可直接用于测试 SIP 信令&拨打VOIP.
示例:
直接发起INVITE:
pjsip sip:192.168.22.42
注册&认证&发起 INVITE:
pjsip-apps\bin\pjsua-x86_64-x64-vc14-Release --id sip:9001@192.168.22.42:5060 --registrar sip:192.168.22.42:5060 --username 9001 --password 1234 --realm '*' --auto-play sip:9664@192.168.22.42