<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/3244/">https://reviewboard.asterisk.org/r/3244/</a>
     </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
 <tr>
  <td>
   <h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers, Joshua Colp and Mark Michelson.</div>
<div>By Matt Jordan.</div>


<p style="color: grey;"><i>Updated Feb. 27, 2014, 6:30 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The packetization test suite test that verifies 'use_ptime' now passes. Tests that cover 'use_ptime' being set to False continue to pass.

These tests will be put up for a review when more of them are done.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/12/res/res_pjsip_sdp_rtp.c <span style="color: grey">(408501)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3244/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>