一、Linux环境下使用源码安装(以centos7为例)
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
编译之前需要下载安装依赖库,运行
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
依赖库安装好后开始编译,运行
./bootstrap.sh
编译时间大概在30分钟左右,完成后运行
./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
配置成功后执行make命令
以下界面为编译成功:
如果提示
You must install libopus-dev to build mod_opus. Stop.
说明缺少依赖 libopus-dev,运行
yum install opus-devel
然后继续make,make成功后执行make install
以下界面为安装成功
3.配置ssl证书
使用腾讯云平台申请 域名型免费版证书
https://buy.cloud.tencent.com/ssl?fromSource=ssl&from=qcloudHpHeaderSsl
申请好后会有邮件通知,然后下载证书
使用tomcat配置https访问,修改server.xml文件,添加:
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="conf/www.test.com.jks"
keystorePass="******"
clientAuth="false" sslProtocol="TLS" />
其中keystoreFile为证书文件,keystorePass为**,然后重启tomcat即可
为freeswitch制作wss.pem文件
使用 https://myssl.com/ssl.html 查看OpenSSL并复制,创建wss.pem文件,将OpenSSL粘贴上去,然后将证书下载包里面apache文件夹下的3_www.test.com.key文件打开复制内容到wss.pem上去保存退出,到此freeswitch所需wss.pem文件制作完成,新建文件夹/usr/local/freeswitch/certs,将wss.pem放进去
配置wss.pem路径 /usr/local/freeswitch/conf/sip_profiles/internal.xml
4.启动freeswitch
配置freeswitch在任何一个路径都可以运行
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
前台启动
freewitch -c
后台启动
freewitch -nc
启动报错Cannot lock pid file /usr/local/freeswitch/run/freeswitch.pid.说明端口被占用,关闭端口即可