Dynamic Routing Module Documentation
Table of Contents
Section titled “Table of Contents”- Navigation & Access
- Screenshots & Visual Interface
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Fields Reference
- How It Works
- Common Scenarios & Examples
- Model Context Protocol (MCP) AI Integration
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
Navigation & Access
Section titled “Navigation & Access”To access the Dynamic Routing module:
- Log in to the Ring2All Web Portal.
- In the left navigation sidebar, expand PBX Engine.
- Under Call Routing, click Dynamic Routing (
/pbx/calls-routing/dynamic).
Screenshots & Visual Interface
Section titled “Screenshots & Visual Interface”Dynamic Routing Pending Entries View
Section titled “Dynamic Routing Pending Entries View”Displays active dynamic route entries awaiting callback, including caller token/number, mapped internal extension, and expiration timestamps.

Dynamic Routing Configuration Form
Section titled “Dynamic Routing Configuration Form”Provides global domain settings for digits matching, automatic record purging upon callback answer, expiration window, and missed-call-only filtering.

1. Module Overview (Technical)
Section titled “1. Module Overview (Technical)”What Is Dynamic Routing?
Section titled “What Is Dynamic Routing?”Dynamic Routing (also called “Callback on No Answer”) is a feature that automatically routes inbound calls to the extension that previously called the caller. When an extension makes an outbound call that goes unanswered, the system registers the caller ID. If that person calls back, they’re automatically routed to the original extension.
Architecture
Section titled “Architecture”┌─────────────────────────────────────────────────────────────────┐│ Dynamic Routing System │├─────────────────────────────────────────────────────────────────┤│ ││ PHASE 1: OUTBOUND CALL (Registration) ││ ─────────────────────────────────────── ││ Extension 1001 calls +15055551234 ││ │ ││ ▼ ││ [Outbound call goes to gateway] ││ │ ││ ▼ ││ Call NOT answered (NO_ANSWER, USER_BUSY, etc.) ││ │ ││ ▼ ││ ┌──────────────────────────────────────────────────────────┐ ││ │ dynamic_routing_register.lua │ ││ │ │ ││ │ 1. Check extension has dynamic_routing_enabled │ ││ │ 2. Check only_keep_missed_calls config │ ││ │ 3. Normalize destination: +15055551234 → 5055551234 │ ││ │ 4. Apply digits_match: 5055551234 → 5551234 (7 digits) │ ││ │ 5. Insert into public.dynamic_route_entries │ ││ │ -> token: 5551234, extension: 1001 │ ││ │ │ ││ └──────────────────────────────────────────────────────────┘ ││ ││ ═══════════════════════════════════════════════════════════ ││ ││ PHASE 2: INBOUND CALLBACK (Matching) ││ ──────────────────────────────────── ││ +15055551234 calls in ││ │ ││ ▼ ││ ┌──────────────────────────────────────────────────────────┐ ││ │ route_with_fallback.lua │ ││ │ │ ││ │ 1. Normalize caller ID: +15055551234 → 5551234 │ ││ │ 2. Query public.dynamic_route_entries WHERE │ ││ │ token LIKE '%5551234' AND expires_at > NOW() │ ││ │ 3. Match found! extension = 1001 │ ││ │ 4. Route caller directly to extension 1001 │ ││ │ 5. Delete entry if delete_used_records = true │ ││ │ │ ││ └──────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘2. Module Overview (Commercial/Business)
Section titled “2. Module Overview (Commercial/Business)”Business Value
Section titled “Business Value”Dynamic Routing provides automatic callback recognition:
| Without Dynamic Routing | With Dynamic Routing |
|---|---|
| Callback goes to main IVR | Callback goes to original caller |
| Caller navigates menus | Direct connection |
| Receptionist routing | Automatic routing |
| Poor callback experience | Seamless callback |
Use Cases
Section titled “Use Cases”-
Sales Teams
- Sales rep calls prospect
- Prospect calls back → routed to same rep
- Better customer relationships
-
Support Teams
- Tech calls back customer
- Customer returns call → same tech
- Continuity of service
-
Personal Extensions
- User makes outbound call
- Callback routed to their extension
- Personal call management
Feature Highlights
Section titled “Feature Highlights”| Feature | Benefit |
|---|---|
| Automatic Registration | No manual setup |
| Missed Calls Only | Register unanswered calls |
| Configurable Expiration | Time-limited matching |
| Digits Match | Flexible caller ID matching |
| Per-Extension Enable | Selective activation |
| Auto-Delete | Clean up after callback |
3. Module Overview (End User/Administrator)
Section titled “3. Module Overview (End User/Administrator)”What Can You Do?
Section titled “What Can You Do?”Domain Configuration:
- Set digits to match (caller ID suffix)
- Configure expiration time
- Enable/disable delete after use
- Enable/disable missed calls only
Extension Settings:
- Enable dynamic routing per extension
Pending Routes:
- View active callback entries
- Delete entries manually
- Search by caller ID or extension
Administrator Workflow
Section titled “Administrator Workflow”┌─────────────────────────────────────────────────────────────────┐│ Dynamic Routing Configuration │├─────────────────────────────────────────────────────────────────┤│ ││ Tab: Configuration ││ ┌────────────────────────────────────────────────────────────┐ ││ │ │ ││ │ Caller ID Digits to Match: [7 ] │ ││ │ (Extracts last N digits from caller ID for matching) │ ││ │ │ ││ │ Expiration (Minutes): [60 ] │ ││ │ (How long entries remain valid) │ ││ │ │ ││ │ ☑ Delete Used Records │ ││ │ (Remove entry after successful callback routing) │ ││ │ │ ││ │ ☑ Only Keep Missed Calls │ ││ │ (Only register calls not answered by called party) │ ││ │ │ ││ └────────────────────────────────────────────────────────────┘ ││ ││ Tab: Pending Routes ││ ┌────────────────────────────────────────────────────────────┐ ││ │ Caller ID │ Extension │ Expires At │ Actions │ ││ │ 5551234 │ 1001 │ 2026-01-16 17:00 │ [Delete] │ ││ │ 5559999 │ 1002 │ 2026-01-16 17:30 │ [Delete] │ ││ └────────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘Extension Enable
Section titled “Extension Enable”In Extension settings:
Extension 1001 → Dynamic Routing Enabled: ✓Quick Tips
Section titled “Quick Tips”[!TIP] Digits Match = 7: Works well for 10-digit numbers where prefix varies.
[!TIP] Expiration = 60: One hour is typical for callback windows.
[!CAUTION] Too Few Digits: Low digits_match may cause false matches.
4. Configuration Fields Reference
Section titled “4. Configuration Fields Reference”Domain Configuration
Section titled “Domain Configuration”| Field | Description | Default |
|---|---|---|
| Digits to Match | Last N digits of caller ID to use | 7 |
| Expiration (Minutes) | How long entries remain valid | 60 |
| Delete Used Records | Remove entry after callback routed | On |
| Only Keep Missed Calls | Only register unanswered calls | On |
Digits Match Examples
Section titled “Digits Match Examples”| Caller ID | Digits Match | Token Stored |
|---|---|---|
| +15055551234 | 7 | 5551234 |
| +15055551234 | 10 | 5055551234 |
| +15055551234 | 0 (blank) | 15055551234 |
Missed Call Detection
Section titled “Missed Call Detection”These hangup causes register an entry:
NO_ANSWERUSER_BUSYCALL_REJECTEDORIGINATOR_CANCELNO_USER_RESPONSESUBSCRIBER_ABSENTDESTINATION_OUT_OF_ORDER
Extension Settings
Section titled “Extension Settings”| Field | Description |
|---|---|
| Dynamic Routing Enabled | Enable callback registration for this extension |
5. How It Works
Section titled “5. How It Works”Registration Flow (Outbound)
Section titled “Registration Flow (Outbound)”1. Extension 1001 dials 9180055512342. Route strips 9, dials 18005551234 via gateway3. Call is NOT answered (NO_ANSWER)4. route_with_fallback.lua completes bridge5. dynamic_routing_register.lua runs: - Check: extension has dynamic_routing_enabled? ✓ - Check: only_keep_missed_calls & is this a missed call? ✓ - Normalize: 18005551234 → digits → 5551234 (7 digits) - Insert: token=5551234, extension=1001, expires=NOW()+60minMatching Flow (Inbound)
Section titled “Matching Flow (Inbound)”1. Caller +18005551234 calls in2. route_with_fallback.lua starts3. Check dynamic_route_entries: - Normalize caller ID → 5551234 - Query: WHERE token LIKE '%5551234' AND expires_at > NOW() - Match found! extension = 10014. Route caller to extension 10015. If delete_used_records: DELETE entryToken Matching Logic
Section titled “Token Matching Logic”Digits Match = 7
Outbound: +15055551234 → Store: 5551234Inbound: +18005551234 → Match: %5551234
Token: 5551234Query: WHERE token LIKE '%5551234'Match: ✓6. Common Scenarios & Examples
Section titled “6. Common Scenarios & Examples”Scenario 1: Sales Rep Callback
Section titled “Scenario 1: Sales Rep Callback”Configuration:
| Setting | Value |
|---|---|
| Digits Match | 7 |
| Expiration | 120 min |
| Delete Used | ✓ |
| Only Missed | ✓ |
Flow:
- Sales rep 1001 calls prospect
- Prospect doesn’t answer
- Entry created: 5551234 → 1001
- Prospect calls back 30 min later
- Routed directly to extension 1001
Scenario 2: Support Technician
Section titled “Scenario 2: Support Technician”Configuration:
| Setting | Value |
|---|---|
| Digits Match | 10 |
| Expiration | 480 min (8 hours) |
| Delete Used | ✓ |
| Only Missed | Off |
Flow:
- Tech 1002 calls customer, call answered
- Entry created (even though answered)
- Customer calls back later
- Routed to same tech
Scenario 3: High Volume Call Center
Section titled “Scenario 3: High Volume Call Center”Configuration:
| Setting | Value |
|---|---|
| Digits Match | 7 |
| Expiration | 30 min |
| Delete Used | ✓ |
| Only Missed | ✓ |
Flow:
- Short expiration to reduce false matches
- Only missed calls to reduce entries
- Auto-delete to keep table clean
7. Model Context Protocol (MCP) AI Integration
Section titled “7. Model Context Protocol (MCP) AI Integration”Ring2All exposes native Model Context Protocol (MCP) tools for Dynamic Routing (Smart Callback), enabling AI assistants, CRM automation bots, and contact center supervisors to inspect dynamic callback rules, query pending callback tokens across customer numbers, adjust matching parameters in real time, and prune stale callback records programmatically with domain-level isolation.
Available MCP Tools
Section titled “Available MCP Tools”| Tool Name | Description | Key Parameters |
|---|---|---|
get_dynamic_routing_config |
Retrieves the domain’s current Dynamic Routing configuration, including digits match length, record expiration window, and purge flags. | None |
update_dynamic_routing_config |
Updates dynamic callback behavior: number of digits to match from caller ID (1-20), expiration in minutes, and flags for purging answered records or logging missed calls only. | digitsMatch (string), expirationMinutes (number), deleteUsedRecords (boolean), onlyKeepMissedCalls (boolean) |
list_dynamic_route_entries |
Lists active remembered callback entries awaiting incoming customer callbacks, showing phone token, mapped agent extension, and expiration timestamps. | search (optional string - phone number or extension) |
delete_dynamic_route_entry |
Manually removes/expires a specific remembered dynamic route entry before its TTL expires. | id (required number) |
Operational Logic & Guardrails
Section titled “Operational Logic & Guardrails”- Domain-Isolated Memory: Dynamic route entries and configurations are strictly bound to
domain_id. Customer numbers called from one tenant will never trigger callback routing into a different tenant’s extensions. - Atomic Upsert Config: Configuration updates execute atomic PostgreSQL
ON CONFLICT (domain_id) DO UPDATEqueries, eliminating race conditions when multiple automation triggers update matching windows. - Fast In-Memory Dialplan Evaluation: Inbound matching queries execute direct index-backed queries in
route_with_fallback.lua, ensuring sub-millisecond route decisions during high-volume call traffic.
AI Agent Operational Examples
Section titled “AI Agent Operational Examples”Auditing Active Dynamic Callback Entries for a Customer Number
Section titled “Auditing Active Dynamic Callback Entries for a Customer Number”{ "tool": "list_dynamic_route_entries", "arguments": { "search": "5551234" }}Adjusting Dynamic Callback Window for High-Urgency Campaigns
Section titled “Adjusting Dynamic Callback Window for High-Urgency Campaigns”{ "tool": "update_dynamic_routing_config", "arguments": { "digitsMatch": "10", "expirationMinutes": 180, "deleteUsedRecords": true, "onlyKeepMissedCalls": true }}Recommended Natural Language Prompts
Section titled “Recommended Natural Language Prompts”- “Check the current Dynamic Routing configuration for this domain.”
- “Show me all pending callback entries currently registered for extension 1001.”
- “Increase the dynamic callback expiration window to 2 hours.”
- “Remove the dynamic route entry with ID 42.”
8. Limitations & Important Notes
Section titled “8. Limitations & Important Notes”Technical Notes
Section titled “Technical Notes”[!NOTE] Suffix Matching: Uses SQL
LIKE '%token'for flexible matching.
[!WARNING] False Matches: Too few digits_match may route wrong caller.
[!WARNING] International Prefixes: Ensure consistent normalization for global use.
Best Practices
Section titled “Best Practices”- Use 7-10 Digits: Balances flexibility and accuracy
- Set Reasonable Expiration: 1-2 hours typical
- Enable Delete Used: Prevents stale entries
- Enable Only Missed: Reduces unnecessary entries
- Test Before Production: Verify matching works correctly
9. Troubleshooting Tips
Section titled “9. Troubleshooting Tips”Common Issues
Section titled “Common Issues”| Symptom | Possible Cause | Solution |
|---|---|---|
| No entry created | Extension not enabled | Enable dynamic_routing_enabled |
| Entry not created | Call was answered | Check only_keep_missed_calls |
| No match found | Digits don’t match | Adjust digits_match |
| Entry expired | Expiration too short | Increase expiration_minutes |
| Wrong extension | Digits too few | Increase digits_match |
Diagnostic SQL
Section titled “Diagnostic SQL”Check domain configuration:
SELECT * FROM public.dynamic_routing_configsWHERE domain_id = [domain_id];List pending entries:
SELECT id, token, extension, expires_at, created_atFROM public.dynamic_route_entriesWHERE domain_id = [domain_id] AND expires_at > NOW()ORDER BY created_at DESC;Check extension setting:
SELECT extension, dynamic_routing_enabledFROM public.sip_extensionsWHERE domain_id = [domain_id] AND extension = '1001';Telephony Server Logs
Section titled “Telephony Server Logs”# Check registrationgrep "DYNAMIC_ROUTING_REGISTER" /var/log/freeswitch/freeswitch.log
# Check matchinggrep "DYNAMIC_ROUTING" /var/log/freeswitch/freeswitch.log10. Glossary
Section titled “10. Glossary”| Term | Definition |
|---|---|
| Dynamic Routing | Automatic callback-to-extension routing |
| Token | Normalized caller ID digits stored for matching |
| Digits Match | Number of digits to extract from caller ID |
| Expiration | How long an entry remains valid |
| Delete Used | Remove entry after successful callback |
| Only Missed | Only register unanswered outbound calls |
Documentation last updated: January 2026

