--- title: "Ring2All SBC - RTPEngine Media Relay & WebRTC Gateway Documentation" description: "Documentation for RTPEngine Media Relay" --- ## Table of Contents 1. [Module Overview (Technical)](#1-module-overview-technical) 2. [Module Overview (Commercial/Business)](#2-module-overview-commercialbusiness) 3. [Module Overview (End User/Administrator)](#3-module-overview-end-useradministrator) 4. [Configuration Sections](#4-configuration-sections) 5. [Settings Reference](#5-settings-reference) 6. [Common Scenarios & Examples](#6-common-scenarios--examples) 7. [Limitations & Important Notes](#7-limitations--important-notes) 8. [Troubleshooting Tips](#8-troubleshooting-tips) 9. [Glossary](#9-glossary) --- ## 1. Module Overview (Technical) ### What Is the RTPEngine Media Relay Module? The **RTPEngine Media Relay & WebRTC Gateway Module** in Ring2All SBC manages real-time audio/video proxying, NAT traversal, SRTP encryption/decryption, and WebRTC-to-SIP bridging (ICE, DTLS-SRTP, Opus/G.711 codec transcoding). Using kernel-space packet forwarding (`xt_RTPENGINE`), Ring2All SBC routes media streams directly through the Linux kernel network stack, achieving high-throughput, sub-millisecond audio latency for thousands of concurrent channels. ### Architecture ``` ┌─────────────────────────────────────────────────────────────────┐ │ Ring2All SBC - RTPEngine Architecture │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ WebRTC Client (Browser) PSTN / Telephony Server │ │ WSS / ICE / DTLS-SRTP UDP / RTP (G.711 / G.729) │ │ │ │ │ │ ▼ ▼ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Ring2All SBC │ │ │ │ ┌──────────────────┐ ┌──────────────────────┐ │ │ │ │ │ Kamailio Signaling│ <-----> │ RTPEngine Media Proxy│ │ │ │ │ └──────────────────┘ └──────────────────────┘ │ │ │ │ (xt_RTPENGINE Kernel) │ │ │ └──────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────┘ ``` --- ## 2. Module Overview (Commercial/Business) ### Business Benefits 1. **Seamless WebRTC Integration**: Enables softphones, browsers, and mobile apps to communicate directly with traditional SIP trunks without expensive hardware SBCs. 2. **Sub-Millisecond Latency**: Kernel-level media forwarding guarantees crystal-clear voice quality without CPU bottlenecking. 3. **Enterprise Encryption & Security**: Enforces mandatory DTLS-SRTP encryption for remote endpoints over public Internet. --- ## 3. Module Overview (End User/Administrator) ### What Can You Do in This Module? - **Configure Media Proxies**: Set listening interfaces, UDP port ranges (`10000-20000`), and TOS/QoS audio flags. - **Enable WebRTC Gateway**: Auto-bridge WebSockets (ICE/SDP) to traditional UDP SIP. - **Monitor Active Media Sessions**: Track active call streams, jitter, packet loss, and codec stats. --- ## 4. Configuration Sections ### 1. RTPEngine Service Settings Configures daemon socket control, kernel module bindings, and thread pools. ### 2. Media Bridge Rules Defines rules for converting SRTP to RTP, rewriting SDP IPs, and managing ICE candidates. --- ## 5. Settings Reference | Field Name | Type | Options / Format | Description | | :--- | :--- | :--- | :--- | | `listen_ng` | Input | `IP:Port` (e.g. `127.0.0.1:2223`) | Control socket for Kamailio-to-RTPEngine communication. | | `port_min` | Integer | `10000` | Minimum UDP port for media streams. | | `port_max` | Integer | `20000` | Maximum UDP port for media streams. | | `rtpengine_flags` | String | `trust-address replace-origin replace-session-connection` | SDP manipulation parameters. | --- ## 6. Common Scenarios & Examples ### Scenario: WebRTC Browser to PSTN Call Bridging 1. WebRTC client connects via WebSocket (`wss://sbc.ring2all.xyz`). 2. Kamailio invokes `rtpengine_offer("ICE=force DTLS=passive SDES-off RTP/SAVPF")`. 3. RTPEngine negotiates DTLS-SRTP with browser and plain RTP with PSTN gateway. 4. Media flows smoothly with zero audio degradation. --- ## 7. Limitations & Important Notes - Ensure `xt_RTPENGINE` kernel module is loaded for maximum performance (`modprobe xt_RTPENGINE`). --- ## 8. Troubleshooting Tips | Symptom | Probable Cause | Solution | | :--- | :--- | :--- | | One-way audio | NAT / Public IP mismatch in SDP | Verify `advertised_ip` in RTPEngine config. | | WebRTC call drops instantly | ICE candidate negotiation failure | Ensure TURN/STUN servers or public ICE IPs are configured. | --- ## 9. Glossary - **ICE**: Interactive Connectivity Establishment for WebRTC NAT traversal. - **DTLS-SRTP**: Datagram Transport Layer Security for SRTP media key exchange.