Avoid transcoding on ARI CallOriginate

We’ve implemented a Stasis app with ARI that in one of the use cases it sends messages to a destination by making playbacks on that channel.
In a virtual machine with 1 CPU (it’s not very different in a 4 CPUs configuration) it can’t do more than 5 simultaneous calls without pulling the CPU to 100%, obviuously causing degradation on the audio quality.

The peer used to make the calls is configured to use only the “a-law” codec (disallow=all allow=alaw), and the audio file is encoded with “a-law”. In the channels list I can see that the channel is using “a-law”, for the SIP channel:

host*CLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
IP1 3512ABCD 429796c350f9c14 (alaw) No Tx: ACK Trunk-T1

But there are 3 channels:

host*CLI> core show channels
Channel Location State Application(Data)
Local/100@CTX-0000 100@CTXT:4 Up Dial(SIP/Trunk-T1/3512ABCD
Local/100@CTX-0000 100@CTXT:1 Up Stasis(app_name)
SIP/Trunk-TB1-00 (None) Up AppDial((Outgoing Line))
3 active channels
1 active call

This is because I originate the call in ARI to “Local/100@CTXT”, and in context CTXT there is this dial:

same => n,Dial(SIP/Trunk-T1/${callednum},${ctimeout})

The most obvious reason for this behaviour would be that asterisk would be making transcoding, which is the case, as we can see in the transcoding information on this channels:

For Local channel 1:

host*CLI> core show channel Local/100@CTXT-00000000;1
– General –
Type: Local
(…)
NativeFormats: (slin)
WriteFormat: slin
ReadFormat: slin
WriteTranscode: Yes (slin@8000)->(slin@192000)
ReadTranscode: No

For Local channel 2:

hostCLI> core show channel Local/100@G9_TB-00000000;2
– General –
(…)
NativeFormats: (slin)
WriteFormat: slin
ReadFormat: slin
WriteTranscode: No
ReadTranscode: No

For the SIP channel:

host*CLI> core show channel SIP/Trunk-T1-00000000
– General –
Type: SIP
NativeFormats: (alaw)
WriteFormat: slin192
ReadFormat: slin192
WriteTranscode: Yes (slin@192000)->(slin@8000)->(alaw@8000)
ReadTranscode: Yes (alaw@8000)->(slin@8000)->(slin@192000)

Is it possible to configure the Local channel to use alaw, as I did in the trunk T1?
As I also need to create bridges between the channels, I can’t originate a channel to SIP, as the bridges don’t work on this case.

Asterisk version is 13.19.2 (upgraded from 13.4.0), running on CentOS 6.

You can pass formats when originating in ARI, to better control what formats are in use and reduce the transcoding cost. I’d suggest trying that.

1 Like

That worked. Thank you.