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

Joshua C. Colp (JIRA) noreply at issues.asterisk.org
Thu Apr 2 04:45:25 CDT 2020


     [ https://issues.asterisk.org/jira/browse/ASTERISK-28785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joshua C. Colp closed ASTERISK-28785.
-------------------------------------

    Resolution: Duplicate

> chan_local: 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
>            Severity: Minor
>
> 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