<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/2880/">https://reviewboard.asterisk.org/r/2880/</a>
     </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.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By Matt Jordan.</div>


<p style="color: grey;"><i>Updated Oct. 15, 2013, 11:18 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Addressed Corey's findings.</pre>
  </td>
 </tr>
</table>







<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;">During shutdown, Asterisk attempts to flush out any active CDRs by calling ast_cdr_engine_term. This is to try to get as much billing data recorded as possible before Asterisk shuts down/restarts and that data is lost. Unfortunately, module unloading occurs prior to calling ast_cdr_engine_term, and the CDR backend modules have already unregistered themselves. Thus, while the records are successfully flushed from the system, there are no registered backends left to handle the data.

This is technically a problem in prior versions of Asterisk as well; however, it is far less likely to occur in Asterisk 1.8/11 due to CDRs being build on an asynchronous message bus in Asterisk 12.

This patch modified ast_cdr_unregister such that if active_cdrs_by_channel has an entry, the unregistration fails. This would have the side effect of preventing CDR module unloading via the CLI on a busy system - but if you're doing that, you're already losing billing data, so that seems like a very bad idea anyway.</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 various dial tests that have a tendency to end very quickly while CDR data is in flight now pass consistently.</pre>
  </td>
 </tr>
</table>


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

 <li>/branches/12/addons/cdr_mysql.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_adaptive_odbc.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_csv.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_custom.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_manager.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_odbc.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_pgsql.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_radius.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_sqlite.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_sqlite3_custom.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_syslog.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/cdr/cdr_tds.c <span style="color: grey">(400957)</span></li>

 <li>/branches/12/include/asterisk/cdr.h <span style="color: grey">(400957)</span></li>

 <li>/branches/12/main/cdr.c <span style="color: grey">(400957)</span></li>

</ul>

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







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




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