1,安装必须依赖组件
In case of errors about "no usable spandsp" or sofia-sip, compile and install spandsp and sofia-sip first, then
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
where ls /usr/local/lib/pkgconfig should list at least
sofia-sip-ua.pc spandsp.pc
Then FreeSWITCH should compile properly.
#1、安装sofia-sip-ua
#2、安装spandsp
2,安装必须安装包
#安装必须包
yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum-builddep -y freeswitch
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git
yum install -y devtoolset-4-gcc*
yum install sqlite-devel
yum install libcurl-devel
yum install pcre
yum install pcre-devel
yum install speex
yum install speex-devel
yum install ldns-devel
yum install yasm
yum install libopus-devel
#错误提示: You must install libopus-dev to build mod_opus
yum -y install opus-devel
#可能需要清理: make clean && ./configure && make
3,安装mod_av组件
#参照安装文档 https://www.cnblogs.com/cash/p/13278104.html
#如果不想安装这个组件(module.conf.xml 注释掉编译项)
#step 安装x264
#git clone http://git.videolan.org/git/x264.git
./configure --disable-asm
make
make install
#step2 安装libav
wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
cd /usr/local/src
git clone https://gitee.com/nwaycn/libav.git
cd libav
./configure --enable-pic --enable-shared --enable-libx264 --enable-gpl --extra-libs="-ldl"
make
make install
cp /usr/local/lib/pkgconfig/libavcodec.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavdevice.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavfilter.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavformat.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavresample.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavutil.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libswscale.pc /usr/lib64/pkgconfig/
ldconfig
4,编译源代码安装
#下载freeswitch源文件
cd /usr/local/src
git clone -b v1.10 https://github.com/signalwire/freeswitch.git freeswitch
cd /usr/local/src/freeswitch
#执行开始编译
./bootstrap.sh -j
#执行编译
./configure
#出现错误与解决
#------------------------------------------------------------------
#configure: error: You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support
#1.执行:yum search libedit-dev
#=============== N/S Matched: libedit-dev ========================
#libedit-devel.i686 : Development files for libedit
#libedit-devel.x86_64 : Development files for libedit
#2.yum install libedit-devel
#------------------------------------------------------------------
#
#./configure --enable-portable-binary \
# --prefix=/usr --localstatedir=/var --sysconfdir=/etc \
# --with-gnu-ld --with-python --with-erlang --with-openssl \
# --enable-core-odbc-support --enable-zrtp
make
make -j install
make -j cd-sounds-install
make -j cd-moh-install
#在CentOS系统上,其默认的安装位置是/usr/local/freeswitch。
#两个常用的命令是bin/freeswitch和bin/fs_cli,为了便于使用,建议将这两个命令做符号链接放到你的搜索路径中,如:
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
5,安装遇到问题及解决方案
#参照下面博客
https://www.cnblogs.com/lzpong/p/6740188.html
# 1.出现下面错误处理办法
# SignalWire adoption failed: stun [stun.freeswitch.org] lookup error: Remote Address Error!
vim /usr/local/freeswitch/conf/autoload_configs/signalwire.conf
<configuration name="signalwire.conf" description="SignalWire">
<settings>
<!-- on/off/file-path -->
<!--param name="kslog" value="on"/-->
<!--param name="blade-bootstrap" value="blade://switchblade:2100"/-->
<!--param name="adoption-service" value="https://adopt.signalwire.com/adoption"/-->
<!--param name="stun-server" value="stun.freeswitch.org"/-->
<!-- <authentication></authentication> -->
<!-- override dialplan context for calls on connector -->
<!--<param name="override-context" value="signalwire"/>-->
</settings>
</configuration>
保存重启
6,模块及组件安装
6.1 安装中文语音组件
1、下载中文语音包
链接:https://pan.baidu.com/s/1UODvqj8NAQw7_CRatfl0kg
提取码:qwdn
创建目录 /usr/local/freeswitch/sounds/zh/cn/link
将下载好的语音上传到 /usr/local/freeswitch/sounds/zh/cn/link
2、修改 /usr/local/freeswitch/conf/vars.xml
在53行左右增加 <X-PRE-PROCESS cmd="set" data="sound_prefix=$${sounds_dir}/zh/cn/link"/>
3、修改 /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
在136 行左右 取消 <load module="mod_say_zh"/> 注释
4、编译mod_say_zh 模块
cd /usr/local/src/freeswitch-1.8.2/src/mod/say/mod_say_zh
make && make instal
5、cd /usr/local/freeswitch/conf/lang/
cp -fr en zh
cd zh
mv en.xml zh.xml
6、修改zh.xml
<language name="zh" say-module="zh" sound-prefix="$${sound_prefix}/zh/cn/link" tts-engine="mod_tts_commandline" tts-voice="link">
7、/usr/local/freeswitch/conf/freeswitch.xml
在61行增加 <X-PRE-PROCESS cmd="include" data="lang/zh/*.xml"/>
8、控制台 reloadxml
6.2,安装视频通话组件
# 特别说明:必须安装mod_av组件
#1,开启视频通话功能
#编辑 /usr/local/freeswitch/etc/freeswitch/vars.xml
bash <X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8"/>
#编辑 /usr/local/freeswitch/etc/freeswitch/sip_profiles/internal.xml
shell 将 <param name="inbound-proxy-media" value="true"/> 这行注释去掉
#加载 mod_av 模块
启动 freeswitch 后,在 fs_cli 控制台中输入:load mod_av
#开启启动 freeswitch 自动加载 mod_av 方法:
#修改/usr/local/freeswitch/etc/freeswitch/autoload_configs/modules.conf.xml 文件
#取消注释 <load module="mod_av"/>
6.3 配置通话录音
#配置录音功能
#1.建立一个文件夹,在/freeswitch/recordings/archive/ ,用来存储录音文件;
#2.修改拨码计划,打开 \conf\dialplan\default.xml
# 找到下面的语句:<extension name="Local_Extension"><condition field="destination_number" expression="^(10[01][0-8])$">
# 在下面添加录音配置参数:
<action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_COPYRIGHT=(c) 2021"/>
<action application="set" data="RECORD_SOFTWARE=FreeSWITCH"/>
<action application="set" data="RECORD_ARTIST=FreeSWITCH"/>
<action application="set" data="RECORD_COMMENT=FreeSWITCH"/>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_STEREO=true"/>
<action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
#3.在fs_cli中使用F6或执行reloadxml使配置文件生效;
#4.随便呼叫产生录音文件