引言
最近公司需要在系统中集成软电话的功能,之前我们是直接购买的蚂蚁电话,在使用了一段时间以后,会有一些问题,比如说稳定性,还有就是一些和我们自己业务相关的需要定制的功能都不能满足,所以我们需要自己搭建软电话平台,在前期调研以后我们选定freeswitch来完成,关于freeswitch的基本介绍大家自行google就可以了,在这介绍安装过程。
1、下载源代码
进入目录 cd /usr/local/src
从git库中下载源代码 如果你没有安装git,执行yum install git 进行安装
然后克隆源代码
git clone -b v1.6 https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch
2、开始编译
进入freeswitch目录 cd/ freeswitch
运行 ./bootstrap.sh
如果会出现类似autoconf not found错误提示,是因为没有下载第三方依赖库。
freeswitch依赖的第三方库有:gcc-c++ ,wget alsa-lib-devel, autoconf ,automake ,bison ,broadvoice-devel ,bzip2 ,curl-devel, db-devel ,e2fsprogs-devel, flite-devel ,g722_1-devel, 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 ,libtiff-devel ,libtheora-devel, libtool, 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, python26-devel ,python-devel ,soundtouch-devel,speex-devel, sqlite-devel ,unbound-devel, unixODBC-devel ,libuuid-devel ,which yasm zlib-devel。
3、安装依赖库
yum install -y git gcc-c++ wget alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel db-devel e2fsprogs-devel flite-devel g722_1-devel 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 libtiff-devel libtheora-devel libtool 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 python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel libuuid-devel which yasm zlib-devel
4.再一次编译
运行 ./bootstrap.sh
接着运行 ./configure
如果出现以下界面,就是默认配置成功.
如果我们没有看到成功页面
可能是我们缺少编译环境,安装编译环境
yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release
然后:增加mod_nuimrcp模块
编辑 vim ./build/modules.conf.in
修改 #asr_tts/mod_unimrcp 为 asr_tts/mod_unimrcp(去掉注释)
重新执行下面命令:
./bootstrap.sh -j ./configure
5、执行make命令
如果出现以下界面,则编译成功
我们可能会遇到如下错误
You must install libopus-dev to build mod_opus. Stop.
这是因为缺少 libopus-dev 依赖
yum install opus-devel
然后在执行 make 命令即可
6、执行make install
运行make install命令
如果出现以下界面,则安装成功。
7.启动freeswitch
进入cd /usr/local/freeswitch/bin/目录,然后运行 ./freeswitch命令。
如果出现以下界面,则运行成功。
8.配置freeswitch在任何一个路径都可以运行
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/ ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
9.如果运行freeswitch出现以下错误,是因为端口被占用了。
[root@localhost ~]# freeswitch Cannot lock pid file /usr/local/freeswitch/run/freeswitch.pid.
解决办法:可以重启Linux或者关闭占用端口的进程。
10.如果freeswitch启动成功,但是linphone注册不上。
解决办法:systemctl stop firewalld.service (关闭防火墙)
11、注册成功
小结
到此freeswitch的安装就完成了,对于freeswitch的学习刚刚开始,关于freeswitch的深入学习,会在后面的博客中介绍!
yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release