H323plus的编译安装配置与使用:从头开始

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)。

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

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

H323plus的学习使用(1)——编译安装h323plus

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.运行

H323plus的学习使用(2)——simple实现音视频通话

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 ~]# 

0x07.TODO接入视频采集设备

H323plus的编译、安装、配置和使用
linux下h323plus简单使用

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
H323Plus是一款开源的视频通信协议集合,主要用于语音、视频、数据的实时通信。它是构建在H.323标准基础上的增强版本。 H.323是一种为IP网络设计的多媒体通信标准,用于实现语音、视频和数据的传输。H323Plus作为H.323的补充,提供了更多功能和灵活性,使开发者能够更轻松地构建多媒体通信应用。 H323Plus的教程可以帮助开发者了解如何使用该库进行多媒体通信应用的开发。教程内容通常包括以下方面: 1. 环境准备:教程会提供H323Plus的安装步骤,包括下载源码、编译安装。还会介绍配置开发环境所需的其他工具和库。 2. 基本概念:教程会介绍H.323协议和H323Plus的基本概念,如终端设备、网关、呼叫控制等,以帮助开发者理解协议原理。 3. API使用教程会介绍H323Plus库提供的API和函数,包括呼叫控制、媒体传输、音视频编解码等。开发者可以学习如何使用这些API来实现特定功能。 4. 示例代码:教程通常提供示例代码,演示如何使用H323Plus库来构建一个简单的多媒体通信应用。开发者可以借鉴这些示例,快速入门,并可以根据自己的需求进行修改和扩展。 总之,H323Plus教程可以帮助开发者深入了解和使用H.323协议,并使用H323Plus库来构建多媒体通信应用。通过学习教程,开发者可以快速掌握基本概念和API使用方法,进而进行自己的应用开发。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北观止

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值