准备工作
安装编译工具和依赖包
yum update -y
sudo yum install epel-release vim tcpdump net-tools.x86_64 -y
sudo yum install gcc-c++ sqlite-devel zlib-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel openssl-devel git -y
yum install yasm nasm opus-devel -y
yum groupinstall perl* -y
yum install python -y
yum install bzip2 -y
yum install -y libshout-devel lame-devel libmpg123-devel
yum install bc -y
yum install curl -y
yum install expect telnet -y
yum install -y unixODBC unixODBC-devel mysql-connector-odbc
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git wget vim devtoolset-7-gcc* devtoolset-7 libtiff-devel cmake3 libatomic unixODBC unixODBC-devel.x86_64 postgresql-libs postgresql-devel libpqxx-devel
yum install -y gcc-c++ autoconf automake libtool ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libxml2-devel libyuv-devel libvpx-devel libvpx2* libdb4* libidn-devel unbound-devel libuuid-devel lua-devel libsndfile-devel yasm-devel
reboot
拉取freeswitch源码
cd /root
git clone --branch v1.10.11 https://github.com/signalwire/freeswitch.git
编译安装sofia-sip模块
cd /root/freeswitch
git clone https://github.com/freeswitch/sofia-sip
cd sofia-sip
./bootstrap.sh -j
./configure
make
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
ldconfig
编译安装spandsp模块
cd /root/freeswitch
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh -j
./configure
make
make install
ldconfig
注意:该步骤如果按照上面,后面编译freeswitch的时候会报错
mod_spandsp_dsp.c:159:10: error: ‘V18_MODE_5BIT_4545’ undeclared (first use in this function)
正确步骤如下:
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
./bootstrap.sh -j
./configure
make
make install
参考资料:FreeSwitch 1.10.9 在CentOS7.9编译spandsp,V18_MODE_5BIT_4545错误_spandsp编译-CSDN博客https://www.cnblogs.com/zhongqifeng/p/15688517.html
设置要启用的模块
cd /root/freeswitch
./bootstrap.sh
sed -i 's/#formats\/mod_shout/formats\/mod_shout/g' /root/freeswitch/modules.conf
sed -i 's/applications\/mod_signalwire/#applications\/mod_signalwire/g' /root/freeswitch/modules.conf
sed -i 's/endpoints\/mod_verto/#endpoints\/mod_verto/g' /root/freeswitch/modules.conf
sed -i 's/applications\/mod_av/#applications\/mod_av/g' /root/freeswitch/modules.conf
sed -i 's/codecs\/mod_opus/#codecs\/mod_opus/g' /root/freeswitch/modules.conf
sed -i 's/#applications\/mod_callcenter/applications\/mod_callcenter/g' /root/freeswitch/modules.conf
sed -i 's/#applications\/mod_httapi/applications\/mod_httapi/g' /root/freeswitch/modules.conf
sed -i 's/#event_handlers\/mod_odbc_cdr/event_handlers\/mod_odbc_cdr/g' /root/freeswitch/modules.conf
编译安装freeswitch
./bootstrap.sh
./configure --enable-portable-binary --prefix=/usr/local/freeswitch --with-gnu-ld --with-python --with-openssl --enable-core-odbc-support --enable-zrtp
make
make install
make -j cd-sounds-install
make -j cd-moh-install
官方语音包下载地址:Index of /releases/sounds
设置软链接和开机启动
sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
cp -r /usr/local/freeswitch/bin/freeswitch /etc/rc.d/init.d
echo -e "/etc/init.d/freeswitch -nonat -nc" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
FAQ
以下记录下出现频率比较高的报错信息和相应解决办法,并不一定适用当前这篇。
1. checking for spandsp >= 3.0... configure: error: no usable spandsp; please install spandsp3 devel package or equivalent
Install OKey repository:
yum install http://repo.okay.com.mx/centos/7/x86_64/release/okay-release-1-1.noarch.rpm
Install cheese repository:
yum install http://www.nosuchhost.net/~cheese/fedora/packages/epel-7/x86_64/cheese-release-7-1.noarch.rpm
yum install -y spandsp3
yum install -y spandsp3-devel
2. checking for sofia-sip-ua >= 1.13.6... configure: error: no usable sofia-sip; please install sofia-sip-ua devel package or equivalent
yum install -y sofia-sip
yum install -y sofia-sip-devel
参考资料:
在CentOS7.9系统内安装目前最新版本FreeSWITCH 1.10.11
FreeSWITCH_1.10.11源码安装(centos7)_freeswitch v1.10.11安装-CSDN博客
https://www.cnblogs.com/aowind/p/15655308.html