I recently installed Asterisk 1.8.3 (the Asterisk team now provides pre-built Debian packages at http://packages.asterisk.org).
Unfortunately, that package came without the res_srtp SRTP module. (UPDATE: Starting in 1.8.4, it does come with it.) Because I didn’t feel like re-compiling the entire package, I just took the corresponding version of res_srtp.c from the SVN, added the following lines to the beginning of it:
#ifndef AST_MODULE
#define AST_MODULE "res_srtp"
#endif
and compiled and installed it using
gcc -shared res_srtp.c -o res_srtp.so -lsrtp
sudo cp res_srtp.so /usr/lib/asterisk/modules/
You’ll need to have libsrtp0-dev and asterisk-dev installed, otherwise the compile will fail.
Then, you can do sudo asterisk -r
and load the module using module load res_srtp
(or just restart Asterisk).
I’m still working on getting SRTP working flawlessly both incoming and outgoing and with stuff like transfers. Asterisk Secure Calling Specifics are a good starting point, but I’m also planning to write another post about this in the near future.
It seems they did it again with version 1.8.9.0 for ubuntu/debian.
I had to redo your trick
(This time res_srtp.c is in the code, but is not compiled or included in packages from digium… WTF ?)
1.8.8.0 still contains it, seems like this is a regression bug. You should file this as a bug against “AsteriskNOW and Packages” at https://issues.asterisk.org/jira. Bugs ANOW-137 and ASTERISK-18738 look like they’re related, but I have not been able to identify the specific change. The Squeeze package is still at 1.8.8.0 and contains res_srtp, but the Lucid package is already at the version you mentioned.
You don’t need to edit res_srtp.c, just add -DAST_MODULE=\”res_srtp\”. Also, for 64bit OSes, you might also need -fPIC.
I followed your instructions with 1.8.19.0 source and it gave me the following error:
etang@optware:~/slug/optware/ddwrt/builds/asterisk18/res$ gcc -shared res_srtp19.1.c -o res_srtp.so -lsrtp -DAST_MODULE=\”res_srtp\”
res_srtp19.1.c:90:2: error: unknown field ‘replace’ specified in initializer
res_srtp19.1.c:90:2: warning: initialization from incompatible pointer type [enabled by default]
res_srtp19.1.c:90:2: warning: (near initialization for ‘srtp_res.destroy’) [enabled by default]
It looks like they added an additional function in revision 356604. http://svnview.digium.com/svn/asterisk/tags/1.8.19.0/res/res_srtp.c?r1=356603&r2=356604&
Any idea how to get around this error? BTW, I’m cross compiling for mipsel.
Thanks for this worked beautifully I have a 64bit OS so needed -fPIC at the end
then went to asterisk and did module load as instructed.
worked great thanks!!!
Hi,
solved the problem so installed all that is possible in “libgmime” and
–
gcc-shared res / res_http_post.c-o res / res_http_post.so-fPIC `pkg-config – cflags – libs gmime-2.6`