7月底入坑呼叫中心技术,freeswitch是个不错的开源软交换技术,慢慢学习中:
1. FreeSWITCH的安装
1.1 前言
FreeSWITCH 1.10.4+版本(2020年8月)后,安装和部署流程发生了很大变化,例如sofia和spandsp模块需要单独安装等,实际增加了部署的复杂度。版本改动历史详见链接:FreeSWITCH 1.10.x Release notes | FreeSWITCH Documentation。
1.2 Ubuntu安装FreeSWITCH
1.2.1 安装环境
系统版本:ubuntu18.04
安装版本:FreeSWITCH 1.10.9
1.2.2 提前下载克隆各种资源
尽量提前转换为root账户或使用sudo命令。
1-CMake高版本安装编译
Wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
tar -zvxf cmake-3.23.0.tar.gz
cd cmake-3.23.0
./bootstrap
make
make install
链接
sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
sudo ln -sf /usr/local/bin/cpack /usr/bin/cpack
sudo ln -sf /usr/local/bin/ctest /usr/bin/ctest
2-克隆源码
需要保证在联网的状态下git
git clone https://github.com/signalwire/signalwire-c
git clone https://github.com/signalwire/libks
git clone https://github.com/freeswitch/sofia-sip
git clone https://github.com/freeswitch/spandsp
git clone -b v1.10 https://github.com/signalwire/freeswitch freeswitch
3-安装必要的依赖程序
将下面的命令直接输入到终端回车。
apt-get install -y \
build-essential cmake automake autoconf libtool libtool-bin pkg-config \
libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \
libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \
libogg-dev libspeex-dev libspeexdsp-dev \
libldns-dev \
python3-dev \
libavformat-dev libswscale-dev libavresample-dev \
liblua5.2-dev \
libopus-dev \
libpq-dev \
libshout3-dev libmpg123-dev libmp3lame-dev \
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev
1.2.3 安装步骤
用root权限账户安装。
S1:安装libks
cd libks
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1
make install
cd ..
S2:安装signalwire-c
cd signalwire-c
PKG_CONFIG_PATH=/usr/lib/pkgconfig
cmake . -DCMAKE_INSTALL_PREFIX=/usr
make install
cd ..
S3:安装sofia-sip
cd sofia-sip
./bootstrap.sh
./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr
make -j`nproc --all`
make install
cd ..
S4:安装spandsp
cd spandsp
./bootstrap.sh
./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr
make -j`nproc --all`
make install
cd ..
S5:编译安装FreeSWITCH
cd freeswitch
./bootstrap.sh -j
./configure
make -j`nproc`
make install
S6:安装英文声音资源(可选)
freeswitch目录下
make cd-sounds-install
make cd-moh-install
make uhd-sounds-install
make uhd-moh-install
make hd-sounds-install
make hd-moh-install
make sounds-install
make moh-install
cd ..
1.2.4 排错处理
1.2.4.1 安装spandsp报错处理
./bootstrap.sh时的错误
(1)
root@ubuntu:/opt/spandsp# ./bootstrap.sh
mkdir: cannot create directory ‘config’: File exists
删除config文件///只要把下一个错误搞定不删除也没事
(2)
configure.ac:21: error: Autoconf version 2.71 or higher is required
configure.ac:21: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: error: echo failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
如何排错:
1.spandsp当前目录下进入configure.ac
vim configure.ac
:set nu显示行号
查看21行AC_PREREQ的版本-->本次是2.71
2.安装最新版autoconf
a.查询本机当前的版本
#rpm -qf /usr/bin/autoconf
发现【autoconf-2.69】是自己电脑上的版本号
b.卸载
rpm -e --nodeps autoconf-2.69
c.安装对应2.71版本
wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz
tar zxvf autoconf-2.71.tar.gz
cd autoconf-2.71
./configure --prefix=/usr/
make && make install
d.查看版本/usr/bin/autoconf -V确认符合
3.再次执行安装命令
cd spandsp
./bootstrap.sh
./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr
make -j`nproc --all`
make install
1.2.4.2 安装FreeSWITCH报错处理
1 ./configure出错
(1)
虽然已经安装libks,我们暂时禁用mod_verto模块
vim modules.conf
找到mod_verto
末行模式输入:/mod_verto
前面加【#】注释掉即可
(2)
再次./configure
报错:
同上注释掉mod_signalwire
如果有其他报错,同上操作
继续./configure
OK,下一步make
2. make时出错
解决方法:回退版本(本人2023.7.20日安装,或许后续官方团队会解决该版本问题)
进入spandsp目录中,git log查看版本
尝试了好几个版本,目前使用23年6月份的分支可以:使用以下命令退回到6月的版本,取名finecode20230720:
git checkout -b finecode20230720 0d2e6ac65e0e8f53d652665a743015a88bf048d4
重新编译安装spandsp
再次编译安装FreeSWITCH。
安装完毕。(freeswitch默认安装路径/usr/local/freeswitch)
1.3 启动freeswitch
让freeswitch在任何一个目录都可以运行,可以配置软连接:
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
使用命令freeswitch或者fs_cli
启动成功界面图