1、下载相关资源:
# 假设所有资源都下载到/opt/目录下
cd /opt
# 下载FreeSWITCH源码
git clone https://github.com/signalwire/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
2、安装必要的依赖项:
sudo apt install cmake gcc g++ autoconf automake make unixodbc-dev ncurses-dev zlib1g-dev libjpeg-dev libtiff-dev liblua5.1-0-dev libsqlite3-dev libsndfile-dev libavformat-dev libswscale-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libedit-dev libtool libldns-dev libopus-dev libpq-dev
其中有个libuuid需要自己编译安装,安装方式如下:
- 下载
libuuid
的源码包,可以从以下链接下载:http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz。 - 解压下载的文件:
tar -xzvf libuuid-1.0.3.tar.gz
- 进入解压后的目录,并执行配置、编译和安装:
cd libuuid-1.0.3 ./configure make sudo make install
- 安装完成后,
libuuid
库将被安装在/usr/local/include
和/usr/local/lib
目录下。
3、安装其他包:
cd spandsp/
# 校验安装包版本与freeswitch匹配
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4./bootstrap.sh
./configure
make -j$(nproc) && make install#添加环境变量
vi /etc/profile
# 文末添加以下内容:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
source /etc/profile
cd ..
cd sofia-sip
./bootstrap.sh
./configure
make -j$(nproc) && make install
cd ..
cd libks
cmake .
make -j$(nproc) && make install
cd ..
cd signalwire-c/
cmake .
make -j$(nproc) && make install
最后做一下更新
ldconfig
4、编译安装FreeSWITCH
# 编译安装FreeSWITCH
cd freeswitch
./bootstrap.sh -j
./configure
make -j`nproc`
sudo 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
cd ..
5、启动FreeSWITCH服务
cd /usr/local/freeswitch
# 前台启动服务
bin/freeswitch