Wazo 配置参数详解

Wazo Platform v26.10 配置体系全解——conf.d 优先级规则、各微服务 config.yml + Asterisk .d 目录约定、PostgreSQL/Nginx 关键参数与 100 分机生产推荐模板

WazoWazoPBXSIP 协议VoIP 语音Asterisk PBX统一通信2026/10/27

Wazo 配置参数详解

目标:系统梳理 Wazo Platform 各类配置入口——各微服务的 config.yml + conf.d 目录的优先级规则、Asterisk 的 .d 目录自定义约定、PostgreSQL / Nginx / Redis 关键参数,以及生产环境推荐配置模板。本文覆盖 Wazo Platform v26.10,所有路径均为真实服务器上的标准路径。

一、环境信息

  • Wazo Platform 版本:26.10(2026-10-12 发布)
  • 操作系统:Debian 12 Bookworm
  • Asterisk 版本:22.11.0
  • PostgreSQL:随 Debian 12 原生版本(Wazo 仓库可能有补丁版本)
  • 配置优先级规则来源:https://wazo-platform.org/uc-doc/system/configuration_files/
  • 本文查询日期:2026-10-27

二、配置总览与优先级规则

2.1 全局配置读取机制

Wazo 的每个微服务都遵循统一的配置文件读取约定,理解这套机制是正确修改配置的前提:

