前言
这里主要编译支持语音通话、视频通话、短信、webrtc功能的PBX。
安装编译工具包和依赖包
sudo apt-get update
sudo apt-get install -y autoconf git libtool g++ zlib1g-dev libjpeg-dev libcurl4-openssl-dev libspeex-dev libldns-dev libedit-dev libssl-dev pkg-config yasm liblua50-dev libopus-dev libsndfile1-dev libpq-dev libreadline-dev lua5.2 lua5.2-doc liblua5.2-dev libtiff5 libtiff5-dev
sudo apt-get install -y vim
sudo apt-get install -y g++
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y libsqlite3-dev
sudo apt-get install -y libcurl4-gnutls-dev
sudo apt-get install -y libpcre3-dev
sudo apt-get install -y libspeexdsp-dev
sudo apt-get install -y libedit-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y libopus-dev
sudo apt-get install -y liblua5.2-dev
sudo apt-get install -y libldns-dev
sudo apt-get install -y libsndfile1-dev
sudo apt-get install python3-pip -y
sudo apt-get install unixodbc unixodbc-dev
sudo apt install libavformat-dev -y
sudo apt install libswscale-dev -y
sudo apt install doxygen cmake uuid-dev -y
编译安装sofia-sip
git clone https://github.com/freeswitch/sofia-sip.git
./bootstrap.sh -j
./configure
make
make install
编译安装spandsp
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
./bootstrap.sh -j
./configure
make
make install
编译安装libks
git clone https://github.com/signalwire/libks.git
cd libks
sudo cmake .
sudo make
sudo make install
cat /etc/profile
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH}
source /etc/profile
编译安装freeswitch
git clone --branch v1.10.11 https://github.com/signalwire/freeswitch.git
# 编辑配置,去掉模块mod_signalwire,启用模块mod_callcenter
sed -i 's/applications\/mod_signalwire/#applications\/mod_signalwire/g' freeswitch/modules.conf
sed -i 's/#applications\/mod_callcenter/applications\/mod_callcenter/g' freeswitch/modules.conf
cd freeswitch
./configure --enable-portable-binary --with-gnu-ld --with-python3 --with-openssl --enable-core-odbc-support --enable-zrtp --enable-core-pgsql-support
make -j2
make install
make -j cd-sounds-install
make -j cd-moh-install
配置软连接和后台启动
#freeswitch启动:
/usr/local/freeswitch/bin/freeswitch -nonat -nc
#做软链,方便启动:
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
使用systemctl管理服务(可选)
cat /etc/systemd/system/freeswitch.service
[Unit]
Description=FreeSWITCH Soft-Switched Voice over IP Telephony
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/freeswitch/bin/freeswitch -nc
ExecStop=/usr/local/freeswitch/bin/freeswitch -stop
[Install]
WantedBy=multi-user.target
# ##################
systemctl daemon-reload
systemctl enable freeswitch --now
systemctl status freeswitch
测试验证
思路:使用软电话注册互拨测试就行,包括语音通话测试、视频通话测试、短信发送等。