# Disable transcoding

**URL:** <https://community.asterisk.org/t/disable-transcoding/89267>\
**Category:** Asterisk Endpoints\
**Created:** [July 16, 2021, 12:59pm UTC](https://community.asterisk.org/t/disable-transcoding/89267 "2021-07-16T12:59:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![IhorOlkhovskyi](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ihorolkhovskyi/32/4993_2.png) [@IhorOlkhovskyi](https://community.asterisk.org/u/IhorOlkhovskyi)\
**Post date:** [July 16, 2021, 12:59pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/1 "2021-07-16T12:59:23Z")

</div>

Hello!

I’ve switched to Asterisk 18 due to " [Advanced Codec Negotiation](https://wiki.asterisk.org/wiki/display/AST/PJSIP+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

```auto
 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  
`Dial(PJSIP/${EXTEN}@{DOMAIN},60)`

SDP of INVITE of endpoint **A** is

```auto
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

```auto
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.

Thanks!

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [July 16, 2021, 1:05pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/2 "2021-07-16T13:05:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IhorOlkhovskyi](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ihorolkhovskyi/32/4993_2.png) [@IhorOlkhovskyi](https://community.asterisk.org/u/IhorOlkhovskyi)\
**Post date:** [July 16, 2021, 1:09pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/3 "2021-07-16T13:09:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cable](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@cable](https://community.asterisk.org/u/cable)\
**Post date:** [July 16, 2021, 5:04pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/4 "2021-07-16T17:04:28Z")

</div>

> [@IhorOlkhovskyi](#):
>
> and **B** with  
> `alaw = !all, alaw, ulaw`

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

---

<div class="post-metadata">

**Author:** ![IhorOlkhovskyi](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ihorolkhovskyi/32/4993_2.png) [@IhorOlkhovskyi](https://community.asterisk.org/u/IhorOlkhovskyi)\
**Post date:** [July 20, 2021, 2:16pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/5 "2021-07-20T14:16:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fsilvestre](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/fsilvestre/32/4271_2.png) [@fsilvestre](https://community.asterisk.org/u/fsilvestre)\
**Post date:** [July 24, 2021, 12:22am UTC](https://community.asterisk.org/t/disable-transcoding/89267/6 "2021-07-24T00:22:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![IhorOlkhovskyi](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ihorolkhovskyi/32/4993_2.png) [@IhorOlkhovskyi](https://community.asterisk.org/u/IhorOlkhovskyi)\
**Post date:** [July 24, 2021, 7:59pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/7 "2021-07-24T19:59:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![khamlichi.khalil](https://avatars.discourse-cdn.com/v4/letter/k/e274bd/32.png) [@khamlichi.khalil](https://community.asterisk.org/u/khamlichi.khalil)\
**Post date:** [July 24, 2021, 9:13pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/8 "2021-07-24T21:13:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [August 23, 2021, 9:14pm UTC](https://community.asterisk.org/t/disable-transcoding/89267/9 "2021-08-23T21:14:50Z")

</div>

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