[asterisk-bugs] [JIRA] (ASTERISK-28785) Unnecessary transcoding for Originate (local channels)

Asterisk Team (JIRA) noreply at issues.asterisk.org
Fri Mar 20 06:21:25 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=250001#comment-250001 ] 

Asterisk Team commented on ASTERISK-28785:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

> Unnecessary transcoding for Originate (local channels)
> ------------------------------------------------------
>
>                 Key: ASTERISK-28785
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28785
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_local
>    Affects Versions: 16.8.0
>            Reporter: lvl
>
> When using (Asterisk Manager) Originate and {{Channel}} is a local channel, Asterisk will sometimes perform unnecessary transcoding, in particular back and forth to slin.
> It's hard to describe the bug here thoroughly, because the exact behavior greatly varies between Asterisk versions, Asterisk configuration (particularly allow/disallowed codecs), client, and client configuration (particuarly supported codecs).
> I'll focus on a couple of examples here to illustrate. Output is from Asterisk 16.8.0 unless otherwise noted.
> Asterisk configuration that I investigated but did **not** make a difference:
> * genericplc
> * transcode_via_sln
> * dtmf_mode
> In some scenario's, Asterisk's behavior is random with about 50% of the calls performing unnecessary transcoding (and thus simple bridging), and the other 50% being fine (and thus native bridging).
> I identified this commit which - I'm not sure why - changed one of the scenario's to "fail" 100% of the time instead of 50% of the time: https://github.com/asterisk/asterisk/commit/a46fcaca7bcb019a1a2b29d3c9a528da637840d7
> So, to reproduce, f.e. let's take a very basic sipp client that'll accept incoming calls and only talks g722. Also take a very basic dialplan to process originates:
> {code}
>     originate-from => {
>         Dial(PJSIP/callee,10,L(5500));
>     }
>     
>     originate-to => {
>         Dial(PJSIP/callee);
>     }
> {code}
> Consider the following configuration for the callee endpoint:
> {code}
> disallow=all
> allow=opus
> allow=g722
> allow=alaw
> allow=ulaw
> allow=gsm
> {code}
> Now run an originate:
> {code}
>     cdict['Channel'] = 'Local/originate-from at default'
>     cdict['Context'] = 'default'
>     cdict['Exten'] = 'originate-to'
>     cdict['Priority'] = '1'
> {code}
> After local channel optimization is done, Asterisk will end up with two channels, both performing a useless transcode to slin:
> {code}
> [('WriteTranscode', 'Yes', '(slin at 16000)->(g722 at 16000)'), ('ReadTranscode', 'Yes', '(g722 at 16000)->(slin at 16000)')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'slin16'), ('ReadFormat', 'slin16'), ('Formats', '(g722|slin)')]
> [('WriteTranscode', 'Yes', '(slin at 16000)->(g722 at 16000)'), ('ReadTranscode', 'Yes', '(g722 at 16000)->(slin at 16000)')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'slin16'), ('ReadFormat', 'slin16'), ('Formats', '(g722|slin)')]
> {code}
> Note that bypassing the local channel...
> {code}
>     cdict['Channel'] = 'PJSIP/callee';
> {code}
> .. means everything is fine:
> {code}
> [('WriteTranscode', 'No', ''), ('ReadTranscode', 'No', '')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'g722'), ('ReadFormat', 'g722'), ('Formats', '(g722)')]
> [('WriteTranscode', 'No', ''), ('ReadTranscode', 'No', '')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'g722'), ('ReadFormat', 'g722'), ('Formats', '(g722)')]
> {code}
> Back to the local channel. Playing with the {{codecs}} option for Originate will cause greatly varying results. For example, bringing it in line with the PJSIP codec list..
> {code}
>     cdict['Codecs'] = 'opus,g722,alaw,ulaw,gsm'
> {code}
> .. apparently makes Asterisk factor in opus, even though none of the two resulting PJSIP channels can use opus:
> {code}
> [('WriteTranscode', 'Yes', '(slin at 48000)->(slin at 16000)->(g722 at 16000)'), ('ReadTranscode', 'Yes', '(g722 at 16000)->(slin at 16000)->(slin at 48000)')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'slin48'), ('ReadFormat', 'slin48'), ('Formats', '(g722)')]
> [('WriteTranscode', 'Yes', '(slin at 48000)->(slin at 16000)->(g722 at 16000)'), ('ReadTranscode', 'Yes', '(g722 at 16000)->(slin at 16000)->(slin at 48000)')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'slin48'), ('ReadFormat', 'slin48'), ('Formats', '(g722|opus)')]
> {code}
> While removing opus..
> {code}
>     cdict['Codecs'] = 'g722,alaw,ulaw,gsm'
> {code}
> .. magically fixes everything:
> {code}
> [('WriteTranscode', 'No', ''), ('ReadTranscode', 'No', '')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'g722'), ('ReadFormat', 'g722'), ('Formats', '(g722)')]
> [('WriteTranscode', 'No', ''), ('ReadTranscode', 'No', '')]
> [('NativeFormats', '(g722)'), ('WriteFormat', 'g722'), ('ReadFormat', 'g722'), ('Formats', '(g722)')]
> {code}
> There's many more variations of the problem I could show, but it looks like the essence of the problem is always the same: local channels instantly "lock down" their preferred codec, without considering the channel they are bridged to. Sometimes this is corrected after the optimization, depending on seemingly unrelated (timing) factors, but most often it isn't.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list