架构概览

1
2
3
4
5
6
7
8
9
┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│ FreeSWITCH │────▶│ Core │────▶│ Edge │
│ (distributor.conf)│ (dispatcher) │ (dispatcher) │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ MySQL DB │◀────� MySQL DB │
└─────────────┘ └─────────────┘

分发配置查看

FreeSWITCH 下一跳

查看 distributor.conf 中的 core_ip 列表。

Core/Edge 下一跳

1
opensipsctl fifo ds_list

查看 dispatcher 表中的路由配置。


数据库表功能

表名 功能 查看命令 备注
load_balance FS 对应的地址 - 负载均衡配置
node_address Edge 地址 - 新增 Edge 前必须先新增,否则起不来
location 分机注册信息 ul_show / fifo ul_dump 保存在内存中,集群内部共享
du_rules 动态路由规则 - Dynamic Routing Rules
domains 域名表 - 域名配置
cluster Core 集群 - 有一个 Core 就显示一个
subscriber 认证账号表 - 注册分机先查密码,认证成功存储到内存 location中
dr_gateways 网关 fifo dr_gateways_status / fifo dr_reload reload 网关
carrierroute 中继/路由 fifo cr_dump_routes / cr_reload_routes 按号码前缀做运营商路由
drouting 动态路由 - 与 dr_gateways 配合使用

常用 FIFO 命令

Location(分机注册)

1
2
opensipsctl fifo ul_dump
opensipsctl fifo ul_show

Dispatcher(路由分发)

1
2
opensipsctl fifo ds_list
opensipsctl fifo ds_reload

Dynamic Routing(动态路由)

1
2
3
4
opensipsctl fifo dr_gateways_status
opensipsctl fifo dr_reload
opensipsctl fifo cr_dump_routes
opensipsctl fifo cr_reload_routes

Drouting 匹配逻辑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
┌─────────────────┐
│ 接收被叫号码 │
└────────┬────────┘
│
▼
┌─────────────────┐
│ 确定 groupid │
└────────┬────────┘
│
▼
┌─────────────────┐
│ 匹配 prefix │
│ (最长前缀优先) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ 检查 timerec │
│ 检查 priority │
└────────┬────────┘
│
▼
┌─────────────────┐
│ 根据 gwlist │
│ 选择 gateway/ │
│ carrier │
└─────────────────┘

匹配顺序:

  1. 确定 groupid — 先确定路由组 ID
  2. 匹配 prefix — 按被叫号码匹配前缀,优先选择最长 prefix
  3. 检查 timerec / priority — 同一 prefix 下按时间和优先级排序
  4. 选择 gateway/carrier — 根据 gwlist 选择网关或运营商

Edge 新增流程

1
2
3
4
1. 在 node_address 表中新增 Edge 地址
2. 启动 Edge 服务
3. 在 dispatcher 表中配置路由
4. 执行 ds_reload 生效

注意:如果在 node_address 中没有对应的 Edge 地址,Edge 服务无法启动。


相关文档



© 2018–2026 小周周 · 使用 Stellar 构建

站内搜索

没有找到内容!