OpenSIPS: killing a plenty of dialogs manually

June 23rd, 2025

This is almost the same as I’ve already posted.

The difference is that now we will kill dialogs not based by the remote side IP address, but based on datestart. There was some short-term connectivity interruption which caused a sudden increase in dialogs count. It’s normal for such a situation and they will end by the configured lifetime (‘default_timeout‘ parameter), e.g. 1 hour.

But what if we don’t want to wait and if we want to kill them manually?

The idea is to pick dialogs which were created during time range, assuming that you know an average call duration, and it’s obvious that if such calls are still shown by ‘opensips-cli -x mi dlg_list’ , it means that it is not valid alive call and you can kill it.

As it’s seen on the graph, the increasing was between 12:14 and 12:23. Let’s say it’s 12:30 now, and an average call duration is 30 … 60 seconds. So, we can kill dialogs which were created between 12:14 and 12:23 and which are still visible with ‘opensips-cli -x mi dlg_list’.

… and so on, up to 12:23. After that you’ll have several txt files with dialog IDs. Not it’s time to kill them:

… and the same for each file.

SQL: sed-like replacement of a string

April 30th, 2025

Imagine the situation: you have an SQL table with some string in some column. There is a plenty of such rows, and you want to replace this string in each row with some other string, something like in Bash – sed ‘s/green apple/blue apple/g’.

The original table looks like this.

Select:

Result:

We want to change “from ACME” to “moved from ACME”.

First, let’s test our SQL statement with SELECT, no changes will be made:

Now do an SQL UPDATE in a sed-like style:

The result after an UPDATE:

So, to test the statement, do:

To replace, do:

If you need case-insensitive, use ILIKE instead of LIKE.

Asterisk: skip some action within timeout after a call

April 29th, 2025

Let’s skip playing an annoying greeting for the caller, if he already called us withing the last 10 minutes.

Create a macro:

And use this macro in your dialplan:

OpenSIPS: dialplan module usage examples

December 8th, 2024

Use case 1:
convert the username consisting of letters in incoming INVITE from your VoIP provider to digits
(e.g. INVITE: rt_user1@192.168.1.203 -> INVITE: 13511654321@192.168.1.203, where country-city-subscriber is 1-3511-654321):

Add to your dialplan table:

So, the SQL record is as follows:

Read the rest of this entry »

Linux Application Firewall

December 4th, 2024

OpenSnitch – a Linux firewall for applications – interactive outbound connections filtering.
https://www.linux-magazine.com/index.php/Issues/2022/259/OpenSnitch
https://github.com/evilsocket/opensnitch

A Bash web server

December 4th, 2024

Nice oneliners which may be useful to show some console output via HTTP.

An example of showing the iptables FORWARD chain:

Then go to http://ip.add.re.ss:8080 and you will see the output as a web page. In case of adding new rules renew the webpage and you will see the newly added rules.

To report file system disk space usage:

More info: https://www.linux-magazine.com/Issues/2021/250/Bash-Web-Server/(offset)/3/(tagID)/92#

Slackware Tagfiles

October 12th, 2024

Found some old notes concerning tagfiles. This all is for Slackware 14, but mainly should be useful for newer versions as well, though may have differences, I haven’t checked and compared. See below…

Read the rest of this entry »

opensips: getting media IP

June 9th, 2024

To get the IP address from the SDP part of incoming INVITE:

http://lists.opensips.org/pipermail/users/2024-June/048189.html

NetBSD 10: httpd with PHP support

April 24th, 2024

By default httpd is run under _httpd user. To start from command line and specify another user (e.g. nobody) type:

To start httpd automatically, edit /etc/rc.conf (not /etc/rc.local , not /etc/defaults/rc.conf):

Ubuntu 20.04 remove old unused kernels

April 13th, 2024

https://askubuntu.com/a/1253348

Check what current kernel You are running:

So, this system runs 5.6.13-050613-lowlatency kernel.

List all installed kernels in Your OS:

Uninstall kernels You don’t need: