FreeSWITCH1.7带mod_av的编译及H264转码支持操作及WEBRTC测试
FreeSWITCH这个软交换在预算较低的企业电话系统应用中, 应是最具有价值和使用性的一款产品。它的大并发能力,多种媒体支持,纯c底层库的支持, 稳健的健壮性,现为上海宁卫信息技术有限公司主推的系统产品 。它的运营级性能,用户级功能,受到越来越多的用户青睐。宁卫信息Debian 8 下编译有mod_av的FreeSWITCH 1.7版
1. 安装 Debian 8
2. 通过图形管理界面更改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
3. 配置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
4. 接下来那么就按官方的基本文档走了
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
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的视频编码。