Skip to content

Instantly share code, notes, and snippets.

@hamidrhashmi
Last active March 12, 2025 12:03
Show Gist options
  • Save hamidrhashmi/f9a8124d681c3e5691899fe8bec9edab to your computer and use it in GitHub Desktop.
Save hamidrhashmi/f9a8124d681c3e5691899fe8bec9edab to your computer and use it in GitHub Desktop.
RTPengine Installation on Rocky Linux

First of all disable SELinux

setenforce 0

To permanantly disable selinux edit file vim /etc/selinux/config

SELINUX=disabled

Now enable the CodeReady Builder repository

dnf config-manager --set-enabled crb

Install FFMPEG

dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm
dnf makecache
dnf install ffmpeg ffmpeg-devel

Install rtpengine dependencies

dnf groupinstall -y "Development Tools"
dnf install -y gcc gcc-c++ make autoconf automake libtool
dnf install spandsp-devel spandsp libmnl-devel libnftnl-devel libtiff-devel libjpeg-devel mysql-devel pandoc ncurses-devel gmp-devel libedit-devel
dnf --enablerepo=devel install opus-devel libpcap-devel xmlrpc-c-devel libiptcdata-devel
dnf install pkgconfig glib2-devel zlib-devel libcurl libevent-devel iptables-devel kernel-headers kernel-devel gcc hiredis-devel json-glib-devel libswresample-free-devel libavcodec-free-devel libavformat-free-devel perl-IPC-Cmd gperf libwebsockets-devel

Install libiptc.h

wget https://www.netfilter.org/projects/iptables/files/iptables-1.8.11.tar.xz
tar xvf iptables-1.8.11.tar.xz
cd iptables-1.8.11
./configure
make 
make install
ln -s /usr/local/include/libiptc /usr/include/.
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Tip

Better to compile nfttables and libnftnl from source as well.

Now Download RTPengine

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

Compile and install the daemon

cd /usr/src/rtpengine/daemon/
make
cp -fr rtpengine /usr/bin/rtpengine

Compile and install iptables extension

cd /usr/src/rtpengine/iptables-extension
make all
cp -fr libxt_RTPENGINE.so /usr/lib64/xtables/.

Compile and install the kernel module xt_RTPENGINE

cd /usr/src/rtpengine/kernel-module
make
insmod xt_RTPENGINE.ko
lsmod | grep xt_RTPENGINE
mkdir /lib/modules/$(uname -r)/extra/
cp xt_RTPENGINE.ko /lib/modules/$(uname -r)/extra/
depmod -a
modprobe -v xt_RTPENGINE

Check if the kernel module loaded properly:

lsmod | grep xt_RTPENGINE

Make to load the module at the boot time:

echo "# load xt_RTPENGINE module"  >> /etc/modules-load.d/rtpengine.conf
echo "xt_RTPENGINE" >> /etc/modules-load.d/rtpengine.conf

Check if RTPEngine is accessible:

ls -l /proc/rtpengine/control | grep root

Should see:

–w–w—-. 1 root root 0 Oct 16 10:32 /proc/rtpengine/control

Reference -> https://blog.kolmisoft.com/rtpengine-install-on-centos-7/

configure service file

cd el
cp rtpengine.service /etc/systemd/system/
cp rtpengine.sysconfig /etc/sysconfig/rtpengine
cp etc/rtpengine.conf /etc/rtpengine/
dnf install perl-Config-Tiny

Troubleshooting

In case if spandsp package is causing issue install it from source

git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh
./configure
make 
make install

Add it in package config

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig

create a softlink in lib64

ln -s /usr/local/lib/libspandsp.so.3.0.0 /lib64/libspandsp.so.3

Some other command helped in troublshooting

ldd /usr/bin/rtpengine
/usr/bin/rtpengine -v

nf install rpm-build rpmdevtools -y
rpmdev-setuptree
mv myapp-1.0.tar.gz ~/rpmbuild/SOURCES/
rpmbuild -ba el/rtpengine.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment