CentOS7 安装 FreeSWITH 避坑指南

1,990 阅读2分钟

via: tianyu94.com/2019/06/25/…

由于需求需要用到 FS ,这里做一个总结,由于我不是通信语音相关专业的,若是文章有什么问题欢迎留言评论。

系统环境

  • CentOS Linux release 7.6.1810

以下所有操作默认使用 root 账户操作

更换源(可选)

cd /etc/yum.repos.d

# 备份默认源
mv CentOS-Base.repo CentOS-Base.repo.backup

# 下载阿里源
curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

# 更新
yum clean all
yum makecache

安装方式1:通过 rpm 包安装

注意:此方法不方便自定义组件,如 python、callcenter、unimrcp 等

yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release
yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-*
systemctl enable freeswitch
# 服务启动成功后进入 fs 终端
fs_cli -rRS

安装方式2:源码编译安装

yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release

# 安装依赖
yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel libshout-devel libmpg123-devel lame-devel

cd /usr/local/src

# 克隆 FS 源码,当然你也可以切换到 v1.6 的版本(如果下载速度很慢自己科学下载吧,或者从我 fork (fork 日期 2019年6月26日) 到 Github 上的仓库下载:https://github.com/tianyu94/freeswitch-v1.8.git)
git clone -b v1.8 https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch

cd /usr/local/src/freeswitch

# 重要步骤:
# 1. 首先编辑 modules.conf.in
vi build/modules.conf.in

# 2. 注释掉 applications/mod_signalwire ==> #applications/mod_signalwire
#   这个模块是SignalWire CLOUD在线服务的模块,除非你需要这个。
#   这里取消这个模块的原因是:在编译时,这个模块依赖的包有错误,解决起来比较麻烦,直接不要这个模块
#   其他模块,例如 mod_python 等根据需要取消注释来启用模块
#   当然,即使你现在不确定需要用到哪些模块,也可以在安装后再添加(我这里仅对 mod_signalwire 做了修改)

# 3. 开始编译安装
#   PS:如果需要在开始就安装 python 模块,一个是取消 mod_python 的注释
#   还有在下面的指令中设置 python bin 路径,如 `--with-python=/usr/bin/python2.7`
#   其他的如 `--with-erlang` 等,是同时安装对应的模块
./bootstrap.sh -j

./configure --enable-portable-binary \
            --prefix=/usr --localstatedir=/var --sysconfdir=/etc \
            --with-gnu-ld --with-python=/usr/bin/python2.7 \
            --with-erlang --with-openssl \
            --enable-core-odbc-support --enable-zrtp \
            --enable-core-pgsql-support \
            --enable-static-v8 --disable-parallel-build-v8

make
make -j install
# 下面两步根据需要安装(可选)
make -j cd-sounds-install # 应该是音效相关的,欢迎各位补充
make -j cd-moh-install # Music on Hold

# 最后启动 FS
freeswitch

如果编译安装时没有安装python,这里是关于单独安装 python 模块的教程:freeswitch安装mod_python让你的freeswitch服务器支持python脚本

mod_unimrcp 配置

官网:freeswitch.org/confluence/…

callcenter 配置

官网:freeswitch.org/confluence/…

这里贴一个官网的 CentOS7 安装文档:freeswitch.org/confluence/…