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:

FieldDescriptionExample
Match PrefixCallee number prefix86
SIP TrunkTarget trunkcarrier-a
PriorityLower number = higher priority10
WeightTraffic distribution ratio at same priority100
Callee StripRemove first N digits from callee0
Callee PrependAdd prefix to calleeNone
Callee RegexRegex replacementNone
Caller PoolRotating caller ID listMultiple 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:

  1. Trie longest prefix match finds all matching rules
  2. Sorted by priority (lower number first)
  3. Within the same priority, weighted round-robin by weight
  4. If LCR is enabled, same-priority trunks are sorted by buy price ascending
  5. 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

ParameterDescriptionDefault
max_failoverMaximum failover attempts3
retry_interval_msRetry interval0
failure_codesSIP 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”:

  1. Exports to routing_profiles.generated.toml
  2. Rebuilds the in-memory routing Trie
  3. 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.