Disable transcoding


I’ve switched to Asterisk 18 due to " Advanced Codec Negotiation" feature.
But still can’t get how to disable transcoding at all.
I have Asterisk 18.0.5 with serveral endpoints. For ex, A is configured with
allow = !all, opus, alaw, ulaw
and B with
alaw = !all, alaw, ulaw
Both of them configured with

 codec_prefs_incoming_answer        : prefer:configured, operation:intersect, keep:all, transcode:prevent
 codec_prefs_incoming_offer         : prefer:configured, operation:intersect, keep:all, transcode:prevent
 codec_prefs_outgoing_answer        : prefer:configured, operation:intersect, keep:all, transcode:prevent
 codec_prefs_outgoing_offer         : prefer:configured, operation:intersect, keep:all, transcode:prevent

When I’m calling from endpoint A to B, I’m still getting A is talking to Asterisk with OPUS, but with B Asterisk it talking with alaw. So, Asterisk doing transcoding.

Dialplan is quite simple, just

SDP of INVITE of endpoint A is

a=rtpmap:96 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 telephone-event/48000
a=rtpmap:101 telephone-event/8000
a=fmtp:96 useinbandfec=1

200 OK SDP from endpoint B is

m=audio 22440 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

Is there any way to disable transcoding on Asterisk at all? And best if Asterisk will look on codecs present in 200 OK answer from remote side and align own 200 OK with it. So-called late negotiation.


Its still being worked on, specifically conveying the answer from endpoint B to endpoint A.

Seems, I don’t have the other option than to wait and to read the changelogs.

You have an error in the B configuration shown. Should be “allow =”.
And “opus” should be included shouldn’t it?

Sorry, was a typo in topic post.
Idea is on B opus is NOT included, so, A and B should connect on alaw or ulaw. And Asterisk is doing transcoding here despite the options.

I got that problem, but in a reverse way.

I removed codec_alaw at menuselect and when our provider invited us from a specific peer requesting alaw codec, my server answered that with failure once we didn’t have codec_alaw to translate alaw to ulaw (our only codec enabled).

To solve that, i’ve enabled codec_alaw to let translate available even if that isn’t enabled at internal peer.

With that explained, if you don’t wana Opus translation, just remove that codec and be sure your peers will negotiate only same enabled codecs for both sides.