oracle 8 linux. rtpengine 11.2 with uek kernel
There are some specific TIPS for ORACLE linux 8 and UEK core for compiling\installing rtpengine.
for test vanilla server i will use oracle 8 linux:
take ISO from: https://yum.oracle.com/oracle-linux-isos.html
set http repository: http://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64
INSTALL RTPENGINE 11.2.2.0
git clone https://bitbucket.org/yooxy/centos8-rtpengine10-all-codecs.git
cd centos8-rtpengine10-all-codecs
#use precompiled pkgs from RPMS/el8/ and RPMS/el8/11 dirs
dnf -y install epel-release
dnf config-manager --set-enabled ol8_codeready_builder
dnf -y install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
dnf -y install SDL2
dnf install kernel-uek-devel
cd RPMS/el8
dnf localinstall ffmpeg-libs-4.2.7-1.el8.x86_64.rpm libavdevice-4.2.7-1.el8.x86_64.rpm
cd 11
dnf localinstall ngcp-rtpengine-11.2.2.0+0~mr11.2.2.0-1.el8.x86_64.rpm ngcp-rtpengine-kernel-11.2.2.0+0~mr11.2.2.0-1.el8.x86_64.rpm ngcp-rtpengine-dkms-11.2.2.0+0~mr11.2.2.0-1.el8.noarch.rpm
INSTALL UEK KERNEL
We will using UEK 5.4.17. check “uname -a” maybe you already have 5.4.17 kernel, if not:
dnf config-manager --disable ol8_UEKR7 dnf config-manager --enable ol8_UEKR6 dnf install kernel-uek kernel-uek-devel reboot
SIGN MODULE ORACLE 8
Issue “Key was rejected by service” may happens if you have enabled “Secure boot”.
To check it: run “mokutils –sb-state”. In enabled state you have to sign your rtpengine module for kernel. To add your key do this:
mokutil –import /var/lib/dkms/mok.pub
enter password you wish, and after reboot you see in BOIS invitation to enroll your keys. do it with password you have entered before and then xt_rtpengine module will be loaded correctly.
ISSUES:
If you have installed UEK 5.15+ then you have to update you GCC compiler to 11+ or you will have error when compiling kernel module for rtpengine: you are using 11.5 GCC for compiling kernel and 8.5 for compiling xt_rtpengine.
modprobe: FATAL: Module xt_RTPENGINE not found in directory
Extension RTPENGINE revision 0 not supported, missing kernel module?
ERR: [core] FAILED TO CREATE KERNEL TABLE 0 (No such file or directory), KERNEL FORWARDING DISABLED
dkms (kernel) module xt_RTPENGINE not compiled at all.
in common cases you have to install kernel-uek-devel-<version>, where version is “uname -r”
../lib/codeclib.h:53:10: fatal error: libswresample/swresample.h: No such file or directory
dnf install libswresample-devel -y
/lib/codeclib.h:54:10: fatal error: libavcodec/avcodec.h: No such file or directory
dnf install libavcodec-devel -y
./include/media_player.h:29:10: fatal error: libavformat/avformat.h: No such file or directory
dnf install libavformat-devel -y
FAILED TO OPEN/DELETE KERNEL TABLE 0 (Permission denied), KERNEL FORWARDING DISABLED
rtpengine kernel module named xt_RTPENGINE creates 2 file in /proc/rtpengine, control and list. If you see permission of this files it will be only for root. That is why rtpengine can not use as ngcp-rtpengine.
Ofcourse somewhere good solution is present, but you can just change ngcp-rtpengine to root in rtpengine.services file and everything will start correctly.
RTPENGINE cluster TIPS
There main concept here: https://github.com/sipwise/rtpengine/wiki/Redis-keyspace-notifications
but few important thing to check:
1. Redis have disabled keyspace notification to enable change to notify-keyspace-events “AKE” in redis.conf
2. interface names should start exactly from “pub”
3. If you have not active interface IP on passive (pub2) rtpengine you have to set sysctl net.ipv4.ip_nonlocal_bind=1
| Posted in opensips, rtpengine | No Comments »
Rtpengine. Opus. Ilbc.
I am using ilbc to make calls with mobile applications. As we know ilbc is old codec, all tests,table and pictures all over the net make us feel as ilbc most worse then opus. because opus is faster, more quality e.t.c.
Seems… my opinion is different, if you want good quality and minimum bandwidth out of box then use ilbc – it’s not problem, it will have 23kb bandwidth for one side. Audio bandwidth up to 4kHz so voice will be good enough for conversation. But there is no way to reduce bitrate and bandwidth with ilbc, so let’s try to implement opus.
also, converting 48kHz(sample rate) files with libopus is slowest then with ilbc in most of cases. Be noted that you can not use opus with 8kHz(sample rate) in default configuration by rtpengine only 48kHz is supported.
Components used for testing:
- centos 7: iftop, tcpdump
- custom ffmpeg 4.2.7,
- opus 1.3.2,
- opus-tools: opusenc, opusrtp
- rtpengine 11.0.1.5,
- microsip 3,
- sipp 3.6.
- clumsy ( simulate bad network on windows)
I will start from end, maybe it will be helpful for someone. What was my aim, i wanted to use packet loss, fec, speech mode, low bandwidth from opus codec.
Success:
* low bandwidth with 8kb\s bitrate (13kb\s actual) and 40ms frame duration.
Failed:
* packet_loss (no way to understand if it really works, real test does not show that it helps)
* fec, ( same as packet loss)
* speech mode, (take more cpu resources when encoding without real result)
How to add opus support into rtpengine.
For encoding\decoding opus rtpeginge using ffmpeg library. so you have to be sure that libopus is present with ffmpeg. you can do that with: “ffmpeg -h encoder=libopus” if you don’t see: “Codec ‘libopus’ is not recognized by FFmpeg.” then seems ffmpeg have opus with libopus encoder\decoder.
How to set parameters for opus codec:
when you do rtpengine_offer use this: as one of params:
codec-transcode-opus/48000/2/8000/40/maxaveragebitrate–8000;maxplaybackrate–12000;useinbandfec–1;ptime–40;maxptime–40/ar-48000,b–8000
where is :
48000 – sample rate in SDP
2 – channels (default for opus)
8000 (b\s) – bitrate for codec implement on encoder side
40 (ms) – frame duration (should affect on encoder side, but you have a=ptime 20 in SDP, codec will work on 20 ms)
“maxaveragebitrate–8000;maxplaybackrate–12000;useinbandfec–1;ptime–40;maxptime–40” there are a=fmtp parameters into SDP, you can check what it means in RFC.
“ar–48000,b–8000” – codec individual options you can take a look ffmpeg docs to check what you can use. For some reason individual options for opus codec like packet_loss can not be set by this logic, you have to set it inside codeclib.c in rtpengine source code . for example “
if (enc->ptime > 0 ) { codeclib_set_av_opt_int(enc, "frame_duration", enc->ptime); codeclib_set_av_opt_int(enc, "packet_loss", 5); codeclib_set_av_opt_int(enc, "fec", 1); codeclib_set_av_opt_int(enc, "application", 2048); }
issues: when you set 40 ms frame_duration for opus and you have not any a=ptime 40 in SDP towards to destination peer, peer will not send stream with 40 ms frame_duration, maybe there is a bug into Microsip. Using ptime and maxptime into codec options – not helps.
so, to avoid this i did add ptime=40 as rtpengine_offer parameter and add little fix to codeclib.c to make 40ms default ptime for opus codec.
How to check speed of converting with libopus
you need any music input file, for example any.wav. then you may try to use
“ffmpeg -i madonna-48k.wav -c libopus -ab 18000 madonna.opus“
it will convert wav file to opus with bitrate 18k\s
as result you will see some data ended with
“size= 82kB time=00:00:39.83 bitrate= 16.8kbits/s speed= 136x”
also you can convert it with libilbc encoder:
“ffmpeg -i madonna-48k.wav -c libilbc -ar 8000 -ab 18000 madonna.lbc“
you will see:
“size= 74kB time=00:00:39.84 bitrate= 15.2kbits/s speed= 170x“
to be continued….
16.08.2022Oracle Centos 8. Rtpengine with all codecs supported.
As result of this instruction you will have all this codecs supported in your centos 8 installations.
PCMA: fully supported
PCMU: fully supported
G723: fully supported
G722: fully supported
G729: fully supported
G729a: fully supported
speex: fully supported
GSM: fully supported
iLBC: fully supported
opus: fully supported
AMR: fully supported
AMR-WB: fully supported
telephone-event: fully supported
CN: fully supported
Synopsis:
RPMS, build and install scripts: git clone https://bitbucket.org/yooxy/centos8-rtpengine10-all-codecs.git
This instruction will give you RTPENGINE for Centos 7 and Centos 8 withh all codecs. RPM packages in RPMS dir are ready for install. But also you have rpmbuild-rtpengine.el7 and rpmbuild-rtpengine.el8 to compile it on your system in automatically way.
if you start to compiling on new system, then everything should go fine after you type sh rpmbuild-rtpengine.el7.
IF you work on production system , then check files you are running before start due to you may to install unnecessary packets or kernels.
To build rtpengine with all codecs (g729,AMR,opus,iLBC, GSM) on Centos 8:
cd ~
git clone https://bitbucket.org/yooxy/centos8-rtpengine10-all-codecs.git
sh rpmbuild-rtpengine.el8
cd ~/rpmbuild/RPMS/
dnf install noarch/ngcp-rtpengine-dkms-10.5.1.3+0~mr10.5.1.3-1.el8.noarch.rpm x86_64/ngcp-rtpengine-kernel-10.5.1.3+0~mr10.5.1.3-1.el8.x86_64.rpm x86_64/ngcp-rtpengine-10.5.1.3+0~mr10.5.1.3-1.el8.x86_64.rpm
Your RPMs ready for install in ~/root/rpmbuild/RPMS
To install rtpengine without build 10.5 run “sh install-rtpengine.el7”
| Posted in Без рубрики, Готовые решения | No Comments »
Talant Blogs about VOIP
| Posted in Asterisk, kamailio, rtpengine, Эксперт | No Comments »
kamailio rtpengine media timeout TIPs
- timeout will be raised only if both sides of rtp is silent
- you have to enable tcp at kamailio config (disable_tcp=no)
- you must have in kamailio cfg: listen=tcp:127.0.0.1:8090, loadmodule “xmlrpc.so”, and additional params:
loadmodule "xmlrpc.so" modparam("xmlrpc", "route", "XMLRPCS") modparam("xmlrpc", "url_skip", "^/sip") modparam("xmlrpc", "url_match", "^/RPC2")
4. you have to add route XMLRPC:
route[XMLRPCS] { xlog("L_ALERT","RPC recieved"); dispatch_rpc(); }
5. config rtpengine should have:
b2b-url = http://127.0.0.1:8090/RPC2 xmlrpc-format = 2
6. after restart kamailio and rtpengine you may to check you may do command from command line:
curl http://127.0.0.1:8090/RPC2
output should be like that:
<?xml version="1.0"?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value><int>400</int></value> </member> <member> <name>faultString</name> <value><string>Invalid XML-RPC Document</string></value> </member> </struct> </value> </fault> </methodResponse>20.09.2021
RTPENGINE + G729 DEBIAN 10.10 and Debian 11
apt update apt upgrade -y apt install -y linux-headers-$(uname -r) linux-image-$(uname -r) ##reboot mkdir /opt/rtpengine cd /opt/rtpengine apt install -qqy git curl mariadb-server libmosquitto-dev libwebsockets-dev python3-websockets apt-utils devscripts dpkg-dev debhelper iptables iptables-dev libcurl4-openssl-dev libglib2.0-dev libavcodec-extra libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libdigest-crc-perl libdigest-hmac-perl libevent-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libnet-interface-perl libpcap0.8-dev libsocket6-perl libswresample-dev libsystemd-dev nfs-common netcat-openbsd netcat unzip libconfig-tiny-perl libspandsp-dev** git clone https://github.com/sipwise/rtpengine.git . cp etc/rtpengine.sample.conf /etc/rtpengine/rtpengine.conf 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 cd ../ dpkg -i libbcg729-*.deb export DEBIAN_FRONTEND=noninteractive apt-get update -qqy mkdir -p ./debian/flavors touch ./debian/flavors/no_ngcp dpkg-checkbuilddeps dpkg-buildpackage -b -us -uc dpkg -i ../*.deb **manual edit: /etc/rtpengine/rtpengine.conf: set your IPs.
If you want to add webrtc2sip feature use next lines
certbot certonly -d webrtc.domain.com **manual edit: kamailiorc: uncomment db engine string kamdbctl create kamailio download template kamailio.cfg, tls.cfg and kamailio_local.cfg (git clone https://bitbucket.org/erewin/webrtc2sip-template.git) systemctl start rtpengine systemctl start kamailio
To make the same on Debian 11
#!/usr/bin/sh apt update apt upgrade #here you have reboot #!/usr/bin/sh mkdir /opt/rtpengine cd /opt/rtpengine apt-get install git curl -y apt-get install libmosquitto-dev libwebsockets-dev python3-websockets apt-utils dpkg-dev debhelper iptables libxtables-dev libip6tc-dev libip4tc-dev libcurl4-openssl-dev libglib2.0-dev libavcodec-extra libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libdigest-crc-perl libdigest-hmac-perl libevent-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libnet-interface-perl libpcap0.8-dev libsocket6-perl libswresample-dev libsystemd-dev nfs-common netcat-openbsd netcat unzip libconfig-tiny-perl libspandsp-dev #debian 11 apt install libxtables-dev libip6tc-dev libip4tc-dev libiptc-dev apt install -y linux-headers-$(uname -r) linux-image-$(uname -r) git clone https://github.com/sipwise/rtpengine.git . 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 cd ../ dpkg -i libbcg729-*.deb export DEBIAN_FRONTEND=noninteractive apt-get update -qqy mkdir -p ./debian/flavors touch ./debian/flavors/no_ngcp dpkg-checkbuilddeps dpkg-buildpackage -b -us -uc dpkg -i ../*.deb22.12.2020
opensips as SBC
Example of opensips SBC with 2 interfaces with full RTP proxy and g729 transcoding.
Software: opensips 3.1, rtpengine, bcg729.
example settings for rtpengine:
OPTIONS="-i external/172.18.254.50!EXTERNAL_IP -i internal/172.25.150.242 -n 127.0.0.1:2223 -m 35000 -M 65000 -L 4 --log-facility=local1 --table=0 --delete-delay=0 --timeout=60 --silent-timeout=600 --final-timeout=7200 –offer-timeout=60 --num-threads=4 --tos=184 –no-fallback"
example opensips config: git clone https://bitbucket.org/yooxy/opensips-sbc-local-external-transcode.git
| Posted in opensips, Без рубрики, Готовые решения | No Comments »
rtpengine-installation-configuration
установка rtpengine На debian 10. проходит на ура, вместе с g729 кодеком, т.е. можно использовать transonding.
исходная статья.
репозиторий со скриптами: https://bitbucket.org/yooxy/rtpengine-debian-10-install/src/master/
скрипт для debian 10 buster:
#!/usr/bin/sh apt update apt install devscripts python3-debian equivs git -y #for some reason my debian take old version libsystemd-dev by default apt install libsystemd-dev=247.3-6~bpo10+1 -y git clone https://github.com/sipwise/rtpengine.git #there are some steps to make fix for buster OS cd rtpengine/pkg/deb bash ./generator.sh bash ./backports/buster cp -r buster/* ../../debian cd ../../ #install dependencies in automatically way mk-build-deps --install #compile rtpengine dpkg-buildpackage -b -us -uc cd ../ dpkg -i rtpengine-daemon_11.4.0.0+0~mr11.4.0.0_amd64.deb rtpengine-iptables_11.4.0.0+0~mr11.4.0.0_amd64.deb rtpengine-kernel-dkms_11.4.0.0+0~mr11.4.0.0_all.deb rtpengine-utils_11.4.0.0+0~mr11.4.0.0_all.deb rtpengine_11.4.0.0+0~mr11.4.0.0_all.deb apt --fix-broken install
| Posted in rtpengine | No Comments »