全网最健全的fs安全教程,本文档适用于debian/ubuntu系统安装,本文档基于源码安装。

一.镜像源选择

选择合适的镜像源,以下仅作参考

参考:

debian系统

vim /etc/apt/sources.list

deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

ubuntu系统

vim /etc/apt/sources.list

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

二 更新镜像源

apt update

三 安装对应的依赖包

apt-get install -y \
git curl 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  libavcodec-dev libavdevice-dev \
liblua5.2-dev \
libopus-dev \
libpq-dev \
libshout3-dev libmpg123-dev libmp3lame-dev \
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev librabbitmq-dev libhiredis-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libavformat-dev \
libavcodec-dev \
libavutil-dev \
libswscale-dev \
libavfilter-dev \
libavdevice-dev \
libssl-dev

四 下载源码

cd /opt
# 下载FreeSWITCH源码
git clone -b v1.10 https://github.com/signalwire/freeswitch freeswitch
# 下载libks源码
git clone https://github.com/signalwire/libks
# 下载sofia-sip源码
git clone https://github.com/freeswitch/sofia-sip
# 下载spandsp源码
git clone https://github.com/freeswitch/spandsp
# 下载signalwire-c源码
git clone https://github.com/signalwire/signalwire-c

五 安装顺序安装源码包


# 安装libks
cd libks
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1
make install
cd ..
# 安装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 ..
# 安装spandsp
cd ../spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
./bootstrap.sh
./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr
make -j`nproc --all` && make install
ldconfig

cd ..
# 安装signalwire-c
cd ../signalwire-c
PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr
make install
cd ..


#### 编译FreeSWITCH
# 编译安装FreeSWITCH
cd ../freeswitch
./bootstrap.sh -j
./configure
make -j`nproc` &&  make install

六 声音可选择安装

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

七 软连接设置

ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin

八 启动FS

# 控制台启动
freeswitch
# 后台启动
freeswitch -nc