Routing Profiles
Routing profiles determine how a tenant’s outbound call traffic selects trunks.
1. Routing Profile Structure
Routing Profile
├── Routing Rule 1 ──► Prefix match → Trunk selection → Number rewriting
├── Routing Rule 2 ──► ...
└── Routing Rule N ──► ...
2. Create a Routing Profile
Wholesale → Routing Profiles → Create New:
- Name: e.g. “profile-default”
- Retry policy: Whether to try the next rule on failure
- Max failover attempts: Default 3
3. Routing Rule Configuration
Each routing rule defines:
| Field | Description | Example |
|---|---|---|
| Match Prefix | Callee number prefix | 86 |
| SIP Trunk | Target trunk | carrier-a |
| Priority | Lower number = higher priority | 10 |
| Weight | Traffic distribution ratio at same priority | 100 |
| Callee Strip | Remove first N digits from callee | 0 |
| Callee Prepend | Add prefix to callee | None |
| Callee Regex | Regex replacement | None |
| Caller Pool | Rotating caller ID list | Multiple caller IDs |
3.1 Priority & Weight
Callee: 861012345678
Rule matches:
├── Priority 10, carrier-a, weight 80 ← matches prefix "86"
├── Priority 10, carrier-b, weight 20 ← matches prefix "86"
└── Priority 20, carrier-c, weight 100 ← matches prefix "8610"
Matching logic:
- Trie longest prefix match finds all matching rules
- Sorted by priority (lower number first)
- Within the same priority, weighted round-robin by weight
- If LCR is enabled, same-priority trunks are sorted by buy price ascending
- If the call fails, try the next priority
3.2 Caller ID Pool
Configure multiple caller IDs for rotation:
{
"caller_pool": ["05711234567", "05711234568", "05711234569"]
}
Use case: Carriers require caller ID rotation or limit per-number concurrency.
3.3 Number Rewriting Pipeline
Calls pass through multiple layers of number rewriting:
Original Number
→ Tenant-level rewriting (strip/prepend/regex)
→ Routing rule rewriting (strip/prepend/regex)
→ Trunk tech prefix (tech_prefix)
→ Sent to carrier
4. Failover & Retry
4.1 Retry Configuration
| Parameter | Description | Default |
|---|---|---|
| max_failover | Maximum failover attempts | 3 |
| retry_interval_ms | Retry interval | 0 |
| failure_codes | SIP status codes that trigger retry | [486, 487, 503] |
4.2 Failover Flow
carrier-a (priority 10) ──► 503 failure
└── carrier-b (priority 10) ──► timeout
└── carrier-c (priority 20) ──► success ✓
5. Hot Reload
After modifying a routing profile, click “Reload”:
- Exports to
routing_profiles.generated.toml - Rebuilds the in-memory routing Trie
- Existing calls are unaffected
6. Routing Diagnostics
Routing Diagnostic Tool (Wholesale console):
Input: Tenant ID + Callee number
Output:
- Matched routing rules (prefix, priority)
- Selected trunk
- Sell rate, buy rate
- Number rewriting results
- Circuit breaker status
Useful for troubleshooting routing issues or rate errors.