Tuesday, May 13, 2014

OPUS codec with transcoding on Asterisk 11.5.x (or higher, 11.6,11.7,11.8,11.9) with(out) FreePBX

Hi all, this is just a quick and dirty guide to get OPUS and VP8 running on Asterisk 11.9.0 on your Debian box.

  • All credits for the Asterisk patch to meetecho and forked by netaskd for Asterisk 11.5.x or higher support.
  • This guide is intended for Debian 6 - 64bit platform only. Of course, with a little research, you could do it for other platforms as well.
  • Want to know more about why i am so gung-ho about OPUS, see here.
  • If you want a quick and easy access to a fully running Asterisk 11.5.x. From this image, follow the guide below to get it update to Asterisk 11.9 and get OPUS/VP8 enabled and running
  • IMPORTANT: There are some legal implications using OPUS on Asterisk code, read all about it here. REMEMBER, this is for educational use only.

Ok, let’s get down to business.

  1. Get “autoconf”, “automake” “pkg-config”
    # apt-get install autoconf automake pkg-config
  2. Get the latest libopus
    # cd /usr/src
    # wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz && tar –zxvf opus-1.1.tar.gz && cd opus-1.1
    # ./configure
    # make all && make install
  3. That should get your opus ready for asterisk installation. Since vp8 is merely passthru, it will not require and libraries.
  4. Now, go to the asterisk source installation directory (if you don’t have it, simply download it from here). If you are running my image, you could overwrite the 11.5 by simply follow the guide below.
  5. Now, lets get started on asterisk side
    # cd /usr/src/asterisk-11.9.0
    # wget https://raw.githubusercontent.com/netaskd/asterisk-opus/master/asterisk-11.5.0_opus+vp8.diff -O asterisk_opus+vp8.diff --no-check-certificate
    # patch –p1 –u < asterisk_opus+vp8.diff
    You should see everything working well so far like below.
    image
    # ./bootstrap.sh
    # make clean && ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib --prefix=/usr
    IMPORTANT: If you do not have libsrtp, leave only with “--prefix=/usr”, remove the rest in that line. Libcryto and ssl are used for SRTP (for WebRTC mainly)
    # make menuselect
    IMPORANT: Please be sure to select 1) Codec Opus in Codec Translations, 2) Format VP8 in Format Interpreters and for best compatibility, 3) all sounds that’s SLIN16 (not selected by default) in Core Sound Packages, MOH Packages and Extra Sound..
    IMPORANT: If you can’t select Opus something went wrong in your libopus installation!, otherwise it should be preselected for you, but do check nontheless
    FREEPBX USERS! IMPORTANT: FreePBX users, be sure to select format_mp3, res_config_mysql, app_mysql, app_saycountpl and cdr_mysql in Add-ons
    # save and exit
    FREEPBX USERS! IMPORTANT: Run this # contrib/scripts/get_mp3_source.sh
    # make && make install
  6. Now if you use freepbx, simple run #amportal kill && amportal start
  7. Otherwise, simply kill and start back Asterisk
  8. You should see opus in the translation list
    # asterisk -rx "core show translation"
  9. Also, if you go into asterisk cli, you could type opus <tab> and set debug…that all means the patch worked great, now to test!
  10. Be sure to set allow=opus in your sip general setting or per peer/user. For FreePBX users, go to FPBX UX and select Asterisk SIP settings, set allow opus/vp8 like below right at the bottom of that page.
     image
  11. Use a phone that supports OPUS (on Windows you’ve got Phoner, MicroSIP, on mobile you’ve got CCIPSimple or BRIA) and dial away to test
  12. Here’s my BRIA on my Android with Opus at 48Khz, dialing the echo test on FreePBX *43
    ss

Next, i am going to try this on WebRTC with passthru support for VP8 and full transcoding with OPUS!

Cheers and have a good week ahead, do send your feedbacks to sanjay---at@---astiostech.com

1 comment:

Kudpudeen .M said...

Hi Sanjay,

Thanks for your excellent tutorials.
Now I'm getting struggled in asterisk with webRTC support.

WebRTC with asterisk not working!

I'm using your pre configured vm image disk for testing webRTC support. And also configured my own asterisk followed by your tutorials.
Chrome 34 version works for me.
Prior google chrome update,it works fine. but after chrome updated(stable), now i'm getting "incompatible SDP error".

In asterisk console,

"WARNING[2612][C-00000000]:chan_sip.c:10487 process_sdp:Rejecting secure audio stream without encryption details:audio 18435 RTP/SAVPF 111 103 104 0 8 106 105 13 126
== Using SIP RTP CoS mark 5"

but before one month(i.e: April) same configuration works for me

Is there any problem with chrome stable or asterisk ?

Please help me.

Thanks & Regards

kudpudeen