Can't record with opus codec

Hi, I have successfully configured my Asterisk 16.1.1 server to make internal SIP calls between several users.

I have just a little dialplan like that :

exten => _6XXX,1,Dial(SIP/${EXTEN},20,wWxX)
same => n,Hangup()

In feature.conf I have:

[general]
courtesytone = beep

[featuremap]
automon => 1
automixmon => 2

So a caller can record its call with DTMF command.

This is working very well with codecs like ulaw. However when I change it for opus I can make nice calls but I can’t record anymore; I get this error:

[Mar  5 09:42:58] WARNING[9977][C-00000061]: translate.c:485 ast_translator_build_path: No translator path: (starting codec is not valid)
[Mar  5 09:42:58] WARNING[9977][C-00000061]: file.c:246 ast_writestream: Unable to translate to format wav, source format opus
[Mar  5 09:42:58] WARNING[9977][C-00000061]: channel.c:4075 __ast_read: Failed to write data to channel monitor read stream

So I tried to change my record extension/format like that but it changed nothing, it still does not work:

exten => _6XXX,1,Set(TOUCH_MONITOR_FORMAT=opus)
 same => n,Dial(SIP/${EXTEN},20,wWxX)
 same => n,Hangup()

With the command “core show file formats” I don’t see any opus format. Do I have to install anything more or Asterisk does not support opus records ? So then what would be the best codec alternative ?

Thank you by advance for your interest.

You need to select and install the “codec_opus” module in “make menuselect” if you wish to transcode Opus.

Hi jcolp, thank you for your reply.

So I have done that before compiling:

make menuselect.makeopts
menuselect/menuselect --enable codec_opus menuselect.makeopts
cat menuselect.makeopts | grep opus
> MENUSELECT_BUILD_DEPS=bridge_holding app_cdr func_periodic_hook app_confbridge res_monitor res_speech res_agi res_stasis res_adsi res_smdi res_odbc res_crypto res_xmpp res_pjsip res_pjsip_session res_rtp_multicast res_http_websocket res_format_attr_opus app_chanspy func_cut func_groupcount func_uri res_ael_share res_ari res_ari_model res_stasis_recording res_stasis_playback res_stasis_answer res_stasis_snoop res_stasis_device_state res_curl res_odbc_transaction res_pjproject res_sorcery_config res_sorcery_memory res_sorcery_astdb res_statsd res_pjsip_pubsub res_pjsip_outbound_publish res_calendar res_fax res_hep res_phoneprov DONT_OPTIMIZE G711_NEW_ALGORITHM 

So there is well “res_format_attr_opus”. Then I have compiled and make install and so on.
When compiling I got :

[CC] res_format_attr_opus.c -> res_format_attr_opus.o
[LD] res_format_attr_opus.o -> res_format_attr_opus.so

But I also got :

[pjproject]  Configuring with --prefix=/opt/pjproject --disable-speex-codec --disable-speex-aec --disable-bcg729 --disable-gsm-codec --disable-ilbc-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-opencore-amr --disable-silk --disable-opus --disable-video --disable-v4l2 --disable-sound --disable-ext-sound --disable-sdl --disable-libyuv --disable-ffmpeg --disable-openh264 --disable-ipp --disable-libwebrtc --without-external-pa --without-external-srtp --disable-resample --disable-g711-codec --enable-epoll

Note the –disable-opus. Strange no ?
I still don’t see opus after the “core show file formats” command, and I still have the same error while trying to record.

What am I doing wrong ?

Thank you.

Did the module download and install? Do you see it in “module show”? If you manually go into “make menuselect” is it selected? You may not have the required dependency to download and install it (it’s a binary module). That’s why I mentioned going into menuselect instead, to confirm.

As for PJSIP - we don’t use their media stack and disable vast parts of it so it’s not strange at all.

In “module show” I can see “res_format_attr_opus.so” but no “codec_opus”.
And yes in make menuselect it is selected.
Did I miss the “install_prereq” step ?
Shall I install opus from sources http://opus-codec.org/downloads/ ?

Shall I install opus like that : http://asterisktutorials.blogspot.com/2017/08/how-to-install-and-use-opus-codec-in.html ?

The codec_opus module is under “Codec Translators” at the bottom under “External”. You can install it manually if you want.

Yes I found it and selected it. But it didn’t installed it. :confused:

What does MENUSELECT_CODECS mean in menuselect.makeopts file ?
When codec_opus is selected with “make menuselect” it does not appear in this list:

MENUSELECT_CODECS=codec_dahdi codec_silk codec_siren7 codec_siren14 codec_g729a 

But when it is not selected:

MENUSELECT_CODECS=codec_dahdi codec_opus codec_silk codec_siren7 codec_siren14 codec_g729a

I would have expect for the opposite…

I don’t like the idea to install something manually when there is already a system to do it automatically.

Thank you for your time.

The menuselect.makeopts file contains things that should not be installed.

When “make install” is executed it should download and install the module. What happens? What’s the output?

Yes It downloads opus:

codec_opus: Downloading http://downloads.digium.com/pub/telephony/codec_opus/asterisk-16.0/x86-32/codec_opus-16.0_1.3.0-x86_32.tar.gz to /tmp/tmp.cPaub3ZkHA/codec_opus-16.0_1.3.0-x86_32.tar.gz
codec_opus: Installing.
codec_opus: Installed.

And the module is in /usr/lib/asterisk/modules? Does it appear in “module show”? Is there an error at startup if not? Does a translation path appear in “core show translation”?

There is well the /usr/lib/asterisk/modules/codec_opus.so file.
But no codec_opus with “module show”.

You’re right, there are errors:

[Mar  5 14:42:06] WARNING[19390]: loader.c:2234 load_modules: Some non-required modules failed to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: Error loading module 'codec_opus.so': /usr/lib/asterisk/modules/codec_opus.so: cannot open shared object file: No such file or directory
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: Error loading module 'format_ogg_opus.so': /usr/lib/asterisk/modules/format_ogg_opus.so: cannot open shared object file: No such file or directory
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: res_pjsip_transport_websocket declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cel_radius declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cel_tds declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cdr_pgsql declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cdr_sqlite3_custom declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cdr_radius declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cel_sqlite3_custom declined to load.
[Mar  5 14:42:06] ERROR[19390]: loader.c:2249 load_modules: cdr_tds declined to load.

There is also the /usr/lib/asterisk/modules/format_ogg_opus.so file.

What platform are you on? Linux on 32-bit?

Yes on a Raspberry Pi 3B+ 32bits

The codec_opus module provided by Digium is not currently available for ARM.

1 Like

Damn ! Sorry for that.
Thank you so much for your time.

Can I install codec_opus from sources ?
Or where is the list of supported architectures ?
Thank you.

The binary module provided by Digium is available for Linux x86 on 32-bit and 64-bit only. I can’t comment on any other implementation.

There is a maintained open-source variant…