Media Engines Module Documentation
Table of Contents
- Module Overview (Technical)
- Module Overview (Commercial/Business)
- Module Overview (End User/Administrator)
- Configuration Categories
- Common Settings Reference
- Common Scenarios & Examples
- Limitations & Important Notes
- Troubleshooting Tips
- Glossary
- Lua Script Status ℹ️
1. Module Overview (Technical)
What Are Media Engines?
Media Engines is a Kamailio / RTPEngine configuration module that defines and manages external RTPEngine server pools. By maintaining node records in the database, the SBC backend can dynamically write the Kamailio configuration files required to balance active audio/video media streams across a network of distributed nodes.
Architecture
Background Health Check
The SBC backend implements an autonomous background service (initRtpEngineHealthCheck) that runs every 30 seconds:
- Sends a UDP ping packet formatted with the RTPEngine
ngprotocol (d7:command4:pinge) to each active node. - Measures network latency in milliseconds.
- Updates node state (
online/offline) and the measuredlatencydirectly in the database. - Runs an initial quick verification check 5 seconds after backend startup.
Key Tables
| Table | Purpose |
|---|---|
public.rtpengine_nodes | Stores pool node definitions, status flags, and latency stats. |
Key Files
| File | Description |
|---|---|
src/modules/media/MediaEnginesPage.tsx | Frontend view, modal form, and action controls. |
src/modules/rtpengine-nodes/rtpengineController.ts | Fastify handlers for API CRUD operations, ping triggers, and configuration generation. |
src/modules/rtpengine-nodes/rtpengineRoutes.ts | Fastify route declarations for /api/rtpengine-nodes. |
/etc/kamailio/sbc-rtpengines.cfg | Include file loaded by Kamailio containing the active socket pool definition. |
2. Module Overview (Commercial/Business)
Business Value
Managing external media handlers separates signaling (handled by the SBC/Kamailio) from RTP processing (handled by RTPEngine). This provides distinct benefits:
| Without External Media Engines | With External Media Engines |
|---|---|
| Single Point of Failure (SPOF) for media | High Availability (HA) failover pools |
| Hard limit on concurrent call capacity | Horizontal scale-out by adding new nodes |
| Manual, disruptive config file edits | GUI-driven pool management without downtime |
| No insight into media engine health | Continuous real-time status and latency checks |
Use Cases
- High Call Density Environments
- Geographical Latency Optimization
- No-Downtime Maintenance
3. Module Overview (End User/Administrator)
What Can You Do?
- View Active Pool: Monitor a unified grid showing host addresses, port numbers, weights, statuses, real-time latencies, and last probed timestamps.
- Add/Edit Node Dialog: Define Name, IP/Hostname, UDP control port, load balancer Weight, and Active flag.
- Manual Ping: Trigger an instantaneous UDP diagnostics test to check server availability.
- Apply Pool Configuration: Rebuild the Kamailio includes with active sockets.
4. Configuration Categories
When registering or editing an RTPEngine node, the following properties are defined:
- Name
- Tooltip: Unique name to identify this RTPEngine node.
- IP / Hostname
- Tooltip: IP address or DNS hostname of the external RTPEngine server.
- Port (UDP)
- Tooltip: UDP control port where RTPEngine listens (default is 2223).
- Weight
- Tooltip: Priority weight for load balancing. Higher values receive more traffic.
- Active Node
- Tooltip: Whether this node should be included in the active pool for Kamailio.
- Description
- Tooltip: Optional notes about this node (e.g. location, provider).
5. Common Settings Reference
| Parameter | Default | Required | Description |
|---|---|---|---|
| Name | — | Yes | Descriptive node name. |
| Host | — | Yes | IP Address / DNS Hostname of the node. |
| Port | 2223 | Yes | Control socket port (UDP). |
| Weight | 1 | Yes | Integer priority (1-100). Higher weights get more call distribution. |
| Active | true | Yes | If false, the node is excluded from Kamailio's active includes. |
| Description | — | No | Optional text field for notes. |
6. Common Scenarios & Examples
Scenario 1: Registering a Secondary RTPEngine Node
- Access the Media Engines section.
- Click Add Engine Node in the top right.
- Provide the details:
RTP-Node-B
- IP / Hostname: 192.168.10.15
- Port: 2223
- Weight: 2 (Gives this node double the traffic share relative to weight 1 nodes)
- Active: Enabled (Toggle set to Yes)
- Click Save. The background service will run a ping test and list the node.
Scenario 2: Node Maintenance and Deactivation
- Prior to shutting down an RTPEngine node for OS updates:
- Open the edit dialog by clicking the Edit pencil icon next to the target node.
- Change the Active Node toggle to No.
- Click Save.
- Click Apply Config to rebuild
/etc/kamailio/sbc-rtpengines.cfg(excluding this socket). - Reload/Restart Kamailio. Calls will gracefully shift to the remaining active nodes.
7. Limitations & Important Notes
udp:127.0.0.1:2223 as a fallback setting to avoid breaking signaling.8. Troubleshooting Tips
Node Status Shows "Offline"
- Check Firewall: Ensure the SBC can communicate on the UDP control port (default
2223) of the target server. - Process Verification: Log into the target node and verify the RTPEngine daemon is active:
- Control Interface: Ensure
rtpengineis started with the correct--listen-nginterface mapping corresponding to the IP defined in the dashboard.
Manual Diagnostics Ping Failures
If you trigger a manual ping and receive a timeout:
- Verify the route between SBC and node IP is open.
- Test connection with
ncortcpdumpon the node:
- Look for incoming ping commands (
ping_... d7:command4:pinge) from the SBC.
9. Glossary
| Term | Definition |
|---|---|
| RTPEngine | A high-performance proxy for RTP traffic, handling audio/video streams, transcoding, and security. |
| ng protocol | The control protocol used by Kamailio and utilities to configure media parameters on RTPEngine instances. |
| Control Port | The UDP socket (typically 2223) where RTPEngine listens for JSON/Bencoded configuration commands. |
| Weight | An arbitrary integer determining the relative share of calls routed to a given media engine in a load balancer. |
Lua Script Status ℹ️
No Lua Handler Required
| Component | Status |
|---|---|
| Media Engines | ℹ️ Pure configuration module — generates Kamailio includes. |
/etc/kamailio/sbc-rtpengines.cfg). No Lua script hooks are used.
Documentation last updated: May 2026