Monday 28 August 2017

How to install and use Opus codec in Astersik


This document shows you how to install and use Opus codec in Asterisk server:



Here select appropriate Asterisk version of your instalation and then server architecture, in my case it was Asterisk 13 with 64 bit

2. Now download file as below,
- cd /usr/src
- wget http://downloads.digium.com/pub/telephony/codec_opus/asterisk-13.0/x86-64/codec_opus-13.0_current-x86_64.tar.gz

3. Extract the downloaded file,
- tar -xvzf codec_opus-13.0_current-x86_64.tar.gz
- cd codec_opus-13.0_1.1.0-x86_64

4. Copy the codec_opus.so file into the Asterisk module directory
- cp codec_opus.so /usr/lib/asterisk/modules/

5. Copy the codec_opus_config-en_US.xml file into the Asterisk external documentation directory
- cp codec_opus_config-en_US.xml /var/lib/asterisk/documentation/thirdparty

6. Goto Asterisk CLI and restart it
- asterisk -rvvvv
- core restart now
- asterisk -rvvvv
- core reload

7. Now check opus codec running or not with below command
ubuntu*CLI> module show like opus
Module Description Use Count Status Support Level
codec_opus.so OPUS Coder/Decoder 0 Running extended
res_format_attr_opus.so Opus Format Attribute Module 1 Running core

If module not loaded, then try to load it manually from Asterisk cli,
- module load codec_opus.so
- module load res_format_attr_opus.so

8. Open file, nano /etc/asterisk/sip.conf and allow opus codec in it as shown below, so SIP soft phones can use that codec.

[general]
callcounter=yes ; enable device states for SIP devices
rtcachefriends=yes
udpbindaddr=0.0.0.0:5060
disallow=all
allow=opus
allow=ulaw
allow=alaw
allow=gsm

After adding, do sip reload from Asterisk cli to take changes into effect
ankit-desktop*CLI> sip reload
Reloading SIP
== Parsing '/etc/asterisk/sip.conf': Found
== Parsing '/etc/asterisk/users.conf': Found
== Using SIP CoS mark 4
== Parsing '/etc/asterisk/sip_notify.conf': Found
ankit-desktop*CLI>

1 comment:

  1. Hello ,

    I am facing issue with the recorded voice using MixMonitor when the call is made using opus. our SIP Traffic and RTP are TLS and SRTP respectively. Is there any clue ?

    Thanks
    Abdul Rasheed

    ReplyDelete