--- title: "Quality Routing & Carrier SLA Engine" description: "Documentation for Quality Routing" --- ## Table of Contents 1. [Overview & Architecture](#1-overview--architecture) 2. [Business & Operational Significance](#2-business--operational-significance) 3. [🎯 User Roles & Key Capabilities](#3--user-roles--key-capabilities) 4. [Visual Interface & Form Layout](#4-visual-interface--form-layout) 5. [Field & Configuration Reference](#5-field--configuration-reference) 6. [Real-Time Telephony Quality Metrics (ASR, ACD, MOS)](#6-real-time-telephony-quality-metrics-asr-acd-mos) 7. [Automated Degradation & Autonomous Rerouting](#7-automated-degradation--autonomous-rerouting) 8. [Security Best Practices & Operational Hardening](#8-security-best-practices--operational-hardening) 9. [Troubleshooting & Verification](#9-troubleshooting--verification) 10. [Glossary](#10-glossary) --- ## 1. Overview & Architecture In **Ring2All SBC**, the **Quality Routing** module (`public.carrier_quality_policies` and real-time CDR aggregation) introduces intelligent, automated quality-of-service closed-loop control to carrier routing decisions. While traditional Least Cost Routing (LCR) selects routes based solely on static tariff rates, Ring2All SBC continuously aggregates live telephony telemetryβ€”including **Answer-Seizure Ratio (ASR)**, **Average Call Duration (ACD)**, and RTPEngine **Mean Opinion Score (MOS)**. If an upstream carrier experiences fiber cuts, transcoding latency, or packet loss degradation below defined SLA thresholds, the system autonomously penalizes the route and shifts traffic to higher-performing secondary routes. ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Inbound Call Traffic β”‚ β”‚ (Continuous Real-Time Telemetry) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ RTPEngine & Kamailio CDR Engine β”‚ β”‚ β€’ Packet Loss β€’ Jitter β€’ Round-Trip β”‚ β”‚ β€’ SIP 200 OK vs 5xx Failure Codes β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Quality Routing Engine (Every 15m) β”‚ β”‚ Sliding Evaluation Window Calculation β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Quality Score Verification vs Configured Policy β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ASR >= 40% & MOS >= 4.0 β”‚ ASR < 40% OR Packet Loss > 5% β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Optimal Status β”‚ β”‚ Degraded Status β”‚ β”‚ β€’ Keep Carrier in Pool β”‚ β”‚ β€’ Trigger NOC Alert β”‚ β”‚ β€’ Normal Weight Routing β”‚ β”‚ β€’ Autonomous Reroute β”‚ β”‚ β€’ Record SLA Compliance β”‚ β”‚ β€’ Auto-Recovery Cooldown β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## 2. Business & Operational Significance * **Guaranteed Call Completion**: Protects contact centers, enterprise sales floors, and emergency lines from silent call drops, fast-busy tones, and robotic audio caused by carrier packet degradation. * **Autonomous SLA Enforcement**: Automatically detects carrier route degradation without requiring human NOC engineers to monitor dashboards 24/7 or manually modify routing tables. * **Balanced Quality vs. Cost**: Ensures telecom operators never sacrifice audio fidelity for pennies of margin; when low-cost routes degrade, traffic seamlessly ascends to premium carriers until quality restores. * **Objective Vendor Scorecards**: Generates irrefutable statistical data for carrier SLA dispute resolution, vendor billing credit negotiations, and quarterly vendor reviews. --- ## 3. 🎯 User Roles & Key Capabilities | Role | Primary Use Case | Key Capabilities | | :--- | :--- | :--- | | **SBC Administrator** | Carrier Policy Configuration | Establish global quality thresholds; define evaluation time windows; configure automatic failover actions; set cooldown recovery timers. | | **NOC Voice Engineer** | Live Quality Inspection | Monitor real-time ASR, ACD, MOS, and jitter metrics; manually trigger immediate route re-evaluation; inspect degraded gateways. | | **Telecom Procurement Lead** | Carrier Performance Auditing | Review historical carrier quality metrics across 15m, 1h, 24h, and 7d windows to assess vendor SLA compliance. | --- ## 4. Visual Interface & Form Layout ### Quality Routing Live Telemetry Dashboard The dashboard displays global telephony KPIs (Global ASR, Global ACD, Active Gateways, Degraded Count) and an interactive data grid tracking each wholesale carrier's real-time quality scores. ![Quality Routing Live Telemetry](/screenshots/sbc/routing/quality/quality-routing-list.png) ### Carrier Health & Quality Policy Form The policy view allows administrators to configure automated threshold metrics, sampling parameters, and autonomous failover actions. ![Carrier Health & Quality Policy Form](/screenshots/sbc/routing/quality/quality-routing-form.png) --- ## 5. Field & Configuration Reference ### Section 1: Quality Thresholds & Sampling | Field | Type | Options / Constraints | Description | | :--- | :--- | :--- | :--- | | **Policy Name \*** | Text | Max 100 characters | Name of the active SLA policy (e.g., `Standard Carrier Quality SLA`). | | **Enable Real-Time Health Engine** | Toggle | Boolean (`Yes` / `No`) | Activates continuous background evaluation of carrier performance metrics. | | **Minimum ASR (%) \*** | Number | `1.0` to `100.0` (Default `40.0%`) | Answer-Seizure Ratio floor. Carriers dropping below this percentage are flagged as degraded. | | **Minimum ACD (Seconds) \*** | Number | `1` to `600` (Default `30s`) | Average Call Duration floor. Drastic drops in ACD typically indicate dead air or immediate customer hang-ups. | | **Minimum Call Sample Size \*** | Number | `5` to `500` (Default `10`) | Minimum call attempts required within the time window before taking automated failover actions. | | **Evaluation Window \*** | Dropdown | `5m`, `15m`, `30m`, `1h` | The rolling time window over which CDR metrics are computed. | ### Section 2: Automated Failover & Recovery | Field | Type | Options / Constraints | Description | | :--- | :--- | :--- | :--- | | **Automated Action on Degradation \*** | Dropdown | `alert_only`, `alert_and_reroute`, `disable_gateway` | Action triggered when a carrier breaches quality thresholds. | | **Auto-Recovery Cooldown \*** | Number | `5` to `120` minutes (Default `15m`) | Time period the SBC waits before testing a degraded carrier with probe traffic to verify recovery. | | **Admin Notifications** | Toggle | Boolean (`Yes` / `No`) | Dispatches instant alerts via email and the platform notification center upon route degradation. | --- ## 6. Real-Time Telephony Quality Metrics (ASR, ACD, MOS) Ring2All SBC calculates telephony health based on industry standards: ### 1. Answer-Seizure Ratio (ASR) $$\text{ASR} = \left( \frac{\text{Answered Calls (SIP 200 OK)}}{\text{Total Call Attempts}} \right) \times 100$$ - **Optimal**: $ASR \ge 65\%$ - **Acceptable**: $40\% \le ASR < 65\%$ - **Degraded / Faulty**: $ASR < 40\%$ (indicates carrier network congestion or signaling disconnects). ### 2. Average Call Duration (ACD) $$\text{ACD} = \frac{\sum \text{Duration of Answered Calls}}{\text{Count of Answered Calls}}$$ - **Short ACD (< 15s)** often indicates audio path failure (one-way audio, dead air, or ring-no-answer loops). ### 3. Mean Opinion Score (MOS) Calculated via RTPEngine from real-time RTP jitter buffer statistics and packet loss telemetry: - **4.3 - 4.5**: Pristine, studio-grade audio (G.711 / G.722 HD). - **4.0 - 4.2**: Standard toll-quality telephony. - **< 3.5**: Noticeable clipping, robotic voice, or significant delay. --- ## 7. Automated Degradation & Autonomous Rerouting When **Automated Action on Degradation** is set to `alert_and_reroute`: 1. **Detection**: The background worker detects that Carrier X fell to $28\%$ ASR across 50 call attempts over the last 15 minutes. 2. **Autonomous Demotion**: The engine dynamically lowers the carrier's priority in Kamailio's `drouting` tables via RPC: ```bash kamcmd drouting.carrierDemote carrier_id=1 reason="ASR fell below 40% threshold" ``` 3. **Rerouting**: Subsequent calls automatically bypass Carrier X and route through Carrier Y. 4. **Probing & Restoration**: After the **Auto-Recovery Cooldown** expires (e.g., 15 minutes), the SBC allows a low-volume canary sample of calls (5%) through Carrier X. If the sample demonstrates healthy ASR ($> 50\%$), Carrier X is fully restored. --- ## 8. Security Best Practices & Operational Hardening * **Prevent Flapping with Sample Size Guards**: Never set **Minimum Call Sample Size** below 10. In low-traffic hours, 2 consecutive unanswered calls could trigger false-positive degradation alerts. * **Tune for Destination Types**: DIDs terminating to call center IVRs naturally have higher ASR and longer ACD than outbound predictive dialer campaigns. Calibrate policies appropriately. * **Integrate with Notification Webhooks**: Configure administrative email alerts to notify the upstream carrier's NOC immediately when degradation is detected to accelerate vendor ticket resolution. --- ## 9. Troubleshooting & Verification | Symptom / Issue | Potential Root Cause | Recommended Verification & Resolution | | :--- | :--- | :--- | | **Dashboard displays "No carrier metrics recorded"** | No calls traversed the SBC in the selected time window, or CDR table timestamps are out of sync. | Verify system clock synchronization via NTP (`chronyc tracking`) and ensure CDR accounting is active in **Reports > Call Detail Records**. | | **Carrier incorrectly marked Degraded during off-peak hours** | Sample size too small ($N < 5$). | Increase the **Minimum Call Sample Size** in the policy form to at least 25 attempts. | | **Autonomous reroute did not occur despite low ASR** | Policy action set to `alert_only`. | Change **Automated Action on Degradation** to `alert_and_reroute` and save changes. | --- ## 10. Glossary * **ASR (Answer-Seizure Ratio)**: Primary telecom metric measuring the percentage of initiated calls successfully answered by the callee. * **ACD (Average Call Duration)**: The average length of answered telephone conversations across a given time frame. * **MOS (Mean Opinion Score)**: Subjective or algorithmically derived measurement of the perceived audio quality of a voice call (ranging from 1.0 to 5.0). * **Flapping**: Rapid, repeated state transitions between healthy and degraded caused by overly sensitive monitoring thresholds.