rtpengine (media proxy / relay)
rtpengine is an open-source kernel-accelerated RTP proxy maintained by Sipwise. Kamailio and OpenSIPS handle SIP signaling but not media; rtpengine is the standard companion that handles the actual RTP packets — relaying, transcoding, recording, encrypting/decrypting SRTP. Together (signaling + media) they form a complete carrier-grade SIP stack.
Why you need rtpengine
Kamailio/OpenSIPS only see SIP. RTP normally flows directly between endpoints. But:
- If endpoints are on different sides of NAT, RTP needs a public-IP relay.
- If you want to record calls, the audio has to flow through something you control.
- If you want SRTP ↔ RTP transcoding (encrypted on one leg, plain on the other), you need a media-aware proxy.
- If you want WebRTC (DTLS-SRTP) interop with classic SIP, you need DTLS termination + SRTP transcode.
- If you want to enforce codec restrictions, transcode G.729 ↔ G.711, etc.
That's rtpengine.
How it integrates with Kamailio/OpenSIPS
You add a few lines to your routing config: when an INVITE comes in, rewrite the SDP to point media to rtpengine, send the original SDP to rtpengine via control protocol, get the rewritten SDP back, forward INVITE. RTP now flows: caller → rtpengine → callee.
# In Kamailio config (rtpengine module) loadmodule "rtpengine.so" modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223") route[MEDIA_BRIDGE] { rtpengine_offer(); # on INVITE t_on_reply("REPLY_BRIDGE"); t_relay(); } onreply_route[REPLY_BRIDGE] { rtpengine_answer(); # on 200 OK }
Kernel-accelerated forwarding
The killer feature: rtpengine has a kernel module (xt_RTPENGINE) that forwards RTP packets without leaving kernel space. Once a call is established, packets bypass userspace entirely — allowing one server to relay 100K+ concurrent calls. Userspace handles only call setup and edge cases.
Common deployment
- Co-located with Kamailio/OpenSIPS on the same host (or HA pair).
- One rtpengine cluster per region for low-latency media.
- SRTP keys terminated at rtpengine, not at the SIP server.
- Optional integration with a recording sink (Homer, Sipcapture, S3) for compliance.
Related terms
Kamailio (SIP server / softswitch)
OpenSIPS (SIP server / fork of OpenSER)
RTP and RTCP
SRTP (Secure RTP)
DTLS-SRTP (Encrypted Media Keying)
SBC (Session Border Controller)
Ready to get a number?
Pick a DID in 130+ countries from $1.99/month. Activates instantly on most numbers.