RTPengine – Installation & Configuration (Debian 11 / Ubuntu 19.04 and below)

This post was originally published in September 2019.
It was updated December 2021 and updated for Debian 11
An updated version has been posted here for 20.04 and above.
If you’re reading this unless you are installing this on an old release, you probably want the post linked above…

Note before using

There’s a few RTP Proxies out there (rtpproxy/mediaproxy) but rtpengine from Sipwise has simplicity and flexibility that makes you wonder how you ever used the others.

Some of it’s more impressive features:

  • Bridge Encrypted (SRTP) & Plaintext RTP Sessions
  • ICE Bridge
  • Farmable loads (Can have a pool of RTPengine instances)
  • Recording of Media Streams (In a not stupid – accidentally-fill-up-the-disk way)
  • Transcoding
  • Media repacketization

Installation

This package isn’t in the default Ubuntu/Debian repos, so we’ll get it from the git repo:

git clone https://github.com/sipwise/rtpengine.git
cd rtpengine 

Next we’ll need to install some dependencies:

apt-get install debhelper default-libmysqlclient-dev gperf iptables-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libhiredis-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libdigest-crc-perl libdigest-hmac-perl libnet-interface-perl libnet-interface-perl libssl-dev libsystemd-dev libxmlrpc-core-c3-dev libcurl4-openssl-dev libevent-dev libpcap0.8-dev markdown unzip nfs-common dkms libspandsp-dev libiptc-dev libmosquitto-dev python3-websockets

The dependency you’ll get stuck on will be the G.729 library, which we have to manually compile.

VER=1.0.4

curl https://codeload.github.com/BelledonneCommunications/bcg729/tar.gz/$VER >bcg729_$VER.orig.tar.gz

tar zxf bcg729_$VER.orig.tar.gz 

cd bcg729-$VER 

git clone https://github.com/ossobv/bcg729-deb.git debian 

dpkg-buildpackage -us -uc -sa -b -rfakeroot

cd ../

dpkg -i libbcg729-*.deb

Now let’s check the RTPengine dependencies again:

dpkg-checkbuilddeps

If you get an empty output you’re good to start building the packages:

dpkg-buildpackage  --no-sign

If that completed sucessfully in the directory above you should have a bunch of .deb files:

cd ../

dpkg -i ngcp-rtpengine-daemon_*.deb ngcp-rtpengine-iptables_*.deb ngcp-rtpengine-kernel-dkms_*.deb

Getting it Running

Now we’ve got RTPengine installed let’s setup the basics,

There’s an example config file we’ll copy and edit:

mv /etc/rtpengine/rtpengine.sample.conf /etc/rtpengine/rtpengine.conf

vi /etc/rtpengine/rtpengine.conf

We’ll uncomment the interface line and set the IP to the IP we’ll be listening on:

Once we’ve set this to our IP we can start the service:

/etc/init.d/ngcp-rtpengine-daemon start

All going well it’ll start and rtpengine will be running.

You can learn about all the startup parameters and what everything in the config means in the readme.

Want more RTP info?

If you want to integrate RTPengine with Kamailio take a look at my post on how to set up RTPengine with Kamailio.

For more in-depth info on the workings of RTP check out my post RTP – More than you wanted to Know

14 thoughts on “RTPengine – Installation & Configuration (Debian 11 / Ubuntu 19.04 and below)

  1. Excellent, still good in 2021 with one slight change, there is now a dependancy of libwebsockets-dev

    Thanks!

  2. Hi Nick,

    thanks a lot for all your posts and this interesting website.
    I am a newbie with Kamailio and would be thankful for a post about integrating Kamailio with a media relay (asterisk).

    I am not sure if the article at “http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb” is the right one for me. I only want Kamailio to query my Database (not asterisk) to authenticate the users and engage asterisk as a B2BUA in the middle of RTP Dialouge between caller and callee.

    Unfortunately, I could not install the rtpengine on my ubuntu machine or centos. This is why I would like to use asterisk as a Media Relay.

    Best regards
    Abdul

    1. Hi Abdul,
      Truth is if you’re struggling to get RTPengine running you may find Kamailio to be an uphill battle,
      Asterisk isn’t a media relay, it’s got to be in the signaling path as well, which may lead to more headaches in the future, keep that in mind,
      Good luck!
      Nick

  3. Hi Nick,

    (Maybe you want to check the link “how to set up RTPengine with Kamailio”) Besides that great posts! Keep it up!

  4. Hi Nick ,

    I am getting the following errors when i try to install RTP Engine and execute the step dpkg-buildpackage -us -uc -sa -b -rfakeroot . Any thoughts ?

    make[1]: Leaving directory ‘/root/bcg729-1.0.4/obj-x86_64-linux-gnu’
    dh_install -O–buildsystem=cmake
    dh_install: Cannot find (any matches for) “usr/lib/*/pkgconfig/*” (tried in ., debian/tmp)

    dh_install: libbcg729-dev missing files: usr/lib/*/pkgconfig/*
    dh_install: missing files, aborting
    make: *** [debian/rules:13: binary] Error 25
    dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

    Thanks and regards
    Abdul Rasheed

    1. Same thing here. The thing is iptables-dev are not available for ubuntu 20 and higher, no way to install it either. This prolly gives error “/usr/libexec/rtpengine/rtpengine-get-table: not found”.
      Can’t find a way around it yet

  5. For Debian 11 Bull Eye – The following command works.

    sudo apt-get install debhelper default-libmysqlclient-dev gperf libxtables-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libhiredis-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libdigest-crc-perl libdigest-hmac-perl libnet-interface-perl libnet-interface-perl libssl-dev libsystemd-dev libxmlrpc-core-c3-dev libcurl4-openssl-dev libevent-dev libpcap0.8-dev markdown unzip nfs-common dkms libspandsp-dev libiptc-dev libmosquitto-dev python3-websockets libjson-perl libopus-dev libtest2-suite-perl libwebsockets-dev libbcg729-dev

  6. problem on Debian 11 “Bullseye”:
    Neither “dpkg-checkbuilddeps” nor “dpkg -i” notes that iptables ist mandatory. “dpkg -i” fails with message like “install ngcp-rtpengine-daemon failed”, but without reason. After failed “dpkg -i” iptables cant be installed neither because dependency issues. I was forced to rollback to former snapshot of machine and install iptables befor installation.
    I suggest adjecent dependencies-install-command::::::
    apt-get install iptables debhelper default-libmysqlclient-dev gperf libxtables-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libhiredis-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libdigest-crc-perl libdigest-hmac-perl libnet-interface-perl libnet-interface-perl libssl-dev libsystemd-dev libxmlrpc-core-c3-dev libcurl4-openssl-dev libevent-dev libpcap0.8-dev markdown unzip nfs-common dkms libspandsp-dev libiptc-dev libmosquitto-dev python3-websockets libjson-perl libopus-dev libtest2-suite-perl libwebsockets-dev libbcg729-dev

Leave a Reply to Nick Cancel reply

Your email address will not be published. Required fields are marked *