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.
module show like hepIf the modules are already present and loaded, the result should be something like this:
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 loadedIf 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:
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
[modules]
autoload = yes
load => res_hep.so
load => res_hep_pjsip.soConfigure the file “/etc/asterisk/hep.conf” as follows, where the IP 192.168.100.142 is the address of the asterisk network card.
[general]
enabled = yes
capture_address = 192.168.100.142:9061
capture_password = senha
capture_id = 1234
uuid_type = call-idNow restart Asterisk
systemctl restart asterisk.serviceThen create this file “/root/.sngreprc” with the following content:
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 onOnce done, start sngrep with the following command:
sngrep -d lo
Now we just have to wait for the events to appear.
