FreeSWITCH中文网,电话机器人开发网 ,微信订阅号:

FreeSWITCH及VOIP,Openser,电话机器人等产品中文技术资讯、交流、沟通、培训、咨询、服务一体化网络。QQ群:293697898

FreeSWITCH1.7带mod_av的编译及H264、VP8转码支持操作及WEBRTC


tags:FreeSWITCH 视频会议及转码 创建时间:2015-09-06 21:15:17

加QQ群: 293697898 和更多群友一起成长

原文: http://www.nway.com.cn/t4.html

     FreeSWITCH这个软交换在预算较低的企业电话系统应用中, 应是最具有价值和使用性的一款产品。它的大并发能力,多种媒体支持,纯c底层库的支持, 稳健的健壮性,现为上海宁卫信息技术有限公司主推的系统产品 。它的运营级性能,用户级功能,受到越来越多的用户青睐。宁卫信息

在其它版本的linux中,编译mod_av的话,可以使用官方的libav包,不过都不如debian 8版本来得快,如centos 6配了epel的情况下,操作如下: 先装依赖库:

yum install -y git subversion autoconf automake libtool gcc-c++ ncurses-devel make

yum -y install expat-devel openssl-devel libtiff-devel libX11-devel unixODBC-devel libssl-devel python-devel 
yum -y install zlib-devel libzrtpcpp-devel alsa-lib-devel libogg-devel libvorbis-devel perl-libs gdbm-devel 
yum -y install libdb-devel uuid-devel @development-tools  patch

yum -y install ldns-devel libidn-devel unbound-devel
yum -y install libjpeg-devel
yum -y install pcre-devel
yum -y install speex-devel yasm nasm


wget -c http://files.freeswitch.org/downloads/libs/libav-12.tar.bz2  
tar -jxvf libav-12.tar.bz2
./configure --disable-static --enable-shared --enable-pic
 make CXXFLAGS="-fPIC"
make install

参上有关centos下的安装依赖,出现问题解决问题,只要不是缺心眼,总能安装成功的。

Debian 8 下编译有mod_av的FreeSWITCH 1.7版

  1. 安装 Debian 8

切记,切记:一定要 64位的debian,而不是32位或别的系统

  1. 通过图形管理界面更改ip地址为静态的或通过命令更改

前提,加载安装盘,先装个vim,在debian下,vi我认为不好用

修改 /etc/network/interfaces ,如:

auto eth0 #设置设备名称

iface eth0 inet static #设置接口类型,static为静态ip,或者为dhcp

address 192.168.1.1 #接口地址

netmask 255.255.255.0 #掩码

gateway 192.168.1.254 #网关

为了让配置生效,运行/etc/init.d/networking restart

  1. 配置debian源

vim /etc/apt/sources.list

变成以下内容:

# deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

#deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

#deb http://security.debian.org/ jessie/updates main contrib
#deb-src http://security.debian.org/ jessie/updates main contrib

deb http://mirrors.163.com/debian jessie main non-free contrib
deb http://mirrors.163.com/debian jessie-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security jessie/updates main contrib non-free

deb http://security.debian.org jessie/updates main contrib non-free
#以上禁掉cdrom和deb原生源,改为163的,加快速度
# jessie-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://ftp.debian.org/debian/ jessie-updates main contrib
# deb-src http://ftp.debian.org/debian/ jessie-updates main contrib
  1. 接下来那么就按官方的基本文档走了

fs1.9 2017-1-23 安装手札

wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -

echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >> /etc/apt/sources.list.d/freeswitch.list
apt-get update
apt-get install -y --force-yes freeswitch-video-deps-most


git config --global pull.rebase true


cd /usr/src/
git clone  https://git.oschina.net/nwaycn/freeswitch.git
#git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch
cd freeswitch

# The -j argument spawns multiple threads to speed the build process, but causes trouble on some systems
./bootstrap.sh -j

# if you want to add or remove modules from the build, edit modules.conf
vi modules.conf

# add a module by removing '#' comment character at the beginning of the line
# remove a module by adding the '#' comment character at the beginning of the line 
# containing the name of the module to be skipped in the build process

./configure
make
make install

# Install audio files:
make cd-sounds-install cd-moh-install

# To update an installed build:
cd /usr/src/freeswitch
make current

a. 添加freeswitch的源

echo "deb http://files.freeswitch.org/repo/deb/debian/ jessie main" > /etc/apt/sources.list.d/99FreeSWITCH.test.list

wget -O - http://files.freeswitch.org/repo/deb/debian/key.gpg |apt-key add -

apt-get update

a2. 针对fs1.6最新版,直接安装

wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -

echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list

apt-get update && apt-get install -y freeswitch-meta-all

a3. 针对2016年2月后master或v1.6版本,a 和b不需要执行,先执行a,b,反而会造成安装源包的依赖异常

wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -

echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list

apt-get update

apt-get install -y --force-yes freeswitch-video-deps-most

b. 安装依赖

DEBIAN_FRONTEND=none APT_LISTCHANGES_FRONTEND=none apt-get install -y --force-yes freeswitch-video-deps-most

c. git FreeSWITCH的源码

git config --global pull.rebase true
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
cd freeswitch.git
./bootstrap.sh -j
./configure -C

d. 开启mod_av模块

perl -i -pe 's/#applications\/mod_av/applications\/mod_av/g' modules.conf

e. 编译并install

make
make install
make cd-sounds-install 
make cd-moh-install 
make samples

f. 修改内核参数

vim /etc/sysctl.d/vid.conf

net.core.rmem_max = 16777216 
net.core.wmem_max = 16777216 
kernel.core_pattern = core.%p

系统调用使之生效

sysctl -w net.core.rmem_max=16777216 
sysctl -w net.core.wmem_max=16777216 
sysctl -w kernel.core_pattern=core.%p

g. 将mod_av加载了,fs_cli中load mod_av或autoload_configs/modules.conf.xml 中加一行, 并在conf/vars.xml中的编码部分添加H264

h. 添加freeswitch和fs_cli的软链接后,运行freeswitch后,拨3500后试试吧

手机截图

WEBRTC

以上基本整个工作就结束了。在这里之前很多人说没法视频通信,我个人认为应是没有加载这个mod_av,它是使用ffmpeg进行一系列的音视转换的库,而在centos中,ffmpeg的库比较麻烦些,总是在调用libavformat的时候有异常。在这里测试过的客户端有eyebeam,linphone的vp8和h264的视频编码。这里注明,以前是因为对libav这个库不了解,这是一个从ffmpeg中分出来的库,很多依赖是基于debian,而在centos中要编译则相对麻烦些。


上海老李,QQ:1354608370,FreeSWITCH QQ群: