0x00.简介
官网地址:https://www.h323plus.org
项目地址:
https://github.com/willamowius/h323plus
https://github.com/willamowius/ptlib
几个参考链接
H323plus的编译、安装、配置和使用
编译SDL那点事
linux下h323plus简单使用
编译H323plus
H323plus的学习与使用:编译、安装、sample、H.264插件、安装教程总结
0x01.部署环境
宿主机环境为CentOS7-x86_64-Minimal2003
0x02.环境准备
1.防火墙的配置
在实验环境中可以选择直接禁用防火墙,但是在生产环境中根据实际的需求进行规则的配置。
关闭firewalld
在CentOS7上面防火墙是firewalld服务,停止并且禁止开机启动firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
关闭 selinux
setenforce 0
getenforce
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
grep SELINUX=disabled /etc/sysconfig/selinux
2.基础工具环境
yum clean all
yum make cache
yum install -y gcc gcc-c++ make unzip zip git wget flex bison autoconf automake pkg-config
0x03.软件安装
1.安装依赖环境
yum install -y libstdc++ libvorbis libvpx libogg libtheora freetype libjpeg-turbo
yum install -y yasm zlib bzip2 faac lame speex x264 XviD openjpeg15 opencore-amr
2.安装libsdl
本文安装选择的是SDL-1.2.15版本。
源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install)。
- SDL-1.2.15版本安装说明
下载SDL-1.2.15
wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar -xvf SDL-1.2.15.tar.gz
配置与编译:Install SDL by running the following commands:
cd SDL-1.2.15
sed -e '/_XData32/s:register long:register _Xconst long:' \
-i src/video/x11/SDL_x11sym.h &&
./configure --prefix=/usr --disable-static &&
make
然后安装:Now, as the root user:
make install &&
install -v -m755 -d /usr/share/doc/SDL-1.2.15/html &&
install -v -m644 docs/html/*.html \
/usr/share/doc/SDL-1.2.15/html
测试安装结果
cd test &&
./configure &&
make
结束,进入下一个部分,下载H323和ptlib
- SDL2-2.0.12版本安装说明
下载SDL2-2.0.12
wget http://www.libsdl.org/release/SDL2-2.0.12.tar.gz
配置与编译:Install SDL by running the following commands:
./configure --prefix=/usr &&
make
If you have Doxygen-1.8.20 installed and want to build the html documentation, run the following commands:
pushd docs &&
doxygen &&
popd
然后安装:Now, as the root user:
make install &&
rm -v /usr/lib/libSDL2*.a
If you built the documentation, install it as the root user:
install -v -m755 -d /usr/share/doc/SDL2-2.0.12/html &&
cp -Rv docs/output/html/* /usr/share/doc/SDL2-2.0.12/html
0x04.下载h323plus和ptlib
打开H323的官网,进入Download下载页面,找到H.323 Plus (Linux),下载H.323 Plus Core 和PTLib (req)
Linux
cd
wget https://github.com/willamowius/h323plus/archive/v1_27_1.tar.gz
wget https://github.com/willamowius/ptlib/archive/v2_10_9_3.tar.gz
0x05.安装h323plus和ptlib
源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install)。
1.解压文件
tar -xvf ptlib-v2_10_9_3.tar.gz
tar -xvf h323plus-v1_27_1.tar.gz
2.移动文件
移动ptlib至h323plus文件夹
mv ./ptlib/ ./h323plus/
3.安装ptlib
配置编译安装ptlib
cd /root/h323plus/ptlib
./configure --enable-SDL
make && make install
4.安装h323
配置编译安装h323
cd /root/h323plus
./configure
make && make install
5.视频编码插件
配置编译安装视频编码插件plugins
cd /root/h323plus/plugins
./configure --enable-SDL
make && make install
6.编译simple
进入samples/simple,开始编译
cd /root/h323plus/samples/simple
make
ls
操作情况如下
[root@host ~]# cd /root/h323plus/samples/simple
[root@host simple]# make
[CC] main.cxx
[LD] obj_linux_x86_64/simph323
[root@host simple]# ls
main.cxx Makefile simple_2005.vcproj simple_2010.vcxproj simple_2015.vcxproj simple.cbp
main.h obj_linux_x86_64 simple_2008.vcproj simple_2012.vcxproj simple_2015.vcxproj.filters
[root@host simple]#
0x06.运行sample
1.运行
cd /root/h323plus/samples/simple/obj_linux_x86_64
ls
./simph323 -n -l
运行simph323结果如下:
[root@host obj_linux_x86_64]# ls
main.o simph323
[root@host obj_linux_x86_64]# ./simph323 -n -l
./simph323: error while loading shared libraries: libh323_linux_x86_64_.so.1.27.1: cannot open shared object file: No such file or directory
[root@host obj_linux_x86_64]#
2.报错如下
./simph323: error while loading shared libraries: libh323_linux_x86_64_.so.1.27.1: cannot open shared object file: No such file or directory
解决方式参考链接
3.处理报错
观察h323plus编译安装过程:
echo "*** 'make install' is usually a bad idea, use 'make optnoshared' and point OPENH323DIR to your source dir ***"
*** 'make install' is usually a bad idea, use 'make optnoshared' and point OPENH323DIR to your source dir ***
mkdir -p /usr/local//lib
rm -f /usr/local//lib/libh323_*_r.so*
/usr/bin/install -c -m 444 lib/libh323_linux_x86_64_.so.1.27.1 /usr/local//lib
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so.1.27 ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so.1.27 \
)
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so.1 ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so.1 \
)
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so \
)
(cd /usr/local//lib; \
rm -f libopenh323.so ; \
ln -sf libh323_linux_x86_64_.so libopenh323.so \
)
( for dir in /usr/local//lib \
/usr/local//include/openh323 \
/usr/local//include/openh323/codec \
/usr/local//include/openh323/h224 \
/usr/local//include/openh323/h230 \
/usr/local//include/openh323/h235 \
/usr/local//include/openh323/h341 \
/usr/local//include/openh323/h350 \
/usr/local//include/openh323/h450 \
/usr/local//include/openh323/h460 \
/usr/local//share/openh323 ;\
do mkdir -p $dir ; chmod 755 $dir ; \
done)
而后重新进行h323的配置和编译,但是没有进行make install,而是
make optnoshared
cd /root/h323plus
./configure
make && make optnoshared
重新运行
cd /root/h323plus/samples/simple/obj_linux_x86_64
ls
./simph323 -n -l
报同样的错,下面针对性解决
./simph323: error while loading shared libraries: libh323_linux_x86_64_.so.1.27.1: cannot open shared object file: No such file or directory
解决方式参考链接
恢复原配置编译安装h323
cd /root/h323plus
./configure
make && make install
观察安装过程中
mkdir -p /usr/local//lib
rm -f /usr/local//lib/libh323_*_r.so*
/usr/bin/install -c -m 444 lib/libh323_linux_x86_64_.so.1.27.1 /usr/local//lib
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so.1.27 ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so.1.27 \
)
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so.1 ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so.1 \
)
(cd /usr/local//lib ; \
rm -f libh323_linux_x86_64_.so ; \
ln -sf libh323_linux_x86_64_.so.1.27.1 libh323_linux_x86_64_.so \
)
(cd /usr/local//lib; \
rm -f libopenh323.so ; \
ln -sf libh323_linux_x86_64_.so libopenh323.so \
)
查看sample的运行依赖
cd /root/h323plus/samples/simple/obj_linux_x86_64
ls
ldd simph323
运行结果如下,唯独libh323_linux_x86_64_.so.1.27.1
没有找到。
[root@host ~]# cd /root/h323plus/samples/simple/obj_linux_x86_64
[root@host obj_linux_x86_64]# ls
main.o simph323
[root@host obj_linux_x86_64]# ldd simph323
linux-vdso.so.1 => (0x00007ffed96fa000)
libh323_linux_x86_64_.so.1.27.1 => not found
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f8b70c7e000)
libpt.so.2.10.9 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8b70a62000)
librt.so.1 => /lib64/librt.so.1 (0x00007f8b7085a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f8b70656000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f8b7034f000)
libm.so.6 => /lib64/libm.so.6 (0x00007f8b7004d000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8b6fe37000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8b6fa69000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8b70e98000)
[root@host obj_linux_x86_64]#
参考链接Linux中error while loading shared libraries错误解决办法
1、首先打开/etc/ld.so.conf文件
2、加入动态库文件所在的目录:执行vi /etc/ld.so.conf,在"include ld.so.conf.d/*.conf"下方增加"/usr/local/lib"。
3、保存后,在命令行终端执行:/sbin/ldconfig -v;其作用是将文件/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用,因此当安装完一些库文件,或者修改/etc/ld.so.conf增加了库的新搜索路径,需要运行一下ldconfig,使所有的库文件都被缓存到文件/etc/ld.so.cache中,如果没做,可能会找不到刚安装的库。
cp /etc/ld.so.conf /etc/ld.so.conf.bak
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
/sbin/ldconfig -v
ldconfig
4.问题解决
查看依赖情况
cd /root/h323plus/samples/simple/obj_linux_x86_64
ldd simph323
[root@host ~]# cd /root/h323plus/samples/simple/obj_linux_x86_64
[root@host obj_linux_x86_64]# ldd simph323
linux-vdso.so.1 => (0x00007ffdf17a9000)
libh323_linux_x86_64_.so.1.27.1 => /usr/local/lib/libh323_linux_x86_64_.so.1.27.1 (0x00007fdaed803000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fdaed5e9000)
libpt.so.2.10.9 => /usr/local/lib/libpt.so.2.10.9 (0x00007fdaed0fa000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdaecede000)
librt.so.1 => /lib64/librt.so.1 (0x00007fdaeccd6000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fdaecad2000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fdaec7cb000)
libm.so.6 => /lib64/libm.so.6 (0x00007fdaec4c9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fdaec2b3000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdaebee5000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdaee276000)
[root@host obj_linux_x86_64]#
5.运行
cd /root/h323plus/samples/simple/obj_linux_x86_64
./simph323 -n -l
[root@host obj_linux_x86_64]# cd /root/h323plus/samples/simple/obj_linux_x86_64
[root@host obj_linux_x86_64]# ./simph323 -n -l
simple Version 1.27.1 by H323Plus on Unix Linux (3.10.0-1127.el7.x86_64-x86_64)
2020/11/05 08:46:57.326 0 (0) Version 1.27.1 by H323Plus on Unix Linux (3.10.0-1127.el7.x86_64-x86_64) with PTLib (v2.10.9 (svn:0)) at 2020/11/5 8:46:57.326
Available Video Drivers:
FakeVideo
Shm
YUVFile
FFMPEG
V4L2
Using video driver *
Local username: root
Silence compression is Disabled
Auto answer is 0
FastConnect is Disabled
H245Tunnelling is Enabled
H245QoS is Enabled
Jitter buffer: 50-250 ms
Sound output device: "Null Audio"
Sound input device: "Null Audio"
Codecs (in preference order):
Table:
G.711-ALaw-64k <1>
G.711-uLaw-64k <2>
UserInput/hookflash <3>
UserInput/basicString <4>
UserInput/dtmf <5>
UserInput/RFC2833 <6>
Set:
0:
0:
G.711-ALaw-64k <1>
G.711-uLaw-64k <2>
1:
UserInput/hookflash <3>
2:
UserInput/basicString <4>
UserInput/dtmf <5>
UserInput/RFC2833 <6>
Available Features:
Std9 QoS Monitoring-H.460.9
Std18 NatTraversal-H.460.18
Std19 NatTraversal-H.460.19
Std23 P2Pnat Detect-H.460.23
Std24 P2Pnat Media-H.460.24
Available NAT Methods:
STUN
H46019
H46024
GnuGk
Available Security:
SimpleCAT
SimpleMD5
TimeSync
Waiting for incoming calls for "root"
Press X to exit.
H323>
提示输入X
,可以退出当前运行过程。
下面查看端口运行情况
netstat -lntp
[root@host ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 970/sshd
tcp 0 0 0.0.0.0:1720 0.0.0.0:* LISTEN 1505/./simph323
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1295/master
tcp6 0 0 :::22 :::* LISTEN 970/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1295/master
[root@host ~]#
6.优化
为方便sample程序运行,在根目录下建立软连接,参考链接
cd
pwd
ls
ln -s /root/h323plus/samples/simple/obj_linux_x86_64/simph323 simph323
ls
ll
[root@host ~]# cd
[root@host ~]# pwd
/root
[root@host ~]# ls
anaconda-ks.cfg h323plus softwarepackages
[root@host ~]# ln -s /root/h323plus/samples/simple/obj_linux_x86_64/
main.o simph323
[root@host ~]# ln -s /root/h323plus/samples/simple/obj_linux_x86_64/simph323 simph323
[root@host ~]# ls
anaconda-ks.cfg h323plus simph323 softwarepackages
[root@host ~]# ll
total 8
-rw-------. 1 root root 1435 Jul 27 14:16 anaconda-ks.cfg
drwxrwxr-x. 8 root root 4096 Nov 4 17:02 h323plus
lrwxrwxrwx. 1 root root 55 Nov 5 09:32 simph323 -> /root/h323plus/samples/simple/obj_linux_x86_64/simph323
drwxr-xr-x. 3 root root 277 Nov 5 09:32 softwarepackages
[root@host ~]#
在根目录运行测试
cd
./simph323 -n -l
[root@host ~]# cd
[root@host ~]# ./simph323 -n -l
simple Version 1.27.1 by H323Plus on Unix Linux (3.10.0-1127.el7.x86_64-x86_64)
2020/11/05 09:36:38.191 0 (0) Version 1.27.1 by H323Plus on Unix Linux (3.10.0-1127.el7.x86_64-x86_64) with PTLib (v2.10.9 (svn:0)) at 2020/11/5 9:36:38.191
Available Video Drivers:
FakeVideo
Shm
YUVFile
FFMPEG
V4L2
Using video driver *
Local username: root
Silence compression is Disabled
Auto answer is 0
FastConnect is Disabled
H245Tunnelling is Enabled
H245QoS is Enabled
Jitter buffer: 50-250 ms
Sound output device: "Null Audio"
Sound input device: "Null Audio"
Codecs (in preference order):
Table:
G.711-ALaw-64k <1>
G.711-uLaw-64k <2>
UserInput/hookflash <3>
UserInput/basicString <4>
UserInput/dtmf <5>
UserInput/RFC2833 <6>
Set:
0:
0:
G.711-ALaw-64k <1>
G.711-uLaw-64k <2>
1:
UserInput/hookflash <3>
2:
UserInput/basicString <4>
UserInput/dtmf <5>
UserInput/RFC2833 <6>
Available Features:
Std9 QoS Monitoring-H.460.9
Std18 NatTraversal-H.460.18
Std19 NatTraversal-H.460.19
Std23 P2Pnat Detect-H.460.23
Std24 P2Pnat Media-H.460.24
Available NAT Methods:
STUN
H46019
H46024
GnuGk
Available Security:
SimpleCAT
SimpleMD5
TimeSync
Waiting for incoming calls for "root"
Press X to exit.
H323>
netstat -lntp
[root@host ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 970/sshd
tcp 0 0 0.0.0.0:1720 0.0.0.0:* LISTEN 1851/./simph323
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1295/master
tcp6 0 0 :::22 :::* LISTEN 970/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1295/master
[root@host ~]#