Erro Loading SRTP on Asterisk 20 and Centos 9

I’am installing a new Asterisk Vanilla Server using CentOS 9 and Asterisk 20, but I am getting a error when try to execute load asterisk.

[Feb 15 13:32:02] WARNING[168489]: res_srtp.c:1238 res_srtp_init: Failed to initialize libsrtp
[Feb 15 13:32:02] ERROR[168489]: loader.c:2513 load_modules: *** Failed to load module res_srtp.so
[Feb 15 13:32:02] ERROR[168489]: asterisk.c:4039 check_init: Module initialization failed. ASTERISK EXITING!

How can I fix this issue?

CentOS Stream release 9
Asterisk 20.1.0
libsrtp-2.3.0-7.el9.x86_64

Thanks for help

This is with the libsrtp itself. I recall a previous reporter ended up building libsrtp themselves which resolved the issue.

Thanks for reply and help, I did download source and test with libsrtp 1.6.0 and 2.5.0, both show me the same issue

[Feb 15 14:59:01] ERROR[180995]: loader.c:2513 load_modules: Error loading module ‘res_srtp.so’: libsrtp2.so.1: cannot open shared object file: No such file or directory

Than i linked a file to /usr/lib64 but after that it show me other error.

[Feb 15 15:44:46] ERROR[181205]: loader.c:2513 load_modules: Error loading module ‘res_srtp.so’: /lib64/libsrtp2.so.1: invalid ELF header

Do you have some clue?

What is the output of Linux the shell command file run against the .so and the shell command ldd run against res_srtp.so?

Thanks for your help.

Here it is

# ldd /usr/lib64/asterisk/modules/res_srtp.so
/usr/lib64/asterisk/modules/res_srtp.so: error while loading shared libraries: /lib64/libsrtp2.so.1: invalid ELF header

# ldd /lib64/libsrtp2.so.1
        not a dynamic executable

and the output from file?

(It is fairly clear that /lib64/libsrtp2.so.1 is not a valid file, but the output from file may tell us what it actually is, and give a clue as to why an invalid file ended up here.)

The output should be similar to:

$ file /usr/lib/x86_64-linux-gnu/libsrtp2.so.1
/usr/lib/x86_64-linux-gnu/libsrtp2.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=253ec3df7298ab513ee583fbe694e13d96b0bdda, stripped

This is from Debian, not CentOS. This version is not being used with Asterisk and may or may not be compatible.

If it says symbolic link, you should repeat file on the link target.

Thanks david551, it show me the way, I will describe how I did solve at CentOS 9 and now work.

  1. Download last version LIBSRTP 2.5 (GitHub - cisco/libsrtp: Library for SRTP (Secure Realtime Transport Protocol))
  2. Build a Shared Library
./configure --enable-openssl
make shared_library
sudo make install
  1. Link the library to the /usr/lib64/, because they will install it in other directory
ln -s /usr/local/lib/libsrtp2.so.1 /usr/lib64/libsrtp2.so.1

And this solve the issue to me.

Thanks to David and JColp

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.