[asterisk-bugs] [JIRA] (ASTERISK-29281) Pass-through Media Formats are added to SDP Offer.

Alexander Traud (JIRA) noreply at issues.asterisk.org
Fri Feb 5 09:44:59 CST 2021


Alexander Traud created ASTERISK-29281:
------------------------------------------

             Summary: Pass-through Media Formats are added to SDP Offer.
                 Key: ASTERISK-29281
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29281
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_pjsip, Channels/chan_sip/CodecHandling
    Affects Versions: 18.2.0, 16.16.0, 13.38.1
            Reporter: Alexander Traud


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.



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



More information about the asterisk-bugs mailing list