We have started to use OPUS codec to deploy our remote peers and so far it sounds amazing with very little bandwidth which almost matches GSM in terms of bandwidth and sound quality is as good as 48khz MP3 files. This is the future of IP telephony, for sure! Newer versions of Asterisk (13++), already comes with OPUS built straight into the core code from Asterisk folks. However, for Asterisk 11, we need to configure it manually. This article attempts to provide some guide to setting up OPUS on Asterisk 11.2x or higher. Since Asterisk 11.24.1 was just released, i will be using that version as part of this guide and the latest stable build of of libopus from xiph.org.
Note: Tested this with 11.20 through 11.24.1
This is not a guide on how to install Asterisk. This guide assumes you’ve already got Asterisk up and running without problems and just want to get OPUS running.
All credit for the original Asterisk patch to meetecho and forked by xxsl for Asterisk 11.20 or higher support.
Ok, let’s get down to business.
- Get “autoconf”, “automake” “pkg-config”
# (yum install) apt-get install autoconf automake pkg-config - Get the latest libopus
# cd /usr/src
# wget //downloads.xiph.org/releases/opus/opus-1.1.3.tar.gz && tar –zxvf opus-1.1.3.tar.gz && cd opus-1.1.3
# ./configure
# make all && make install - That should get your opus ready for asterisk installation. Since vp8 is merely passthru, it will not require any libraries. It will allow two or more VP8 capable peers to passthru video without transcoding.
- Now, lets get started on asterisk side, assuming you’ve got the Asterisk source in /usr/src/, your version must be 11.20 or higher up until 11.24.1
# cd /usr/src/asterisk-11.24.1
# wget http://www.orencloud.com/public/opuspatch-ast11.2x.patch
# patch -p1 -u < opuspatch-ast11.2x.patch
You should NOT see any “failed” message
- Now go ahead and recompile Asterisk
# ./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 - Now if you use freepbx, simple run #amportal kill && amportal start
- Otherwise, simply kill and start back Asterisk
- You should see opus in the translation list
# asterisk -rx "core show translation" - 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!
- 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.
- 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
- Here’s my BRIA on my Android with Opus at 48Khz, dialing the echo test on FreePBX *43
- You can also fine tune the codec settings in /etc/asterisk/codec.conf, here’s an example from my own PBX
More info on codec.conf is explained below - codec.conf configuration snippets for Asterisk
; Default Custom OPUS format definitions, only one custom OPUS format
; per sample rate is permitted.
[opus48]
type=opus
samprate=48000 ; Sample rate of this opus format in hz.
; 8000, 12000, 16000, 24000, 48000 are acceptable values.
;fec=true ; turn on or off encoding with forward error correction.
; On recommended, off by default.
;maxbitrate=10000 ; Use the table below to make sure a useful bitrate is chosen
; for maxbitrate. If not set or value is not within the bounds
; of the encoder, a default value is chosen.
;
; sample rate | bitrate range
; 8khz | 6000 - 20000 bps
; 12khz | 7000 - 25000 bps
; 16khz | 8000 - 30000 bps
; 24khz | 18000- 28000 bps
; 48khz | 24000- 32000 bps
;dtx=true ; Encode using discontinuous transmission mode or not. Turning this
; on will save bandwidth during periods of silence at the cost of
; increased computational complexity. Off by default.
;cbr=true ; Whether or not to encode with constant or variable bit rate. Constant
; bit rate is disabled by default.
[opus16]
type=opus
samprate=16000
No comments:
Post a Comment