[Home]

Summary:ASTERISK-27008: res_format_attr_h264: SDP parse fails if fmtp optional parameters have a space
Reporter:John Harris (jmharris)Labels:
Date Opened:2017-05-19 06:16:32Date Closed:2017-05-24 09:41:09
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_format_attr_h264
Versions:14.4.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:Discovered while diagnosing a failure of Grandstream GXV3275 video phones to negotiate 720P resolution when SIP call goes via Asterisk.
Also reported to Grandstream- https://forums.grandstream.com/forums/index.php?topic=35745

The initial phone invite contains:
a=fmtp:99 profile-level-id=42801F; packetization-mode=1

Which Asterisk then reinvites the target phone as:
a=fmtp:99 profile-level-id=42801F

So the target phone replies:
a=fmtp:99 profile-level-id=428014

So profile 42801F was requested (H264 level 3.1, 1280x720), but callee responded with profile 428014 (H264 level 2.0, 352x288). These phones require that Asterisk preserves the packetization-mode when it sends the invite.

Asterisk does actually try to parse the initial SDP contents (h264_parse_sdp_fmtp, res/res_format_attr_h264.c). This fails because it splits on semi-colon only, but the Grandstream firmware is also writing a space.

RFC6184 (https://tools.ietf.org/html/rfc6184#page-57) states that these parameters should be 'in the form of a semicolon-separated list of parameter=value pairs'. However the examples in the RFC do also include spaces.

As a workaround you can modify h264_parse_sdp_fmtp to split on semicolon and space:

while ((attrib = strsep(&attribs, "; "))) {

.. but clearly this will regress clients who do not use a space.
Comments:By: Asterisk Team (asteriskteam) 2017-05-19 06:16:33.763-0500

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].

By: Sean Bright (seanbright) 2017-05-23 09:48:35.983-0500

What space are you talking about? The one after the {{;}}?

{noformat}
a=fmtp:99 profile-level-id=42801F; packetization-mode=1
                                 ^-- this one?
{noformat}


By: John Harris (jmharris) 2017-05-23 10:02:50.978-0500

Hi Sean. Yes, I'm referring to the delimiters used for the 'optional parameters' in the fmtp part of the SDP payload.

By: Sean Bright (seanbright) 2017-05-23 10:11:27.477-0500

Proposed patch is [here|https://gerrit.asterisk.org/#/c/5689].

By: Friendly Automation (friendly-automation) 2017-05-24 09:41:10.630-0500

Change 5689 merged by Jenkins2:
res_format_attr_h26x: Trim blanks in fmtp attributes

[https://gerrit.asterisk.org/5689|https://gerrit.asterisk.org/5689]

By: Friendly Automation (friendly-automation) 2017-05-24 11:03:54.092-0500

Change 5691 merged by Jenkins2:
res_format_attr_h26x: Trim blanks in fmtp attributes

[https://gerrit.asterisk.org/5691|https://gerrit.asterisk.org/5691]

By: Friendly Automation (friendly-automation) 2017-05-24 13:04:49.377-0500

Change 5690 merged by Joshua Colp:
res_format_attr_h26x: Trim blanks in fmtp attributes

[https://gerrit.asterisk.org/5690|https://gerrit.asterisk.org/5690]