Initial LisgloSIPS V2 implementation
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
# Server A RTPEngine 与录音 tmpfs Runbook
|
||||
|
||||
适用阶段:S19
|
||||
服务器:Server A `100.90.90.90`
|
||||
备份目录:`/var/backups/lisglosips-s19/20260621T054645Z`
|
||||
|
||||
## 部署内容
|
||||
|
||||
- 安装并固定 Ubuntu 仓库 RTPEngine 包 `11.5.1.18-1ubuntu1.2`:
|
||||
- `rtpengine`
|
||||
- `rtpengine-daemon`
|
||||
- `rtpengine-recording-daemon`
|
||||
- `rtpengine-iptables`
|
||||
- `rtpengine-kernel-dkms`
|
||||
- `rtpengine-utils`
|
||||
- 安装匹配当前内核的 headers,DKMS 已为 `6.17.0-22-generic` 和 `6.17.0-35-generic` 构建 `rtpengine/11.5.1.18`。
|
||||
- 加载内核模块 `xt_RTPENGINE`,RTPEngine 使用 kernel forwarding。
|
||||
- 创建 `/dev/shm/voip_rec` 3 GiB tmpfs,子目录:
|
||||
- `spool`
|
||||
- `incoming`
|
||||
- `ready`
|
||||
- `failed`
|
||||
- `tmp`
|
||||
- 部署录音 finalizer,将 `incoming` 下完成文件移动为 `ready/<path>.part`,再原子重命名为 `ready/<path>.ready`。
|
||||
- 新增 `lisglosips-a-firewall.service`,重启后自动加载 S18/S19 nftables 规则。
|
||||
- 新增 OpenSIPS drop-in,等待 Tailscale 地址 `100.90.90.90` 后再启动,避免开机绑定失败。
|
||||
- 覆盖 `rtpengine-recording-daemon.service`,移除包默认 NFS/rpcbind 依赖,改为依赖本机 tmpfs 和 `rtpengine-daemon`。
|
||||
- 停止并 mask `rpcbind.service`、`rpcbind.socket`。S19 录音缓冲不使用 NFS。
|
||||
|
||||
## 关键文件
|
||||
|
||||
服务器文件:
|
||||
|
||||
- `/etc/rtpengine/rtpengine.conf`
|
||||
- `/etc/rtpengine/rtpengine-recording.conf`
|
||||
- `/etc/default/rtpengine-daemon`
|
||||
- `/etc/default/rtpengine-recording-daemon`
|
||||
- `/etc/nftables.d/lisglosips-s19-rtpengine.nft`
|
||||
- `/etc/systemd/system/lisglosips-a-firewall.service`
|
||||
- `/etc/systemd/system/opensips.service.d/10-lisglosips-wait-tailscale.conf`
|
||||
- `/etc/systemd/system/rtpengine-recording-daemon.service`
|
||||
- `/etc/systemd/system/lisglosips-recording-finalize.service`
|
||||
- `/etc/systemd/system/lisglosips-recording-finalize.timer`
|
||||
- `/etc/tmpfiles.d/lisglosips-voip-rec.conf`
|
||||
- `/usr/local/sbin/lisglosips-recording-finalize`
|
||||
- `/etc/fstab`
|
||||
|
||||
仓库副本:
|
||||
|
||||
- `infra/server-a/s19/rtpengine/`
|
||||
- `infra/server-a/s19/nftables/`
|
||||
- `infra/server-a/s19/systemd/`
|
||||
- `infra/server-a/s19/tmpfiles/`
|
||||
- `infra/server-a/s19/scripts/`
|
||||
|
||||
## 运行参数
|
||||
|
||||
RTPEngine:
|
||||
|
||||
- 媒体地址:`100.90.90.90`
|
||||
- RTP 端口范围:`30000-40000/udp`
|
||||
- NG 控制口:`127.0.0.1:2223/udp`
|
||||
- CLI:`127.0.0.1:2224/tcp`
|
||||
- HTTP/metrics:`127.0.0.1:2225/tcp`
|
||||
- 录音 spool:`/dev/shm/voip_rec/spool`
|
||||
|
||||
防火墙:
|
||||
|
||||
- 允许 T `100.93.185.30` 到 A `30000-40000/udp`
|
||||
- 丢弃其他来源到 A `30000-40000/udp`
|
||||
- 阻断非本地访问 `2223/udp`、`2224/tcp`、`2225/tcp`
|
||||
|
||||
## 验收记录
|
||||
|
||||
- 重启后 `systemctl is-system-running` 为 `running`,无 failed unit。
|
||||
- `opensips`、`rtpengine-daemon`、`rtpengine-recording-daemon`、`lisglosips-recording-finalize.timer`、`lisglosips-a-firewall.service`、`lisglosips-node-exporter.service` 均 active/enabled。
|
||||
- `/dev/shm/voip_rec` 为 3.0 GiB tmpfs,目录属主 `rtpengine:rtpengine`,权限 `0750`。
|
||||
- `xt_RTPENGINE` 已加载;DKMS 状态为 installed。
|
||||
- `rtpengine-ctl -ip 127.0.0.1 -port 2224 list interfaces` 显示 `100.90.90.90`,端口段 `30000 - 40000`。
|
||||
- nftables 表 `lisglosips_s19_rtpengine` 重启后存在。
|
||||
- 从 T 向 A `30000/udp`、`40000/udp` 发送探针,A 在 `tailscale0` 抓包可见。
|
||||
- 从 T 发 SIP `OPTIONS` 到 A `15060/udp` 返回 `SIP/2.0 200 Keepalive`。
|
||||
- 从 T 发 SIP `REGISTER` 到 A `15060/udp` 返回 `SIP/2.0 401 Authentication Required` 和 `WWW-Authenticate`。
|
||||
- finalizer 冒烟:测试 `.wav` 从 `incoming` 移动到 `ready/...wav.ready`,权限 `0640`,无 `.part` 残留,测试文件已删除。
|
||||
|
||||
说明:S19 尚未把 OpenSIPS 呼叫路由接入 RTPEngine,真实双向通话、NAT 媒体锚定和完整录音由 S20/S21/S28 联调完成。本阶段已验证 RTPEngine 服务、内核模块、RTP 端口范围、tmpfs 和录音 ready 生命周期。
|
||||
|
||||
## 常用检查
|
||||
|
||||
```bash
|
||||
systemctl is-system-running
|
||||
systemctl is-active opensips rtpengine-daemon rtpengine-recording-daemon lisglosips-recording-finalize.timer
|
||||
findmnt /dev/shm/voip_rec
|
||||
df -h /dev/shm/voip_rec
|
||||
lsmod | grep RTPENGINE
|
||||
dkms status | grep rtpengine
|
||||
rtpengine-ctl -ip 127.0.0.1 -port 2224 list numsessions
|
||||
rtpengine-ctl -ip 127.0.0.1 -port 2224 list interfaces
|
||||
nft list table inet lisglosips_s19_rtpengine
|
||||
iptables -t mangle -L -n -v
|
||||
```
|
||||
|
||||
## 回滚
|
||||
|
||||
1. 停止 RTPEngine 与录音服务:
|
||||
|
||||
```bash
|
||||
sudo systemctl stop rtpengine-recording-daemon lisglosips-recording-finalize.timer rtpengine-daemon
|
||||
```
|
||||
|
||||
2. 从备份目录恢复被覆盖的配置:
|
||||
|
||||
```bash
|
||||
sudo rsync -a /var/backups/lisglosips-s19/20260621T054645Z/etc/ /
|
||||
```
|
||||
|
||||
3. 移除 S19 新增防火墙表和服务:
|
||||
|
||||
```bash
|
||||
sudo nft delete table inet lisglosips_s19_rtpengine || true
|
||||
sudo systemctl disable --now lisglosips-a-firewall.service || true
|
||||
sudo rm -f /etc/systemd/system/lisglosips-a-firewall.service
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
4. 如需卸载 RTPEngine 包,先解除 hold,再卸载:
|
||||
|
||||
```bash
|
||||
sudo apt-mark unhold rtpengine rtpengine-daemon rtpengine-recording-daemon rtpengine-iptables rtpengine-kernel-dkms rtpengine-utils
|
||||
sudo apt-get remove --purge rtpengine rtpengine-daemon rtpengine-recording-daemon rtpengine-iptables rtpengine-kernel-dkms rtpengine-utils
|
||||
```
|
||||
|
||||
5. 如需移除 tmpfs,先确认无待搬运录音,再卸载并删除 `/etc/fstab` 中对应行。
|
||||
|
||||
回滚不涉及 SSH 管理策略,不禁用 SSH 密钥登录。
|
||||
Reference in New Issue
Block a user