[Home]

Summary:ASTERISK-29281: Pass-through Media Formats are added to SDP Offer.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2021-02-05 09:44:42.000-0600Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Channels/chan_pjsip Channels/chan_sip/CodecHandling
Versions:13.38.1 16.16.0 18.2.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) filter_pass_through_original.patch
( 1) filter_pass_through.patch
Description:Asterisk is a back-to-back user agent (B2BUA) not only on the signaling (SIP) but also on the media plane (SDP). Asterisk is able to transcode from one media format to another, for example, between the audio codecs G.722 and Opus-Codec. Besides transcodable formats, Asterisk allows to pass-through media transparently, called pass-through formats. For example, on default, Opus-Codec is a passed-through only because a transcoding module is missing. If you need transcoding, you install such a module later on.

Asterisk 1.8 offered only those media formats it could transcode or the callee understands. For example, the callee offered G.729. Asterisk then checks whether this format is allowed for the peer (as allowed in the \[peer\] section in the configuration file {{sip.conf}} for example). Then, Asterisk checks which other formats can transcode to/from G.729. Then, Asterisk adds those codecs to the offer, again if the \[peer\] section allows it. Because G.729 is not transcodable on default, Asterisk knows no translation path to G.729, and Asterisk offers just G.729 to the callee.

Similarly happens with video formats like H.264 and VP8. If the caller offers both, Asterisk offers both to the callee. If the caller knows just one, only that is offered by Asterisk.

Asterisk 11 (actually Asterisk 10) saw a media re-architecture. Asterisk 13 saw another re-architecture. The former bit-fields of on/off got changed into an object-like bag/list/set coding paradigm. The current call-graph for chan_sip:sip_call
⤷ ast_rtp_instance_available_formats
 ⤷ ast_translate_available_formats
   ⤷ check_translation_path

Long story short, this broke in the re-architecture. In Asterisk 1.8, the code went through all audio+video formats and filtered pass-through formats not offered as the caller's primary one. As of today, Asterisk goes through all transcoding formats – and tries to find pass-through formats. Of course, it does not find any. Even if it would find one, the current code does not work: {{ast_format_cap_remove(.)}} needs a reference not to a similar format, not to the exact same format, but the object, the same memory pointer. And {{check_translation_path(.)}} creates unique own format objects.

Long, long story short, the code broke with the media re-architectures. The attached patch fixes that. It does not go through all known formats either. But it goes through all possible formats, the formats in the result = jointcaps. Because of that, the reference works again as well.

While investigating the issue, I realized that Asterisk always appends the \[peer\] section formats later in {{chan_sip:add_sdp(.)}} again. For no apparent reason. This was the cause of ASTERISK-29258 and ASTERISK-24543 actually. There, I only fixed the reported issue (which I faced as well) that the original caller got wrong list of format capabilities. Although I fixed that, the actual fix is much easier: Do not append that list of codecs again and again. No reason. Consequently, two patches are attached. One for the current, original Asterisk 13.38.1. One for an Asterisk 13.38.1 patch with the fix for ASTERISK-29258.
Comments:By: Asterisk Team (asteriskteam) 2021-02-05 09:44:43.968-0600

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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Alexander Traud (traud) 2021-02-05 09:47:00.652-0600

Those two patches do not fix the alternative, new channel driver chan_pjsip. I do not support that. Those are about chan_sip only.