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.

Thanks for suggestion, but it’s really what I want to avoid.

Some of my endpoints are supporting OPUS and alaw, some - only alaw. So, I want opus - supported endpoints connect via OPUS and if a case - fallback to alaw.

I have seen servers transcoding 2 times, on the side of the calling parties and then for the recording side with little impact on the server, I believe with modern CPUs, transcoding or not transcoding does not really cost much, unless you are really maxing your hardware.
you could create a script that gets capabilities of each endpoint for example :
pjsip show endpoint will give this line
allow : (g729|alaw|ulaw)

then on your side modify setting for that peer like for example allowing only g729

this script can run at intervals in case users change their settings.

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