yum -y install epel-release
yum -y install glib glib-devel gcc zlib zlib-devel openssl openssl-devel pcre pcre-devel libcurl libcurl-devel xmlrpc-c xmlrpc-c-devel
yum -y install libevent-devel glib2-devel json-c-devel json-glib json-glib-devel gperf libpcap-devel git perl-IPC-Cmd libiptcdata-devel libiptcdata-devel hiredis hiredis-devel redis iptables-devel libwebsockets-devel
yum -y install spandsp spandsp-devel
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
yum -y install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum repolist
yum -y install ffmpeg ffmpeg-devel
yum -y install bcg729 bcg729-devel
wget https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
rpm -i rpmfusion-free-release-7.noarch.rpm
cd /usr/src
git clone https://github.com/sipwise/rtpengine.git rtpengine
cd rtpengine
cd /usr/src/rtpengine/daemon/
make
cp -fr rtpengine /usr/sbin/rtpengine
cp -fr rtpengine /usr/local/bin/rtpengine
cd /usr/src/rtpengine/iptables-extension
make all
cp -fr libxt_RTPENGINE.so /usr/lib64/xtables/.
cd /usr/src/rtpengine/kernel-module
make
cp -fr xt_RTPENGINE.ko /lib/modules/`uname -r`/extra/xt_RTPENGINE.ko
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
ls -l /proc/rtpengine/list
-r–r–r–. 1 root root 0 Oct 16 10:32 /proc/rtpengine/list
Get your external IP (with ‘ip addr’ for example)
In the following command change 111.111.111.111 to your external IP
echo "OPTIONS=\"-i 111.111.111.111 -n 127.0.0.1:2223 -m 10000 -M 60000 -L 4 --log-facility=local1 --table=8 --delete-delay=0 --timeout=60 --silent-timeout=600 --final-timeout=7200 –offer-timeout=60 --num-threads=12 --tos=184 –no-fallback\"" > /etc/sysconfig/rtpengine
echo "local1.* -/var/log/rtpengine/rtpengine.log;clean_template" >> /etc/rsyslog.conf
mkdir -p /var/log/rtpengine
touch /var/log/rtpengine/rtpengine.log
echo "/var/log/rtpengine/rtpengine.log {
daily
rotate 4
missingok
dateext
copytruncate
compress
}" > /etc/logrotate.d/rtpengine
perl -pi.bak -e 's#(\s+)\/var\/log\/messages#;local1.none$1/var/log/messages#' /etc/rsyslog.conf
systemctl restart rsyslog
Configure RTPEngine service
echo "[Unit]
Description=Kernel based rtp proxy
After=syslog.target
After=network-online.target
After=iptables.service
Requires=network-online.target
[Service]
Type=forking
PIDFile=/var/run/rtpengine.pid
EnvironmentFile=-/etc/sysconfig/rtpengine
ExecStart=/usr/local/bin/rtpengine -p /var/run/rtpengine.pid \$OPTIONS
Restart=on-abort
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/rtpengine.service
systemctl enable rtpengine.service
mkdir -p /var/spool/rtpengine
systemctl start rtpengine
systemctl status rtpengine.service
rtpengine --codecs | grep "G729"
vim /etc/sysconfig/rtpengine
OPTIONS="-i publicIP -n 127.0.0.1:2223 -m 10000 -M 20000 -L 4 --log-facility=local0 --table=8 --delete-delay=0 --timeout=60 --silent-timeout=600 --final-timeout=7200 –offer-timeout=60 --num-threads=12 --tos=184 –no-fallback –log-level=7 --recording-dir=/var/spool/rtpengine/ "
sudo systemctl restart rtpengine