With asterisk, is it possible to record call with opus codec using mixmonitor


I have a device Mi router 3g running openwrt 19.07.1 and Asterisk 16.3.
I'm quite new to openwrt and asterisk.

I can record to g729 with : same => n,MixMonitor(/tmp/something.g729,ab)
I chose g729, for disk space consideration. But I would like to try with opus.

I tried to install opus with : opkg install asterisk16-codec-opus asterisk16-res-format-attr-opus
I think opus is correctly loaded.
I noticed that 'core show file formats' doesn't reference opus

I tried to record an opus file with same => n,MixMonitor(/tmp/something.opus,ab)
But I got :

[Jun 30 14:04:51] WARNING[22182][C-00000001]: file.c:1484 ast_writefile: No such format 'opus'
[Jun 30 14:04:51] ERROR[22182][C-00000001]: app_mixmonitor.c:626 mixmonitor_save_prep: Cannot open /tmp/something.opus

Is it possible to record natively in an opus file with asterisk and mixmonitor ?
Do you have any clue about what I'm missing ?
I have looked with google but I didn't find the answer. I'm even sure that record to opus is possible/allowed.
Is it an issue only on my setup ?
Is it an openwrt issue, an upstream issue or just not a feature ?


Some commands :

CLI> core show translation
         Translation times between formats (in microseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

           ulaw  alaw slin8 slin12 slin16 slin24 slin32 slin44 slin48 slin96 slin192  g729  g722 testlaw  opus

*CLI> module show like opus
Module                         Description                              Use Count  Status      Support Level
codec_opus_open_source.so      Opus Coder/Decoder                       0          Running           unknown
res_format_attr_opus.so        Opus Format Attribute Module             1          Running              core
2 modules loaded

*CLI> core show file formats
Format     Name       Extensions          
------     ----       ----------          
slin16     wav16      wav16               
slin       wav        wav                 
h264       h264       h264                
g722       g722       g722                
ulaw       au         au                  
alaw       alaw       alaw|al|alw         
ulaw       pcm        pcm|ulaw|ul|mu|ulw  
g729       g729       g729                
8 file formats registered.

Hi there,

For asterisk we only provide opus codec support via asterisk-opus and format attribute support via asterisk itself. There is apparently experimental file support (for writing files) in a patch from asterisk-opus, but we don't use this. It would complicate things if I understand correctly. The codec support can be compiled out-of-tree, but for the file support you'd need to join asterisk and asterisk-opus sources.

If you want to record stuff in a wideband format maybe look into g722. It should provide better quality than G729/G711.

Kind regards,

One other thought, obviously you can't gain fidelity while recording. So if a call is G729 then recording it in G722 or Opus wouldn't make the recording sound better. In that case dumping the recording as G729 would make sense. Same goes for other codecs. Also if asterisk doesn't need to transcode between codecs while recording this will be less resource-intensive.

Thanks for the answer.
I hadn't find the information about experimental file support.
Now, I'm aware of the coming feature.
So, I will wait for the integration to give it a new try.
Currently, my calls are g711 (and rarely g729).
recording call in g729 is acceptable because the main purpose is debug.