--- title: "🌐 SFU Clustering & Native SIP Bridge" description: "Multi-node WebRTC Selective Forwarding Unit (SFU) clustering, TURN/TLS NAT traversal, and bidirectional SIP-to-WebRTC bridging with Ring2All PBX." --- ## 📖 Overview & Architecture **Ring2All Video** separates media routing (`softswitch-video-sfu`) from telephony signaling translation (`softswitch-video-sip`) so service providers can scale WebRTC video capacity horizontally across multiple data centers while maintaining native dialplan integration with **Ring2All PBX (FreeSWITCH)**. When a user dials a meeting extension from a desk phone or external PSTN number, FreeSWITCH routes the call to `softswitch-video-sip`, which negotiates Opus/G.711 audio and H.264/VP8 video and injects the caller into the target SFU room as a first-class participant. ```mermaid sequenceDiagram participant Phone as SIP Desk Phone / PSTN Caller participant PBX as Ring2All PBX (FreeSWITCH) participant SIPGW as softswitch-video-sip participant SFU as softswitch-video-sfu Cluster participant Web as Ring2All Connect WebRTC Participants Phone->>PBX: Dial Meeting Extension / DID + PIN PBX->>SIPGW: SIP INVITE (X-Room-ID, X-Tenant-ID) SIPGW->>SFU: Join Room via Internal WebRTC Track Bridge SFU-->>Web: Broadcast Participant Joined & Audio/Video Streams Web-->>SFU: Active Speaker Media Streams SFU-->>SIPGW: Mixed Audio + Composite Video Stream SIPGW-->>Phone: RTP/SRTP Media Stream ``` --- ## 🎯 User Roles & Key Capabilities | Role | Primary Use Case | Key Capabilities | | :--- | :--- | :--- | | **Carrier / VoIP Architect** | Multi-node SFU mesh orchestration and SIP trunk peering | Configure Redis pub/sub cluster routing, set up Geo-DNS / Anycast SFU node selection, and bind SIP dispatch trunks. | | **PBX Administrator** | Configuring hybrid audio/video dial-in extensions | Map PBX conference extensions and inbound DIDs to Ring2All Video rooms, enforce PIN validation, and configure codec priorities. | | **NOC Support Engineer** | Diagnosing WebRTC ICE connectivity and packet loss | Inspect ICE candidate selection (`host`, `srflx`, `relay`), verify TURN/TLS port reachability, and monitor simulcast layer switching. | --- ## 📋 Field & Configuration Reference | Field | Type | Description | Default | | :--- | :--- | :--- | :--- | | **Cluster Redis Address** | Host:Port | Shared Redis endpoint coordinating room state, participant presence, and multi-node SFU pub/sub in `/etc/softswitch/video/livekit.yaml`. | `127.0.0.1:6379` | | **Node Selection Strategy** | Select | On-demand least-loaded SFU balancing with sticky `video_server_id` binding and Twirp `ListRooms` health telemetry (`Least Loaded`, `Drain Mode`). | `Least Loaded` | | **SFU Signaling & Media Ports** | Ports | WebSocket signaling (`7880` via `/livekit-node/`), TCP RTC fallback (`7881/tcp`), and WebRTC SRTP media (`52000-60000/udp`). | `7880`, `7881`, `52000-60000/udp` | | **SIP Bridge Listening & RTP** | Port / Range | UDP/TCP port (`5070`) and RTP range (`50000-51999/udp`) in `/etc/softswitch/video/sip.yaml` for FreeSWITCH SIP INVITEs. | `5070/udp+tcp`, `50000-51999/udp` | | **Video Codecs** | Multi-Select | Enabled WebRTC video codecs in priority order (`VP8`, `H.264`, `VP9`, `AV1`). | `VP8, H.264, VP9` | | **SIP DTMF Mode** | Select | DTMF relay method for in-meeting mute (`*6`) and hand-raise (`*9`) controls from SIP phones. | `RFC 2833 (telephone-event)` | | **Embedded TURN TLS Domain** | FQDN | Public domain name with a valid TLS certificate used for TURN over TLS (`turns:` on TCP port `443`/`5349`). | *Required for TURN* | --- ## ⚙️ Operational Workflows ### 1. Adding a New SFU Node to an Existing Cluster 1. Deploy `softswitch-video-sfu` (`/usr/bin/livekit-server --config /etc/softswitch/video/livekit.yaml`) on the secondary Debian 13 host and point its `redis.address` to the primary cluster Redis instance. 2. In **Ring2All PBX**, navigate to **Administration → Infrastructure → Video Servers** and register the secondary node. 3. Ring2All PBX polls active rooms via Twirp `ListRooms`, assigns new meetings on-demand with sticky `video_server_id`, proxies client WebSockets over `/livekit-node/:/`, and stops new allocations when **Drain Mode** is toggled on. ### 2. Enabling SIP Dial-In for Video Meetings 1. Ensure `softswitch-video-sip` is running and registered as a trusted gateway in Ring2All PBX. 2. When a user schedules a meeting in **Ring2All Connect**, the system automatically generates a numeric **Meeting ID** and **PIN**. 3. Callers dialing the organization's conferencing DID are prompted for the Meeting ID and PIN, then bridged directly into the WebRTC room via `softswitch-video-sip`. --- ## 🔐 Security & RBAC Considerations - **SIP Trunk IP Authentication & Header Signing**: `softswitch-video-sip` accepts SIP INVITE traffic exclusively from whitelisted Ring2All PBX IP addresses and validates HMAC-signed `X-Ring2All-Room-Token` headers. - **Tenant Isolation**: Multi-tenant room namespaces are cryptographically prefixed with the immutable numeric `tenant_id` and `domain_id` so participants from one tenant can never enumerate or join rooms belonging to another tenant.