I am connected to my Asterisk using Linphone using opus codec. I have compile Asterisk with opus support. Also, verified that opus is working as expected.
My Asterisk dial plan uses AudioSocket to connect to external service which requires slin16
Following is my dial plan
[my-outbound]
exten => 5001,1,Answer()
same => n,Ringing()
same => n,Wait(1)
same => n,Set(UUID=${SHELL(uuidgen | tr -d ‘\n’)})
same => n,Dial(AudioSocket/127.0.0.1:5001/${UUID},tr(0,slin16))
same => n,Hangup()
Following is my core show channel AudioSocket/127.0.0.1:5001-bcc37c76-a835-479c-8c0d-1d4f36a25e7b
– General –
Name: AudioSocket/127.0.0.1:5001-bcc37c76-a835-479c-8c0d-1d4f36a25e7b
Type: AudioSocket
UniqueID: 1757522047.3
LinkedID: 1757522046.0
Caller ID: 5001
Caller ID Name: (N/A)
Connected Line ID: 1024
Connected Line ID Name: 1024
Eff. Connected Line ID: 1024
Eff. Connected Line ID Name: 1024
DNID Digits: (N/A)
Language: en
State: Up (6)
NativeFormats: (opus)
WriteFormat: opus
ReadFormat: slin WriteTranscode: No ReadTranscode: No
Time to Hangup: 0
Elapsed Time: 0h0m21s
Bridge ID: 51ce818b-7e42-41ad-aa10-1cbcb2df09a2
– PBX –
Context: default
Extension:
Priority: 1
Call Group: 0
Pickup Group: 0
Application: AppDial
Data: (Outgoing Line)
Call Identifier: [C-00000001]
Variables:
BRIDGEPVTCALLID=g-vtrFIgbQ
BRIDGEPEER=PJSIP/1024-00000000
DIALEDPEERNUMBER=127.0.0.1:5001/bcc37c76-a835-479c-8c0d-1d4f36a25e7b
AUDIOSOCKET_SERVICE=127.0.0.1:5001
AUDIOSOCKET_UUID=bcc37c76-a835-479c-8c0d-1d4f36a25e7b
CDR Variables:
level 1: clid=“” <5001>
level 1: src=5001
level 1: dcontext=default
level 1: channel=AudioSocket/127.0.0.1:5001-bcc37c76-a835-479c-8c0d-1d4f36a25e7b
level 1: lastapp=AppDial
level 1: lastdata=(Outgoing Line)
level 1: start=1757522047.958454
level 1: answer=1757522047.959084
level 1: end=1757522047.959248
level 1: duration=0
level 1: billsec=0
level 1: disposition=8
level 1: amaflags=3
level 1: uniqueid=1757522047.3
level 1: linkedid=1757522046.0
level 1: sequence=1
Yes, I have done all necessary steps for opus support and also verified by making PJSIP call using opus.
core show codecs audio
Disclaimer: this command is for informational purposes only.
It does not indicate anything about your configuration.
ID TYPE NAME FORMAT QUALITY DESCRIPTION
6 audio g726 g726 85 (G.726 RFC3551)
4 audio alaw alaw 100 (G.711 a-law)
2 audio g723 g723 20 (G.723.1)
20 audio speex speex 40 (SpeeX)
21 audio speex speex16 40 (SpeeX 16khz)
22 audio speex speex32 40 (SpeeX 32khz)
24 audio g722 g722 110 (G722)
25 audio siren7 siren7 85 (ITU G.722.1 (Siren7, licensed from Polycom))
8 audio adpcm adpcm 80 (Dialogic ADPCM)
43 audio silk silk8 0 (SILK Codec (8 KHz))
44 audio silk silk12 0 (SILK Codec (12 KHz))
45 audio silk silk16 0 (SILK Codec (16 KHz))
46 audio silk silk24 0 (SILK Codec (24 KHz))
27 audio g719 g719 95 (ITU G.719)
19 audio g729 g729 20 (G.729A)
9 audio slin slin 115 (16 bit Signed Linear PCM)
10 audio slin slin12 116 (16 bit Signed Linear PCM (12kHz))
11 audio slin slin16 117 (16 bit Signed Linear PCM (16kHz))
12 audio slin slin24 118 (16 bit Signed Linear PCM (24kHz))
13 audio slin slin32 119 (16 bit Signed Linear PCM (32kHz))
14 audio slin slin44 120 (16 bit Signed Linear PCM (44kHz))
15 audio slin slin48 121 (16 bit Signed Linear PCM (48kHz))
16 audio slin slin96 122 (16 bit Signed Linear PCM (96kHz))
17 audio slin slin192 123 (16 bit Signed Linear PCM (192kHz))
3 audio ulaw ulaw 100 (G.711 u-law)
18 audio lpc10 lpc10 25 (LPC10)
42 audio none none 0 (<Null> codec)
5 audio gsm gsm 60 (GSM)
23 audio ilbc ilbc 45 (iLBC)
28 audio opus opus 50 (Opus Codec)
7 audio g726aal2 g726aal2 85 (G.726 AAL2)
1 audio codec2 codec2 0 (Codec 2)
26 audio siren14 siren14 90 (ITU G.722.1 Annex C, (Siren14, licensed from Polycom))
That doesn’t show transcoding. Translation paths are shown using “core show translation” and you can see if the module is loaded using “module show like opus”.
core show translation paths opus
— Translation paths SRC Codec “opus” sample rate 48000 —
opus:48000 To codec2:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(codec2@8000)
opus:48000 To g723:8000 : No Translation Path
opus:48000 To ulaw:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(ulaw@8000)
opus:48000 To alaw:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(alaw@8000)
opus:48000 To gsm:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(gsm@8000)
opus:48000 To g726:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(g726@8000)
opus:48000 To g726aal2:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(g726aal2@8000)
opus:48000 To adpcm:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(adpcm@8000)
opus:48000 To slin:8000 : (opus@48000)->(slin@48000)->(slin@8000)
opus:48000 To slin:12000 : (opus@48000)->(slin@48000)->(slin@12000)
opus:48000 To slin:16000 : (opus@48000)->(slin@48000)->(slin@16000)
opus:48000 To slin:24000 : (opus@48000)->(slin@48000)->(slin@24000)
opus:48000 To slin:32000 : (opus@48000)->(slin@48000)->(slin@32000)
opus:48000 To slin:44100 : (opus@48000)->(slin@48000)->(slin@44100)
opus:48000 To slin:48000 : (opus@48000)->(slin@48000)
opus:48000 To slin:96000 : (opus@48000)->(slin@48000)->(slin@96000)
opus:48000 To slin:192000 : (opus@48000)->(slin@48000)->(slin@192000)
opus:48000 To lpc10:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(lpc10@8000)
opus:48000 To g729:8000 : No Translation Path
opus:48000 To speex:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(speex@8000)
opus:48000 To speex:16000 : (opus@48000)->(slin@48000)->(slin@16000)->(speex@16000)
opus:48000 To speex:32000 : (opus@48000)->(slin@48000)->(slin@32000)->(speex@32000)
opus:48000 To ilbc:8000 : (opus@48000)->(slin@48000)->(slin@8000)->(ilbc@8000)
opus:48000 To g722:16000 : (opus@48000)->(slin@48000)->(slin@16000)->(g722@16000)
opus:48000 To siren7:16000 : No Translation Path
opus:48000 To siren14:32000 : No Translation Path
opus:48000 To g719:48000 : No Translation Path
opus:48000 To none:8000 : No Translation Path
opus:48000 To silk:8000 : No Translation Path
opus:48000 To silk:12000 : No Translation Path
opus:48000 To silk:16000 : No Translation Path
opus:48000 To silk:24000 : No Translation Path
core show translation paths slin
— Translation paths SRC Codec “slin” sample rate 8000 —
slin:8000 To codec2:8000 : (slin@8000)->(codec2@8000)
slin:8000 To g723:8000 : No Translation Path
slin:8000 To ulaw:8000 : (slin@8000)->(ulaw@8000)
slin:8000 To alaw:8000 : (slin@8000)->(alaw@8000)
slin:8000 To gsm:8000 : (slin@8000)->(gsm@8000)
slin:8000 To g726:8000 : (slin@8000)->(g726@8000)
slin:8000 To g726aal2:8000 : (slin@8000)->(g726aal2@8000)
slin:8000 To adpcm:8000 : (slin@8000)->(adpcm@8000)
slin:8000 To slin:12000 : (slin@8000)->(slin@12000)
slin:8000 To slin:16000 : (slin@8000)->(slin@16000)
slin:8000 To slin:24000 : (slin@8000)->(slin@24000)
slin:8000 To slin:32000 : (slin@8000)->(slin@32000)
slin:8000 To slin:44100 : (slin@8000)->(slin@44100)
slin:8000 To slin:48000 : (slin@8000)->(slin@48000)
slin:8000 To slin:96000 : (slin@8000)->(slin@96000)
slin:8000 To slin:192000 : (slin@8000)->(slin@192000)
slin:8000 To lpc10:8000 : (slin@8000)->(lpc10@8000)
slin:8000 To g729:8000 : No Translation Path
slin:8000 To speex:8000 : (slin@8000)->(speex@8000)
slin:8000 To speex:16000 : (slin@8000)->(slin@16000)->(speex@16000)
slin:8000 To speex:32000 : (slin@8000)->(slin@32000)->(speex@32000)
slin:8000 To ilbc:8000 : (slin@8000)->(ilbc@8000)
slin:8000 To g722:16000 : (slin@8000)->(g722@16000)
slin:8000 To siren7:16000 : No Translation Path
slin:8000 To siren14:32000 : No Translation Path
slin:8000 To g719:48000 : No Translation Path
slin:8000 To opus:48000 : (slin@8000)->(slin@48000)->(opus@48000)
slin:8000 To none:8000 : No Translation Path
slin:8000 To silk:8000 : No Translation Path
slin:8000 To silk:12000 : No Translation Path
slin:8000 To silk:16000 : No Translation Path
slin:8000 To silk:24000 : No Translation Path
module show like opus
Module Description Use Count Status Support Level
codec_opus.so OPUS Coder/Decoder 0 Running extended
format_ogg_opus.so OGG/Opus audio 0 Running core
res_format_attr_opus.so Opus Format Attribute Module 1 Running core
If you’re looking for a conversational AI solution based on Asterisk and you’re running into challenges with the AudioSocket module, you might want to take a look at the AgentVoiceResponse project:
We’ve built an open framework around Asterisk + AudioSocket that already handles ASR, LLM, and TTS integration. I’d also recommend joining our Discord community, where many members share their setups and might have already solved the same issue you’re experiencing.
I’m working with AgentVoiceResponse together with Asterisk, and I have to say—it’s an impressive combo! The integration feels seamless, and it really unlocks some exciting voice-driven possibilities.
That said, I did run into an issue that I’d like to share:
When I use this dial command:
same => n,Dial(AudioSocket/IP_AVR_CORE:PORT_AVR_CORE/${UUID})
the expected transcoding from Opus → slin16 doesn’t seem to happen.
However, when I use:
same => n,AudioSocket(${UUID},IP_AVR_CORE:PORT_AVR_CORE)
(it looks identical, but this is where I noticed the behavior difference), the handling changes.
So, I finally used
exten => 5001,1,Answer()
same => n,Ringing()
same => n,Wait(1)
same => n,Set(UUID=${SHELL(uuidgen | tr -d '\n')})
same => n,AudioSocket(${UUID},127.0.0.1:5001)
same => n,Hangup()
Asterisk + AVR is proving to be such a powerful combination overall.
Hi @me-nageshkumar thanks for sharing your feedback. I’m glad to hear you’re finding the Asterisk + AVR combo powerful!
Regarding your issue:
I think the difference comes from how Dial() and AudioSocket() handle media. With Dial(AudioSocket/…) Asterisk expects a channel driver–like behavior, while AudioSocket() acts more like an application that attaches audio directly.
If you want, feel free to open a thread on the Discord community with your dialplan snippet, so we can dive into your exact case.