res_pjsip_sdp_rtp: Apply packetization rules on inbound SDP handling
authorMatthew Jordan <mjordan@digium.com>
Thu, 27 Feb 2014 12:29:56 +0000 (12:29 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 27 Feb 2014 12:29:56 +0000 (12:29 +0000)
commit83b2063ea5dff86348d63980a8016fd5090b126d
treea6ec6a679784ba4c4150b4d8670f80dd6879d6d8
parentf8dd49ab4d1431fc9d1993882ddc256fd24a40fa
res_pjsip_sdp_rtp: Apply packetization rules on inbound SDP handling

The setting 'use_ptime' is supposed to tell Asterisk to honour the ptime
attribute in an offer, preferring it to whatever packetization
preferences have been set internally. Currently, however, something
rather quirky will happen:

(1) The SDP answer will be constructed in create_outgoing_sdp_stream.
    This will use the preferences from the endpoint, such that the 200 OK
    response will add the packetization preferences from the endpoint, and
    not what was offered.
(2) When the 200 response is issued, apply_negotiated_sdp_stream is called.
    This will call apply_packetization, which will use the ptime attribute
    from the offer internally.

We end up telling the offerer to use the internal ptime attribute, but we end
up using the offered ptime attribute. Hilarity ensues.

This patch modifies the behaviour by calling apply_packetization from
negotiate_incoming_sdp_stream, which is called prior to
create_outgoing_sdp_stream. This causes the format preferences on the
session's media object to be set to the inbound ptime value (if 'use_ptime'
is enabled), such that the construction of the answer gets the right value
immediately.

Review: https://reviewboard.asterisk.org/r/3244/
........

Merged revisions 408999 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
res/res_pjsip_sdp_rtp.c