文章目录
- 一、生成一个镜像
- 二、切换一个镜像源为阿里源
- 三、安装一些相关依赖和freeswitch
- 3.1第一步:安装freeswitch-mod和下载所需的依赖项
- 3.2 设置密钥
- 3.3 安装freeswitch所需的依赖项
- 3.4 报错
- 3.4.1 报错1
- 3.4.2 报错2
- 3.4.3 报错3
- 四、运行
- 4.1 通话三十秒自动挂断
一、生成一个镜像
docker run -dit --name fs_v2 debian:11 /bin/sh
二、切换一个镜像源为阿里源
sed -i 's/http:\/\/deb.debian.org/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
三、安装一些相关依赖和freeswitch
3.1第一步:安装freeswitch-mod和下载所需的依赖项
apt update
apt-get update
apt install vim
apt-get install -yq gnupg2 wget lsb-release
apt install git
apt-get -yq install \
# build
build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \
# general
libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \
# core
libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \
# core codecs
libogg-dev libspeex-dev libspeexdsp-dev \
# mod_enum
libldns-dev \
# mod_python3
python3-dev \
# mod_av
libavformat-dev libswscale-dev libavresample-dev \
# mod_lua
liblua5.2-dev lua-cjson \
# mod_opus
libopus-dev \
# mod_mariadb
libmariadb3 \
# mod_pgsql
libpq-dev \
# mod_sndfile
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \
# mod_shout
libshout3-dev libmpg123-dev libmp3lame-dev
3.2 设置密钥
获取key,获取地址:https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/HOWTO-Create-a-SignalWire-Personal-Access-Token_67240087
大家要是懒得申请,就用我的吧。
wget --http-user=signalwire --http-password=pat_KJym6TEtUK6PmADrgBV9A1zp -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg
echo "machine freeswitch.signalwire.com login signalwire password pat_KJym6TEtUK6PmADrgBV9A1zp" > /etc/apt/auth.conf
chmod 600 /etc/apt/auth.conf
echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list
3.3 安装freeswitch所需的依赖项
apt-get update
apt-get build-dep freeswitch
cd /usr/local/src
git clone https://github.com/signalwire/freeswitch.git -b v1.10.5 freeswitch
cd freeswitch
./bootstrap.sh -j
./configure
因为我们所在的分支机构将经历许多重组,一定要在Freeswitch文件夹里面执行一下的代码
最好设置这个,否则拉(更新)时会出现冲突。
git config pull.rebase true
为有些大帅哥大漂亮git访问困难户提供
链接:https://pan.baidu.com/s/1OlLdBdjZ3kSqUMEIIblDig?pwd=mt2z
提取码:mt2z
3.4 报错
3.4.1 报错1
checking for libmariadb >= 3.0.9... checking for mariadb >= 3.0.9... no checking for spandsp >= 3.0... configure: error: no usable spandsp; please install spandsp3 devel package or equivalent
cd /usr/local/src
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh -j
./configure
make
make install
这里有可能编译失败,原因是spandsp 版本和freeswitch版本不匹配
错误
V18_MODE_5BIT_4545错误
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
./bootstrap.sh -j
./configure
make
make install
更新环境
vi ~/.bashrc
或
vi ~/.bash_profile
在文件末尾添加以下内容:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
然后控制台执行
ldconfig
这样,当用户登录时,这些命令就会自动执行,从而使设置永久生效。
cd /usr/local/src/freeswitch
./bootstrap.sh -j
./configure
3.4.2 报错2
checking for sofia-sip-ua >= 1.12.12... configure: error: no usable sofia-sip; please install sofia-sip-ua devel package or equivalent
cd /usr/local/src/
git clone https://github.com/freeswitch/sofia-sip.git
cd sofia-sip
./bootstrap.sh
./configure
make
make install
ldconfig
cd /usr/local/src/freeswitch
./bootstrap.sh -j
./configure
make
3.4.3 报错3
make[4]: Entering directory '/usr/local/src/freeswitch/src/mod/applications/mod_signalwire' Makefile:967: *** You must install libks to build mod_signalwire. Stop. make[4]: Leaving directory '/usr/local/src/freeswitch/src/mod/applications/mod_signalwire' make[3]: *** [Makefile:712: mod_signalwire-all] Error 1
cd /usr/local/src
wget https://cmake.org/files/v3.13/cmake-3.13.3.tar.gz
tar -zxvf cmake-3.13.3.tar.gz
cd cmake-3.13.3
./bootstrap
make
make install
cd /usr/local/src
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
make install
mkdir -p /usr/lib64/pkgconfig/
cp -r /usr/lib/pkgconfig/libks.pc /usr/lib64/pkgconfig/
cd /usr/local/src
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c
cmake .
make
make install
cp -r /usr/local/lib/pkgconfig/*.pc /usr/lib64/pkgconfig/
cp -r /usr/local/lib/* /usr/lib64/
cd /usr/local/src/freeswitch
./bootstrap.sh -j
./configure
make && make install #编译时间很长
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
# 如有依赖报错,缺什么安装什么
四、运行
我做了一个视频,大家可以参考一下。
https://blog.csdn.net/huiguo_/article/details/134409180
# 后台启动freeswitch服务
freeswitch -nc -rp
freeswitch -nonat -nc -rp //不检查路由穿透行,加上此参数后会启动很快
freeswitch -stop
fs_cli
# freeswitch -help
-help -- 显示本帮助信息
-version -- 显示版本信息
-rp -- 开启高优先级(实时)设置
-nosql -- 不使用SQL,show channels 类的命令将不能显示结果
-nonat -- 如果路由器支持uPnP或NAT-PMP,则FreeSWITCH可以自动解决NAT穿越问题。如果路由器不支持,则该选项可以使启动更快
-stop -- 关闭 FreeSWITCH,它会在run目录中查找 PID文件
-nc -- 启动到后台模式,没有控制台
4.1 通话三十秒自动挂断
解决:打开/etc/freeswitch/sip_profiles下的配置文件internal.xml
,将外网配置注释掉,重启FS;
bug解释参考
https://blog.csdn.net/FlyLikeButterfly/article/details/100581609