Asterisk

Asterisk WebRTC packets do not appear in Sngrep

When we work with WebRTC in Asterisk, normally the packets (REGISTER, OPTIONS, INVITE, etc) do not appear in Sngrep by default.

To solve this problem, we need to configure and enable the “hep” module in Asterisk.

First check if the modules already exist in your installation.

Bash
module show like hep

If the modules are already present and loaded, the result should be something like this:

Bash
Module                         Description                              Use Count  Status      Support Level
res_hep.so                     HEPv3 API                                2          Running          extended
res_hep_pjsip.so               PJSIP HEPv3 Logger                       0          Running          extended
res_hep_rtcp.so                RTCP HEPv3 Logger                        0          Running          extended
3 modules loaded

If your installation does not appear this way, then you will need to recompile Asterisk including these modules, or you will need to install the packages via RPM, if your installation was done this way. In my case I installed using the RPM packages.

asterisk-hep-18.2.2-1.el8.x86_64.rpm
asterisk-hep-debuginfo-18.2.2-1.el8.x86_64.rpm

Having the modules installed, it’s time to start them with these commands:

Bash
asterisk -rx "module load res_hep.so"
asterisk -rx "module load res_hep_pjsip.so"

To ensure they are loaded at boot time, include these lines in the “/etc/asterisk/modules.conf” file

Bash
[modules]
autoload = yes
load => res_hep.so
load => res_hep_pjsip.so

Configure the file “/etc/asterisk/hep.conf” as follows, where the IP 192.168.100.142 is the address of the asterisk network card.

Bash
[general]
enabled = yes
capture_address = 192.168.100.142:9061
capture_password = senha
capture_id = 1234
uuid_type = call-id

Now restart Asterisk

Bash
systemctl restart asterisk.service

Then create this file “/root/.sngreprc” with the following content:

Bash
set eep.listen on
set eep.listen.address 192.168.100.142
set eep.listen.port 9061
set eep.listen.pass senha
set eep.listen.uuid on

Once done, start sngrep with the following command:

sngrep -d lo

Now we just have to wait for the events to appear.

Sngrep

I hope I have contributed!

Leave a Reply

Your email address will not be published. Required fields are marked *