1.openssl-1.0.1t
./config shared --prefix=/opt/voip/ssl
make depend && make
make install
2.SDL2-2.0.4.tar
./configure --prefix=/opt/voip/sdl
make && make install
3. Installation of yasm-1.3.0
Install yasm by running the following commands:
sed -i 's#) ytasm.*#)#' Makefile.in &&
./configure --prefix=/usr &&
make
To test the results, issue: make check.
Now, as the root user:
make install
4.1 libx264
./configure --prefix=/opt/voip/libx264/ --enable-static --enable-shared
make
make install
4.2 openh264-1.5.0(pjproject-2.5.5尚不支持openh264-1.6.0,据说2.6x之后会支持)
(yum install nasm)
修改openh264-1.5.0目录下的Makefile中PREFIX的值
PREFIX=/opt/voip/openh264/
make
make install
试过openh264-1.4.0~openh264-1.6.0三个版本都不能在pjproject-2.5.5编译通过,报诸如以下的错误
/src/pjmedia-codec/openh264.cpp:474:10: error: ‘SEncParamExt’ has no member named ‘iInputCsp’
查找pjproject官网获悉pjproject-2.5.5尚不支持openh264-1.6.0,据说2.6x之后会支持,可能目前只支持openh264-1.0.0
因此放弃openh264,改用ffmpeg+x264方案
5.ffmpeg-3.1.1.tar(depend on yasm and libx264)
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/voip/libx264/lib/pkgconfig:/opt/voip/ssl/lib/pkgconfig:/opt/voip/sdl/lib/pkgconfig
./configure --prefix=/opt/voip/ffmpeg --enable-shared --enable-gpl --enable-libx264
6. libv4l-dev
sudo apt-get install libv4l-dev
7. pjproject-2.5.5.tr
在/home/user/.bashrc中加入下面几行
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/voip/ffmpeg/lib/pkgconfig:/opt/voip/libx264/lib/pkgconfig:/opt/voip/ssl/lib/pkgconfig:/opt/voip/sdl/lib/pkgconfig
export PATH=$PATH:/opt/voip/ffmpeg/bin:/opt/voip/sdl/bin:/opt/voip/ssl/bin:/opt/voip/libx264/bin
export LIBRARY_PATH=/opt/voip/ffmpeg/lib:/opt/voip/sdl/lib:/opt/voip/ssl/lib:/opt/voip/libx264/lib
export LD_LIBRARY_PATH=/opt/voip/ffmpeg/lib:/opt/voip/sdl/lib:/opt/voip/ssl/lib:/opt/voip/libx264/lib
export C_INCLUDE_PATH=/opt/voip/ffmpeg/include:/opt/voip/sdl/include:/opt/voip/ssl/include:/opt/voip/libx264/include
让添加的环境变量生效
source .bashrc
配置pjproject
./configure --prefix=/opt/voip/pjsip --with-sdl=/opt/voip/sdl --with-ffmpeg=/opt/voip/ffmpeg --with-ssl=/opt/voip/ssl
修改pjmedia下的config.h
将宏定义PJMEDIA_HAS_VIDEO和PJMEDIA_HAS_FFMPEG的值改为1
make dep && make clean && make
(fatal error: alsa/asoundlib.h: No such file or directory
apt-get install libasound2-dev
[cent os]yum -y install alsa-lib-devel
)
8.测试
cd pjsip-apps/bin
新建t1.cfg文件,内容如下
# This is a comment in the config file.
--local-port 4966
--auto-answer 200
--ptime 100
--id sip:
[email protected]
--registrar sip:192.168.1.123;transport=tls
--use-tls
--realm *
--username 12345
--password 12345
--use-ice
--ice-regular
--ice-no-rtcp
--jb-max-size 300
--log-file=1.txt
--video
./pjsua-x86_64-unknown-linux-gnu --config-file t1.cfg
注册成功则可以进行通话测试
参考资料
http://www.mr-wu.cn/how-to-compile-ffmpeg-x264-and-pjsip-on-ubuntu-14-04-for-voip/
http://www.linuxidc.com/Linux/2011-10/45738.htm