Archive for March, 2022

RTPEngine 10: rpm compilation in Centos 7

Thursday, March 31st, 2022

This is a note without detailed examples.

Main idea: 1) update kernel, 2) add RPM Fusion repository and install ffmpeg from it.

If trying to compile RTPEngine 10 in CentOS 7 with ffmpeg installed from some other repository (e.g. nux-desktop, as I had) – you’ll get an error! (see screenshot)

Update kernel (my system had 3.10.0-957.el7.x86_64 after installation):

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

Updated to the newest available from standard repository (3.10.0-1160.59.1.el7.x86_64):

yum --showduplicates list available kernel.x86_64

yum install kernel-3.10.0-1160.59.1.el7


[root@localhost ~]]# uname -a
Linux localhost.localdomain 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Add RPM Fusion repository as described here:

I’ll duplicate instructions:

yum install dnf

dnf install --nogpgcheck$(rpm -E %rhel).noarch.rpm

dnf install --nogpgcheck$(rpm -E %rhel).noarch.rpm$(rpm -E %rhel).noarch.rpm

Then disable nux-desktop (if you previously installed ffmpeg from it) repository (‘enabled=0’ in /etc/yum.repos.d/nux-dextop.repo).

Ensure that ffmpeg and ffmpeg-devel now are available from just added RPM Fusion repository and install them (you’ll see repo name in the yum output, not shown here):

yum --showduplicates list available ffmpeg
yum check-update 
yum install ffmpeg ffmpeg-devel

Then create build directory structure (use rpmbuild tool).

Download version 10 ZIP archive from RTPEngine git, somewhere from here . Unzip it.

Put rtpengine/el/rtpengine.spec to rpmbuild/SPECS/

Then archive again into tar.gz format with such name (according to settings in .spec file!):

tar czvf ngcp-rtpengine- rtpengine-mr10.Y.Z/

Put ngcp-rtpengine- to rpmbuild/SOURCES/


rpmbuild -ta rpmbuild/SOURCES/ngcp-rtpengine-

Ready rpms will be under rpmbuild/RPMS/ .

Install them in this sequence: ngcp-rtpengine-dkms, ngcp-rtpengine, ngcp-rtpengine-debuginfo, ngcp-rtpengine-kernel, ngcp-rtpengine-recording .

OpenSIPS: monitoring with Zabbix: HTTP Agent, JSONPath

Thursday, March 24th, 2022

This guide will help you to understand how OpenSIPS can be monitored with Zabbix, sharing its statistic data via HTTP interface in JSON format. This article assumes using OpenSIPS 3.2 and Zabbix 6.

Enable embedded HTTP server and HTTP support for Management Interface in your OpenSIPS:

loadmodule ""
modparam("httpd", "ip", "")
modparam("httpd", "port", 8888)

# :8888/mi
loadmodule ""
modparam("mi_http", "root", "mi")

Now we may try to send a JSON-RPC OpenSIPS MI command from the command-line, using curl (official example at the very bottom of the page):

/usr/bin/curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": "1", "method": "uptime"}'

The official documentation does not have other more complicated examples, e.g. “get_statistics sl:”, that’s why I decided to write this article, maybe it’s more about JSON, JSONPath and working with all this in Zabbix.

As an example, we’ll get stateless replier module statistics, like shown by invoking a CLI command “opensips-cli -x mi get_statistics sl:” .

/usr/bin/curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": "1", "method": "get_statistics", "params": {"statistics": ["sl:"]}}'

I’ll also duplicate the command with a screenshot (to be sure that you see it in a right way, because markup may cut some special characters):

Tip: if you need statistics from several groups, for example several modules (not only SL), the request will be as follows:

/usr/bin/curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": "1", "method": "get_statistics", "params": {"statistics": ["sl:", "tm:"]}}'

OpenSIPS will answer and you’ll see SL module statistics after sending this request with CURL.

But the responce is a one-liner, so we need to convert this one line to JSON format and then to create a JSONPath, to be able to extract the value we need.

Let’s monitor not all SL module statistics received from OpenSIPS, but the number of 2xx replies only.

I use for JSON formatting and for creating JSONPath. After formatting and specifying JSONPath we can configure Zabbix.

Now it’s time to add items to your OpenSIPS host in Zabbix. Item parameters:

Type: HTTP Agent
Type of information: Numeric (unsigned)
Request type: POST
Request body type: JSON data
Request body: {"jsonrpc": "2.0", "id": "1", "method": "get_statistics", "params": {"statistics": ["sl:"]}}
Retrieve mode: Body
Convert to JSON (enabled)

Screenshots as usual:

Item Preprocessing parameters:

1st step - JSONPath
Parameters: $.body.result.["sl:2xx_replies"]
Type of information: Numeric (unsigned)

Screen – item Preprocessing and successful testing:

Now we add a graph with this item (I hope you know how to create graphs in Zabbix) and it’s time to test. I will generate thousands of OPTIONS requests to my OpenSIPS with the sipp tool (I also recommend this sipp cheatsheet).

Download OPTIONS.xml scenario file, and generate 10000 OPTIONS requests with call rate of 10 (I assume that your OpenSIPS, like mine, answers “200 OK”):

sipp -sf OPTIONS.xml -l 10000 -m 10000 -r 10

Finally, here is the graph showing your OpenSIPS SL module 2xx processed replies statistics:

This is how you can monitor OpenSIPS with Zabbix using JSON.

Have fun!

Asterisk: removing all queue dynamic members

Sunday, March 20th, 2022

Users add themselves as queue members by dialing some short number (AddQueueMember dialplan app is used). The queue may contain several dynamic members.

The task is to remove all queue members by dialing some number, no matter how much members are in this queue. Queue name is ‘superQueue’ (example for AEL, Asterisk 13):

// remove all dynamic queue members
0000 =>
    NoOp(superQueue member  list: ${QUEUE_MEMBER_LIST(superQueue)});

    // count members of a queue

    // and remove all, one by one
    while (${count} >= 1) {
        Log(NOTICE, removing dynamic member: ${kicked});


systemd: cleaning journal service logs

Tuesday, March 1st, 2022
voip ~ # journalctl --disk-usage
Archived and active journals take up 4.2G on disk.
voip ~ # du -sh /var/log/journal/
4,3G /var/log/journal/

Let’s leave 500M of logs only:

voip ~ # journalctl --vacuum-size=500M

Vacuuming done, freed 3.5G of archived journals on disk.

Check once again:

voip ~ # journalctl --disk-usage
Archived and active journals take up 744.2M on disk.
voip ~ #
voip ~ # du -sh /var/log/journal/
745M /var/log/journal/