终端管理(Endpoint Manager)

Endpoint Manager 提供 IP 电话零 touch 自动配置(Zero-Touch Provisioning)。

1. 启用

[proxy]
addons = ["endpoint-manager"]

数据库要求:自动创建 endpoint_devices 表。支持 SQLite / MySQL / PostgreSQL。

2. 支持的品牌

品牌配置格式型号示例
Yealink纯文本T42S, T46S, T54S, VP530
FanvilXMLX3S, X4S, X5S, X6S

3. 设备管理

3.1 添加设备

控制台 → Endpoint Manager → 添加设备:

字段说明示例
MAC 地址话机 MAC80:5E:C0:12:34:56
品牌/型号话机型号Yealink T46S
标签显示名称张三分机 1001
用户名SIP 注册用户名1001
密码SIP 注册密码********
服务器地址SIP 服务器203.0.113.10:5060

3.2 自动配置流程

话机上电
    │
    ▼
DHCP 获取 IP + Option 66/160 (Provision URL)
    │
    ▼
话机请求配置
GET /provision/{mac}
    │
    ▼
Endpoint Manager 查找设备
    │
    ├── 找到 → 生成对应品牌/型号的配置文件 → 返回
    └── 未找到 → 返回 404

3.3 DHCP 配置

在 DHCP 服务器中配置:

# ISC DHCP
option option-66 "http://203.0.113.10:8080/provision";

# 或 Option 160 (部分品牌)
option option-160 "http://203.0.113.10:8080/provision";

3.4 配置生成

Endpoint Manager 根据品牌自动生成配置:

Yealink 示例:

#!version:1.0.0.1
account.1.enable = 1
account.1.label = 1001
account.1.display_name = 1001
account.1.auth_name = 1001
account.1.user_name = 1001
account.1.password = ********
account.1.sip_server_host = 203.0.113.10
account.1.sip_server_port = 5060

Fanvil 示例:

<config>
  <sip_account>
    <enable>1</enable>
    <display_name>1001</display_name>
    <auth_name>1001</auth_name>
    <user_name>1001</user_name>
    <password>********</password>
    <sip_server>203.0.113.10</sip_server>
    <sip_port>5060</sip_port>
  </sip_account>
</config>

4. 远程重启

通过 SIP NOTIFY 触发话机重启:

POST /console/endpoint-manager/devices/{mac}/reboot

5. 配置

config/endpoint_manager.toml:

provision_url_base = "http://203.0.113.10:8080/provision"

6. API

操作端点
设备列表GET /console/endpoint-manager/devices
添加设备POST /console/endpoint-manager/devices
编辑设备POST /console/endpoint-manager/devices/{mac}/edit
删除设备POST /console/endpoint-manager/devices/{mac}/delete
重启设备POST /console/endpoint-manager/devices/{mac}/reboot
自动配置GET /provision/{mac}
设置GET /console/endpoint-manager/settings