服务启动 → 读取 /etc/<服务>/config.yml(默认值,不建议改)
         → 按字母序扫描 /etc/<服务>/conf.d/*.yml
         → 第一个匹配键的文件生效,后续同名键被忽略

关键点:

  • config.yml 是服务的默认配置,升级时会被覆盖,绝对不要直接修改这个文件
  • conf.d/ 目录下的文件按字母序读取,第一个文件的同名键生效,后面同名字段会被忽略
  • 忽略 .yml 结尾之外的文件(.dpkg-old、.bak、~ 等自动跳过)
  • 忽略以 . 开头的隐藏文件

2.2 优先级示例

假设有以下文件:

/etc/wazo-agentd/conf.d/
├── .01-critical.yml      ← 被忽略(点开头)
├── 02-error.yml.dpkg-old ← 被忽略(不是 .yml 结尾)
├── 10-debug.yml          ← 生效:log_level: debug
└── 20-nodebug.yml        ← log_level 被忽略(10-debug.yml 已先设定)

最终 log_level = debug(10-debug.yml 先于 20-nodebug.yml)。

💡 技术拓展:Linux 下按字母序批量生效的配置覆盖机制在众多系统软件中广泛存在——

机制例子生效规则
Systemd drop-in/etc/systemd/system/<service>.d/*.conf后加载覆盖前加载(字典序递增)
Nginx includeconf.d/*.conf字母序依次处理,后 include 覆盖前同名项
Wazo conf.d/etc/wazo-*/conf.d/*.yml字母序,第一个同名键生效
Kubernetes ConfigMap多 ConfigMap 合并后定义覆盖前定义

注意 Wazo 和 Systemd/Nginx 的关键区别:Wazo 是"第一个生效",Systemd/Nginx 是"最后一个覆盖"。写配置时记得用数字前缀确保顺序。

三、微服务配置文件路径速查表

服务config.yml 路径(不建议改)conf.d 目录(自定义放这里)额外模板/数据目录
wazo-auth/etc/wazo-auth/config.yml/etc/wazo-auth/conf.d/—
wazo-agentd/etc/wazo-agentd/config.yml/etc/wazo-agentd/conf.d/—
wazo-amid/etc/wazo-amid/config.yml/etc/wazo-amid/conf.d/—
wazo-confd/etc/wazo-confd/config.yml/etc/wazo-confd/conf.d/—
wazo-calld/etc/wazo-calld/config.yml/etc/wazo-calld/conf.d/—
wazo-confgend/etc/wazo-confgend/config.yml/etc/wazo-confgend/conf.d//etc/wazo-confgend/templates/
wazo-phoned/etc/wazo-phoned/config.yml/etc/wazo-phoned/conf.d/—
wazo-provd/etc/wazo-provd/config.yml/etc/wazo-provd/conf.d//var/lib/wazo-provd/(固件)
wazo-websocketd/etc/wazo-websocketd/config.yml/etc/wazo-websocketd/conf.d/—
wazo-plugind/etc/wazo-plugind/config.yml/etc/wazo-plugind/conf.d//var/lib/wazo-plugind/(插件)
wazo-webhookd/etc/wazo-webhookd/config.yml/etc/wazo-webhookd/conf.d/—
wazo-agid/etc/wazo-agid/config.yml/etc/wazo-agid/conf.d/—
xivo-dao/etc/xivo-dao/config.yml/etc/xivo-dao/conf.d/—
wazo-sysconfd/etc/wazo-sysconfd/config.yml/etc/wazo-sysconfd/conf.d/—

四、核心服务参数详解

4.1 wazo-auth(认证与鉴权)

查看默认配置:

cat /etc/wazo-auth/config.yml

典型自定义配置示例(如需要对接外部 OAuth2):

cat <<'EOF' > /etc/wazo-auth/conf.d/90-oauth2.yml
# 启用 OAuth2 SSO(可选,对接企业 AD / Google / GitHub)
oauth2:
  # 允许的外部提供者,可用自定义
  providers:
    google:
      client_id: "your-google-client-id.apps.googleusercontent.com"
      client_secret: "your-google-client-secret"
      authorize_url: "https://accounts.google.com/o/oauth2/auth"
      token_url: "https://oauth2.googleapis.com/token"
      userinfo_url: "https://www.googleapis.com/oauth2/v3/userinfo"
EOF
systemctl restart wazo-auth

常用参数(来自 config.yml 默认值):

参数默认值说明
listening_address0.0.0.0监听地址
listening_port9497监听端口
expiration3600token 默认有效期(秒)
db_uripostgresql://wazo:wazo@localhost/wazoPostgreSQL 连接串
redis_uriredis://localhost:6379/0Redis 连接串
certificate_path/etc/ssl/certs/wazo-auth-client.pem客户端证书
verify_certificatetrue验证 TLS 证书

4.2 wazo-confd(配置管理 API)

默认配置查看:

cat /etc/wazo-confd/config.yml | head -40

关键环境变量(Docker 部署时用;裸机部署时 confd 从 config.yml 读取):

环境变量默认值说明
WAZO_CONFD_PORT9486confd REST API 端口
WAZO_AUTH_HOSTlocalhostwazo-auth 服务地址
WAZO_AUTH_PORT9497wazo-auth 服务端口
DB_URI—PostgreSQL 连接串
XIVO_UUID—系统唯一 ID(安装时自动生成)

自定义参数变更不需要重启——很多 API 端点写入后立即生效(confgend 自动 reload Asterisk)。但 conf.d/*.yml 里的服务级参数需要重启。

# 示例:给 confd 增加超时保护
cat <<'EOF' > /etc/wazo-confd/conf.d/90-timeout.yml
http:
  timeout: 30
  cors:
    enabled: true
    origins:
      - "https://my-wazo-web.example.com"
EOF
systemctl restart wazo-confd

4.3 wazo-confgend(配置生成器,关键但容易被忽略)

wazo-confgend 负责把 wazo-confd 数据库里的配置生成成 Asterisk 的配置文件(pjsip.conf、extensions.conf、queues.conf 等)。它不是一个对外暴露端口的服务,但 Asterisk 的配置几乎全是它生成的。

默认配置文件:

cat /etc/wazo-confgend/config.yml | head -30

最常见的自定义场景:启用 Asterisk 自带但 Wazo 默认没开的模块。

例如启用 res_cli_aliases.so(Asterisk CLI 别名):

# 第一步:在 wazo-confgend 配置里声明要启用的模块
cat <<'EOF' > /etc/wazo-confgend/conf.d/enable-res_cli_aliases.yml
enabled_asterisk_modules:
  res_cli_aliases.so: true
EOF

# 第二步:重启 confgend 让配置生效
systemctl restart wazo-confgend

# 第三步:用 wazo-confgen 手动触发一次生成(也可等下次 Asterisk 重启)
wazo-confgen asterisk/modules.conf | grep res_cli_aliases
# load => yes          ← 模块已标记为启用

# 第四步:重启 Asterisk
systemctl restart asterisk

验证模块已加载:

asterisk -rx "module show like res_cli_aliases"
# Module                         Description                              Use Count  Status
# res_cli_aliases.so             Asterisk CLI Aliases                     0          Running

4.4 wazo-websocketd(实时事件推送)

# 默认配置
cat /etc/wazo-websocketd/config.yml

常用参数:

参数默认值说明
listen0.0.0.0:9502监听地址
ping_interval30WebSocket ping 间隔(秒)
ping_timeout30等待 pong 超时(秒)
token_renewal_timeout60token 剩余有效期低于此值时提醒客户端续期

五、Asterisk 配置(/etc/asterisk)

5.1 目录结构与自定义规则

/etc/asterisk/
├── asterisk.conf          ← 不要自定义(wazo-confgend 生成)
├── modules.conf           ← 不要自定义(wazo-confgend 生成 + 自动覆盖)
├── pjsip.conf             ← 不要自定义(wazo-confgend 生成)
├── extensions.conf        ← 不要自定义(wazo-confgend 生成)
├── queues.conf            ← 不要自定义(wazo-confgend 生成)
├── features.conf          ← 不要自定义
├── manager.conf           ← 只改 manager.d/
├── music-on-hold.conf     ← 可直接改
│
├── manager.d/              ← ✅ Asterisk 管理器接口自定义用户放这里
│   └── my_new_user.conf
├── pjsip.d/                ← ✅ PJSIP 端点自定义覆盖
├── extensions_extra.d/     ← ✅ 自定义 dialplan 片段(加载在默认 extensions.conf 之后)
│   └── transfer-dtmf.conf
├── queues.d/               ← ✅ 队列自定义覆盖
├── voip-info.d/            ← ✅ SIP header 自定义
├── ...(更多 *.d/ 子目录)

规则:根目录下的 conf 文件都是 wazo-confgend 自动生成的,升级和 reload 时会被覆盖。自定义永远只写到对应的 .d/ 子目录里。

5.2 常见自定义示例

(1) 给 Asterisk Manager Interface(AMI)新增一个只读用户

cat <<'EOF' > /etc/asterisk/manager.d/my_monitor.conf
[my_monitor]
secret = v3ry5ecre7
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = originate,command
EOF
systemctl restart asterisk

(2) 自定义 SIP NAT 参数(PJSIP endpoint)

cat <<'EOF' > /etc/asterisk/pjsip.d/90-corporate-nat.conf
# 全局 NAT 策略(企业内网场景)
[general]
externaddr = 203.0.113.10        # 公网 SIP trunk 接入地址
localnet = 10.0.0.0/8            # 内网地址段(NAT 后面的设备)
EOF
systemctl restart asterisk

(3) 给 transfer 添加自定义 DTMF 功能码

cat <<'EOF' > /etc/asterisk/extensions_extra.d/transfer-dtmf.conf
[allow-transfer]
exten = s,1,NoOp(## Setting transfer context ##)
same = n,Set(TRANSFER_CONTEXT=my-transfer-context)
same = n,Return()
EOF
asterisk -rx "dialplan reload"

5.3 启 Asterisk 新模块的正确姿势(不是改 modules.conf)

Wazo 自动生成 modules.conf 并在每次 Asterisk 启动时覆盖。手工改没用。

启用新模块的正确步骤(以 res_cli_aliases.so 为例):

# 1. 用 wazo-confgend 声明
cat <<'EOF' > /etc/wazo-confgend/conf.d/enable-res_cli_aliases.yml
enabled_asterisk_modules:
  res_cli_aliases.so: true
EOF

# 2. 重启 confgend
systemctl restart wazo-confgend

# 3. 手动生成 modules.conf 确认
wazo-confgen asterisk/modules.conf | grep -A2 res_cli_aliases
# [res_cli_aliases]
# autoload => yes    ← ✅ 已启用

# 4. 重启 Asterisk
systemctl restart asterisk

# 5. 验证
asterisk -rx "module show like res_cli_aliases"
# ...  Status: Running

六、Nginx 配置

6.1 Wazo Nginx 结构

Wazo 用 Nginx 作为统一 HTTPS 反代,所有微服务通过 Nginx 暴露对外 API。Nginx 配置文件:

/etc/nginx/sites-available/wazo.conf
/etc/nginx/sites-enabled/wazo.conf   ← 符号链接

查看当前配置:

cat /etc/nginx/sites-enabled/wazo.conf | head -60

6.2 自定义 Nginx(如给 WebSocket 放大缓冲区)

# 不要直接改 wazo.conf,新建一个 overlay
cat <<'EOF' > /etc/nginx/sites-available/wazo-custom
server {
    listen 80;
    server_name _;
    # 强制 HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name _;

    # 证书(换成你的正式证书路径)
    ssl_certificate /etc/ssl/certs/wazo-server-cert.pem;
    ssl_certificate_key /etc/ssl/private/wazo-server-key.pem;

    # WebSocket 代理调优(给 websocketd 用)
    location /ws/ {
        proxy_pass http://localhost:9502/ws/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 3600s;   # WebSocket 长时间保持
        proxy_send_timeout 3600s;
    }

    # confd REST API
    location /api/confd/ {
        proxy_pass http://localhost:9486/api/confd/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 120s;
    }
}
EOF

# 启用自定义配置(注意:这会替换 Wazo 默认 wazo.conf)
rm -f /etc/nginx/sites-enabled/wazo.conf
ln -s /etc/nginx/sites-available/wazo-custom /etc/nginx/sites-enabled/wazo.conf

# 测试语法
nginx -t
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
# nginx: configuration file /etc/nginx/nginx.conf test is successful

# 重载
nginx -s reload

七、PostgreSQL 配置

Wazo 用 PostgreSQL 存:

  • 用户、分机、组、中继、IVR、队列等所有 PBX 配置数据
  • CDR(通话详细记录)
  • 通话录音元数据

7.1 连接配置

所有服务通过 xivo-dao 共享数据库连接。配置在 /etc/xivo-dao/config.yml:

cat /etc/xivo-dao/config.yml

典型内容:

db_uri: "postgresql://wazo:wazo@localhost/wazo"
db_port: 5432
pool_size: 5
pool_recycle: 3600

自定义连接池(生产环境建议调大):

cat <<'EOF' > /etc/xivo-dao/conf.d/10-pool-size.yml
pool_size: 20
pool_recycle: 1800
EOF
# 需重启所有用到 xivo-dao 的服务
wazo-service restart

7.2 PostgreSQL 自身调优(Debian 12)

Wazo 不直接调 PostgreSQL 参数,PostgreSQL 配置在 /etc/postgresql/<version>/main/postgresql.conf。

生产环境建议调优 16GB RAM 服务器:

cat <<'EOF' > /etc/postgresql/16/main/conf.d/wazo-tuning.conf
# PostgreSQL 调优(16GB RAM 服务器)
shared_buffers = 4GB                    # RAM 的 25%
effective_cache_size = 12GB             # RAM 的 75%
work_mem = 64MB                         # 排序/哈希中间操作
maintenance_work_mem = 1GB              # VACUUM / CREATE INDEX
max_connections = 200                   # 足够 Wazo 各服务 + 备份
EOF

systemctl restart postgresql

验证生效:

sudo -u postgres psql -c "SHOW shared_buffers;"
# shared_buffers | 4GB

八、生产环境推荐配置模板

8.1 16GB RAM / NVMe SSD / 100 分机

以下是 100 分机左右的中等规模生产环境推荐配置组合:

层级配置项值位置
系统时区Asia/Shanghaitimedatectl
系统最大文件句柄65535/etc/security/limits.conf
PostgreSQLshared_buffers4GBpostgresql.conf
PostgreSQLmax_connections200postgresql.conf
PostgreSQLautovacuum默认即可—
Asteriskexternaddr公网 SIP 中继 IPpjsip.d/*.conf
Asterisklocalnet内网网段pjsip.d/*.conf
Asteriskcodecsulaw,alaw,g729,opusconfd REST API(pjsip endpoints)
wazo-authtoken expiration3600(生产建议)/etc/wazo-auth/conf.d/
wazo-websocketdping_interval30/etc/wazo-websocketd/conf.d/
Nginxproxy_read_timeout120swazo.conf
Nginxssl_protocolsTLSv1.2 TLSv1.3wazo.conf
FirewallSIP/RTP/HTTPS 端口见安装指南 §二ufw / nftables

8.2 8GB RAM / 50 分机

下调 PostgreSQL 和 Asterisk 参数:

配置项值
shared_buffers2GB
max_connections100
Asterisk pjsip portUDP 5060(默认)
wazo-websocketd ping_interval60

九、配置变更后的生效方式速查

改了什么怎么生效
wazo-confd REST API 写入(用户/分机/中继/IVR 等)自动生效(confgend 生成 + Asterisk dialplan reload),无需手动操作
conf.d/*.yml(微服务级配置)systemctl restart wazo-<服务名>
/etc/asterisk/.d/.conf(Asterisk 配置片段)asterisk -rx "dialplan reload"(dialplan / pjsip / iax2 分别 reload)
wazo-confgend enabled_asterisk_modulessystemctl restart wazo-confgend && asterisk -rx "module load res_xxx.so"
Asterisk modules.conf(永远别改根目录)用 wazo-confgend 配置(见 §4.3),然后 systemctl restart asterisk
/etc/xivo-dao/conf.d/*.ymlwazo-service restart
PostgreSQL postgresql.confsystemctl restart postgresql
Nginx sites-enabled/*.confnginx -t && nginx -s reload

十、常见问题(FAQ)

Q1: 我改了 /etc/asterisk/pjsip.conf 为什么没生效?

原因:/etc/asterisk/pjsip.conf 是 wazo-confgend 生成的,下次 Asterisk 重启或 confgend regenerate 会被覆盖。

解决:不要改根目录文件。正确的做法是在 /etc/asterisk/pjsip.d/ 里创建一个自定义 conf 文件,或者通过 wazo-confd REST API 修改 PJSIP endpoint(推荐后者)。

Q2: 改了 wazo-auth 的 conf.d 配置后 token 验证失败?

排查:

  1. 确认 systemctl restart wazo-auth 已执行
  2. 检查 conf.d YAML 格式是否正确——缩进用空格不用 tab,键名不要拼写错
  3. journalctl -u wazo-auth -n 50 --no-pager 看启动日志里有没有 traceback

Q3: wazo-confgen asterisk/modules.conf 没显示我新启用的模块?

排查:

  1. 确认 conf.d YAML 格式正确:
    enabled_asterisk_modules:
      res_cli_aliases.so: true    # 注意缩进
    
  2. 确认 systemctl restart wazo-confgend 已执行
  3. 模块名要和 Asterisk 源码里一致,不要自己编名字

Q4: 生产环境改 Asterisk NAT 参数需要重启吗?

externaddr / localnet 这类 PJSIP 全局参数需要 systemctl restart asterisk 才能生效(不能只是 pjsip reload),因为它们影响 Asterisk 启动时的全局网络初始化。

Q5: 怎么查看当前所有 Asterisk 生效配置?

# 查看已加载的 PJSIP 端点
asterisk -rx "pjsip list endpoints"

# 查看某个 endpoint 的详细配置
asterisk -rx "pjsip show endpoint <endpoint_id>"

# 查看 dialplan 生效情况
asterisk -rx "dialplan show context default"

# 查看已加载模块
asterisk -rx "module show"

十一、参考链接

链接说明
https://wazo-platform.org/uc-doc/system/configuration_files/Wazo 官方配置文件说明
https://wazo-platform.org/uc-doc/administration/管理篇总入口(含 IVR/Queue/Voicemail 等每个子模块的配置)
https://wiki.asterisk.org/wiki/display/AST/HomeAsterisk 官方 Wiki(PJSIP、dialplan 底层细节)
https://wiki.asterisk.org/wiki/display/AST/IP+Address+and+NAT+SettingsAsterisk NAT 设置详解
https://www.quzuo.net/document/6ijNclQUrvYh本平台 Wazo Debian 12 安装指南