Fix For System Recordings when Opus is Enabled

I saw some posts related to this issue in the past, but none seemed to have a clean resolution. I’m not sure how clean this is, but since Asterisk does not allow writing opus streams…

[2021-11-03 12:08:25] ERROR[13212][C-000001ad]: format_ogg_opus.c:95 ogg_opus_rewrite: Cannot write OGG/Opus streams. Sorry :(

I created this for extensions_custom.conf. This forces the codec to ulaw for the system recording feature codes. I’m open to suggestions for improving it, and would love to see something like this added into the project itself, so we don’t need to do any customization when using opus as the preferred codec for everything else.

[from-internal-custom]
exten => _*29.,1,GoSub(fix-opus-recordings,s,1)
exten => _*29.,n,Goto(app-recordings,${EXTEN},1)

[fix-opus-recordings]
exten => s,1,Answer()
exten => s,n,Set(PJSIP_MEDIA_OFFER(audio)=!all,ulaw)
exten => s,n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
exten => s,n,Return()
2 Likes

Thanks for the tip. It worked well for me. I also would like to see something like this added to the project.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.