Introduction
RTPProxy is an open-source, high-performance RTP (Real-time Transport Protocol) proxy server used in VoIP infrastructures. It sits between SIP endpoints and handles media relay, NAT traversal, and call recording. RTPProxy is commonly deployed alongside SIP proxies like Kamailio or OpenSIPS to manage RTP media streams that SIP signaling alone cannot route through NAT.
In this guide, we will install RTPProxy version 3.2.0 from source on Ubuntu 24.04 and 22.04, create a proper systemd service unit, configure firewall rules for RTP traffic, and verify the installation.
Prerequisites
- Ubuntu 24.04 or 22.04 server
- Root access or a user with sudo privileges
- A working internet connection to fetch packages and clone the repository
Step 1: Install Build Dependencies
RTPProxy requires several development tools and libraries to compile from source. Update your package index and install them:
sudo apt update
sudo apt install -y build-essential git cmake autoconf automake libtool pkg-config
These packages provide the C compiler, autotools build system, and other tools needed for the compilation process.
Step 2: Clone the RTPProxy Source Code
Clone the official RTPProxy GitHub repository and check out the v3.2.0 release tag:
cd /usr/local/src
sudo git clone -b master https://github.com/sippy/rtpproxy.git
cd rtpproxy
sudo git checkout v3.2.0
sudo git submodule update --init --recursive
The submodule update pulls in any external dependencies that RTPProxy relies on during the build.
Step 3: Compile and Install RTPProxy
Generate the configure script with autoreconf, then run the standard configure, make, and install sequence:
cd /usr/local/src/rtpproxy
sudo autoreconf -fi
sudo ./configure
sudo make
sudo make install
After installation, the rtpproxy binary is placed at /usr/local/bin/rtpproxy. Confirm it is in place:
which rtpproxy
Expected output:
/usr/local/bin/rtpproxy
Step 4: Verify the Installed Version
Check that RTPProxy reports the correct version:
rtpproxy -V
You should see output similar to:
3.2.0.b26b09b3-dirty
The version string confirms RTPProxy 3.2.0 is installed and ready for configuration.
Step 5: Create a Dedicated System User
For security, run RTPProxy under its own unprivileged system account rather than as root:
sudo useradd -r -s /usr/sbin/nologin rtpproxy
Create the runtime directory for the control socket:
sudo mkdir -p /var/run/rtpproxy
sudo chown rtpproxy:rtpproxy /var/run/rtpproxy
Step 6: Create a systemd Service File
Create a proper systemd unit file so RTPProxy starts automatically on boot and can be managed with systemctl:
sudo vi /etc/systemd/system/rtpproxy.service
Add the following content:
[Unit]
Description=RTPProxy Media Relay
After=network.target
[Service]
Type=simple
User=rtpproxy
Group=rtpproxy
RuntimeDirectory=rtpproxy
ExecStart=/usr/local/bin/rtpproxy -f -l 0.0.0.0 -s unix:/var/run/rtpproxy/rtpproxy.sock -m 10000 -M 20000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Key options in the ExecStart line:
-f– Run in foreground (systemd manages the process lifecycle)-l 0.0.0.0– Listen on all interfaces-s unix:/var/run/rtpproxy/rtpproxy.sock– Control socket path for SIP proxy communication-p /var/run/rtpproxy/rtpproxy.pid– PID file location-m 10000 -M 20000– RTP port range (minimum 10000, maximum 20000)
Reload systemd, enable, and start the service:
sudo systemctl daemon-reload
sudo systemctl enable rtpproxy
sudo systemctl start rtpproxy
Check the service status:
sudo systemctl status rtpproxy
You should see the service as active (running). If something goes wrong, check the journal:
sudo journalctl -u rtpproxy -e --no-pager
Step 7: Configure Firewall Rules for RTP Traffic
RTPProxy needs UDP ports 10000 through 20000 open for media relay. If you are using UFW (the default firewall on Ubuntu), allow the port range:
sudo ufw allow 10000:20000/udp comment "RTPProxy RTP media ports"
sudo ufw reload
sudo ufw status verbose
If you use iptables directly instead of UFW:
sudo iptables -A INPUT -p udp --dport 10000:20000 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4
Make sure your cloud provider’s security group or external firewall also permits UDP traffic on this port range.
Step 8: Test the Control Socket
Verify that the control socket is created and accessible. This is the socket your SIP proxy (Kamailio, OpenSIPS, etc.) will use to communicate with RTPProxy:
ls -la /var/run/rtpproxy/rtpproxy.sock
You should see a socket file owned by the rtpproxy user. If you have the socat utility installed, you can query RTPProxy version through the socket:
echo "VF 20080403" | sudo socat - UNIX-CONNECT:/var/run/rtpproxy/rtpproxy.sock
Integrating RTPProxy with Kamailio
RTPProxy is most commonly used alongside a SIP proxy server. If you are running Kamailio, load the rtpproxy module and point it to the control socket in your kamailio.cfg:
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy/rtpproxy.sock")
For a full Kamailio setup guide, see: Install Kamailio SIP Server on Rocky / AlmaLinux.
Conclusion
You now have RTPProxy 3.2.0 compiled from source, running as a systemd service under a dedicated user, with firewall rules in place for RTP media traffic. The control socket at unix:/var/run/rtpproxy/rtpproxy.sock is ready for integration with your SIP proxy of choice.
For production deployments, consider adjusting the RTP port range based on your expected concurrent call volume – each call typically uses two RTP ports (one for audio, one for RTCP). The default 10000-20000 range supports roughly 5000 concurrent calls.
Related Guides
- Install Kamailio SIP Server on Rocky / AlmaLinux
- Install FreePBX and Asterisk on Ubuntu
- Install OpenSIPS SIP Proxy on Ubuntu
- Install sngrep SIP Packet Capture Tool on Linux




























































Thank you. It worked properly in Debian 10 (Buster). You saved my saturday…!
You have the same issue as me:
“Active: active (exited) since Sun 2020-05-03 14:55:46 UTC; 23s ago”
The service is not running, as it says in your screen grab… “exited”
Service is running