<div dir="ltr"><div>Over the past week we've noticed that, when bridging a local channel created with ARI, audio processing uses excessive amounts of CPU time. After some digging, we determined the cause, have some recommendations, and have a patch up for review.</div><div><br></div><div>The cause:</div><div><br></div><div>When you create a local channel via ARI and don't specify an "originator" channel, there's no information available to limit the codecs (actually formats) that the local channel can use. As a result, we add ALL audio formats to the channel's capability list. When it comes time to make the local channel compatible with another channel, like adding it to a bridge, the make-compatible code chooses the best format available to preserve quality. Since all audio formats were in the local channel's capability list this results in SLIN @ 192KHz being used. While this is best for preserving quality, it's the worst for performance and overkill for most applications.</div><div><br></div><div>Recommendations:</div><div><br></div><div>If you need a local channel, create it after a remote channel like SIP or PJSIP and specify the remote channel as the local channel's originator. When this happens, the local channel's capability list will be limited to the remote channel's capability list. If you have 2 local channels, you'll probably need the patch...</div><div><br></div><div>Patch:</div><div><br></div><div>There's a patch [1] up for review that adds a new parameter 'formats' to the ARI channels object. With it you can specify a comma-separated list of the formats that this channel can use if an originator isn't available. For instance, if you know that your environment needs only ulaw, you can specify 'formats: "ulaw"' in the JSON for '/ari/channels'. This prevents the addition of all audio formats to the capability list.</div><div><br></div><div>Codec vs Format:</div><div><br></div><div>Sometimes we use the terms interchangeably but a format is basically codec plus sample rate. For instance, the signed linear 'slin' codec could use many sample rates from the default of 8KHz up to 192KHz. The format is specific though: slin16 is signed linear at 16KHz. With this patch, the CLI command 'core show codecs' will show the default formats associated with each codec.</div><div><br></div><div>[1] <a href="https://gerrit.asterisk.org/2917">https://gerrit.asterisk.org/2917</a><br></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-size:12.8px">George Joseph</span><br style="font-size:12.8px"><span style="font-size:12.8px">Digium, Inc. | Software Developer</span><span style="font-size:12.8px"><br>445 Jan Davis Drive NW - Huntsville, AL 35806 - US<br></span><span style="font-size:12.8px">Check us out at: </span><a href="http://www.digium.com/" rel="noreferrer" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">www.digium.com</a><span style="font-size:12.8px"> & </span><a href="http://www.asterisk.org/" rel="noreferrer" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">www.asterisk.org</a><br><div><br></div></div></div>
</div>