Files
lisglosips/docs/SERVER_T_CUSTOMER_SIMULATION_RUNBOOK.md
T

82 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Server T 客户模拟配置 Runbook
> 任务:S21 - Server T 客户模拟配置
> 完成时间:2026-06-21 15:28 +08:00
> 环境:本地 KVM Server T `100.93.185.30`
## 1. 变更范围
- 在 Server T 部署独立脚本目录 `/opt/lisglosips-s21`
- 新增受控配置文件 `/etc/lisglosips-s21/sip-accounts.env`,权限 `0640 root:hector`
- 新增 OpenSIPS 测试域 `s21.lisglosips.test`
- 新增两套 SIP 注册测试账号:
- `s21-reg-1001@s21.lisglosips.test`
- `s21-reg-1002@s21.lisglosips.test`
- 新增两套 IP 认证测试条目:
- `s21-ip-1001``100.93.185.30/32`
- `s21-ip-1002``100.93.185.30/32`
- 将 T 的 OpenSIPS `auth_db calculate_ha1` 调整为 `0`,账号只保存 HA1,不保存 SIP 明文密码。
- 将 T 的 OpenSIPS `mi_fifo fifo_mode` 调整为 `0660`
- 将 T 的 OpenSIPS TLS 私钥文件权限收敛为 `0600`
## 2. 脚本清单
脚本均位于 `/opt/lisglosips-s21`
| 脚本 | 用途 |
| --- | --- |
| `s21-register-primary` | 主 SIP 注册账号成功注册 |
| `s21-register-secondary` | 备用 SIP 注册账号成功注册 |
| `s21-register-wrong-ha1` | 错误鉴权失败场景 |
| `s21-call-a-ip` | 从 T 向 A `100.90.90.90:15060` 发起 IP 认证模拟 INVITE |
| `s21-call-a-sip` | 从 T 向 A 发起 SIP 注册账号模拟 INVITE |
| `s21-local-success` | T 本地 200 OK 呼叫场景 |
| `s21-local-busy` | T 本地 486 Busy Here 场景 |
| `s21-local-reject` | T 本地 603 Decline 场景 |
| `s21-local-timeout` | T 本地超时场景 |
| `s21-over-cps-a` | 从 T 向 A 突发 INVITE,模拟超 CPS/突发压测输入 |
所有脚本都会输出 `call_id=...` 和 SIP 状态,便于后续在 A、B、HOMER、Redis Stream 中按 Call-ID 串联排查。
## 3. 验证结果
- `opensips -C -f /etc/opensips/opensips.cfg` 通过。
- `opensips.service``active`
- `s21-register-primary`:先收到 `401 Unauthorized` challenge,最终 `200 OK`
- `s21-register-secondary`:先收到 `401 Unauthorized` challenge,最终 `200 OK`
- `s21-register-wrong-ha1`:最终保持 `401 Unauthorized`
- `location` 表已有 `s21-reg-1001``s21-reg-1002` 注册位置。
- `subscriber.password` 长度为 `0``subscriber.ha1` 长度为 `32`,未保存 SIP 明文密码。
- 本地场景:
- `s21-local-success` 返回 `SIP/2.0 200 OK`
- `s21-local-busy` 返回 `SIP/2.0 486 Busy Here`
- `s21-local-reject` 返回 `SIP/2.0 603 Decline`
- `s21-local-timeout` 返回 `NO RESPONSE`
- 到 A 的探针:
- `s21-call-a-ip` 返回 `SIP/2.0 503 Config Missing`
- `s21-call-a-sip` 返回 `SIP/2.0 503 Config Missing`
- `s21-over-cps-a 5 0.01` 5 个 Call-ID 均返回 `SIP/2.0 503 Config Missing`
说明:A 端当前处于 S20 热路径阶段,尚未发布真实客户/路由配置,因此到 A 的 INVITE 返回 `503 Config Missing` 是当前预期;S21 验收重点是 T 端脚本可重复执行并输出 Call-ID。
## 4. 回滚方式
回滚点:
```text
/var/backups/lisglosips-s21/20260621T072316Z
```
回滚步骤:
```bash
sudo systemctl stop opensips
sudo cp -a /var/backups/lisglosips-s21/20260621T072316Z/opensips /etc/opensips
sudo mysql --protocol=socket -uroot opensips < /var/backups/lisglosips-s21/20260621T072316Z/opensips.sql
sudo rm -rf /opt/lisglosips-s21 /etc/lisglosips-s21
sudo opensips -C -f /etc/opensips/opensips.cfg
sudo systemctl start opensips
```
回滚会删除 S21 的测试账号、注册位置、IP 认证测试数据和脚本。若后续任务已依赖这些脚本,应先暂停相关测试。