注册 SignalWire 获取 PATs(Personal access tokens)
FreeSWITCH 依赖需要注册 SignalWire 账号,使用账号 token 安装。
- 注册 https://signalwire.com/
- 登录账号
- 左下角菜单 Personal access tokens
- 创建一个新的token Add New
- 生成token Generate Token
编译安装
# 替换自己生成的token
TOKEN=pat_hoputtokenhere123456
apt-get update && apt-get install -yq gnupg2 wget lsb-release
wget --http-user=signalwire --http-password=$TOKEN -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 $TOKEN" > /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
apt-get -y update
apt-get -y build-dep freeswitch
cd /usr/src
git clone https://github.com/signalwire/freeswitch.git -bv1.10 freeswitch
# 注:如 Github 无法正常下载,可使用 ghproxy 代理clone
# 执行:git clone https://ghproxy.com/https://github.com/signalwire/freeswitch.git -bv1.10 freeswitche
cd freeswitch
git config pull.rebase true
./bootstrap.sh -j
./configure
make
make install
make cd-sounds-install cd-moh-install
后续配置
配置用户组
cd /usr/local
groupadd freeswitch
adduser --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH open source softswitch" --ingroup freeswitch freeswitch --disabled-password
chown -R freeswitch:freeswitch /usr/local/freeswitch/
chmod -R ug=rwX,o= /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*
配置 systemd
vim /etc/systemd/system/freeswitch.service
[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /usr/local/freeswitch/run
ExecStartPre=/bin/chown freeswitch:daemon /usr/local/freeswitch/run
ExecStart=/usr/local/freeswitch/bin/freeswitch -ncwait -nonat
TimeoutSec=45s
Restart=always
; exec
WorkingDirectory=/usr/local/freeswitch/run
User=freeswitch
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
;LimitSTACK=240
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007
[Install]
WantedBy=multi-user.target
启用并启动 freeswitch 服务
systemctl daemon-reload
systemctl start freeswitch
systemctl enable freeswitch
检查是否启动成功
ps aux | grep freeswitch
或者
systemctl status freeswitch
● freeswitch.service
Loaded: loaded (/etc/systemd/system/freeswitch.service; enabled; preset: enabled)
Active: active (running) since Mon 2024-06-02 21:16:55 CST; 22s ago
配置 fs_cli
vim .bashrc
PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/local/freeswitch/bin
source .bashrc
通过 fs_cli 查看 freeswitch 状态
fs_cli
freeswitch> status
至此已安装完成