<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/2486/">https://reviewboard.asterisk.org/r/2486/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2486/diff/1/?file=37003#file37003line2964" style="color: black; font-weight: bold; text-decoration: underline;">team/group/bridge_construction/main/cdr.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">ASTERISK_FILE_VERSION(__FILE__, "$Revision$")</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2706</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">ast_strlen_zero</span><span class="p">(</span><span class="n">workspace</span><span class="p">)</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2707</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="o">&&</span> <span class="n">ast_str_append</span><span class="p">(</span><span class="n">buf</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"level %d: %s%c%s%c"</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">cdr_readonly_vars</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">delim</span><span class="p">,</span> <span class="n">workspace</span><span class="p">,</span> <span class="n">sep</span><span class="p">)</span> <span class="o"><</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2708</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="n">ast_log</span><span class="p">(</span><span class="n">LOG_ERROR</span><span class="p">,</span> <span class="s">"Data Buffer Size Exceeded!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2709</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="k">break</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2710</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2711</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="n">total</span><span class="o">++</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2712</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="p">}</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2713</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="p">}</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2714</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="p">}</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">No need for the else clause since there is a break in there anyway.</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2486/diff/1/?file=37012#file37012line6108" style="color: black; font-weight: bold; text-decoration: underline;">team/group/bridge_construction/main/pbx.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">6106</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,</pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">6065</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,</pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">pbx.c isn't really a big part of this review obviously, but I've marked a couple functions in here that were touched I think could benefit heavily from a little bit of cleaning. Maybe make an issue for them or something. Your call.</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2486/diff/1/?file=37012#file37012line10044" style="color: black; font-weight: bold; text-decoration: underline;">team/group/bridge_construction/main/pbx.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel, int early_media)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">10042</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel, int early_media)</pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">9944</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel, int early_media)</pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Mark for cleanup</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2486/diff/1/?file=37012#file37012line10243" style="color: black; font-weight: bold; text-decoration: underline;">team/group/bridge_construction/main/pbx.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static void *ast_pbx_run_app(void *data)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">10241</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)</pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">10126</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)</pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Mark for cleanup</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2486/diff/1/?file=37014#file37014line85" style="color: black; font-weight: bold; text-decoration: underline;">team/group/bridge_construction/main/test.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">struct ast_test {</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">83</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="k">enum</span> <span class="n">ast_test_result_state</span> <span class="n">state</span><span class="p">;</span> <span class="cm">/*!< current test state */</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">85</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="k">enum</span> <span class="n">ast_test_result_state</span> <span class="n">state</span><span class="p">;</span><span class="tb">        </span><span class="cm">/*!< current test state */</span></pre></td>
</tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">84</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">time</span><span class="p">;</span> <span class="cm">/*!< time in ms test took */</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">86</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">time</span><span class="p">;</span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="cm">/*!< time in ms test took */</span></pre></td>
</tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">85</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">ast_test_cb_t</span> <span class="o">*</span><span class="n">cb</span><span class="p">;</span> <span class="cm">/*!< test callback function */</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">87</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">ast_test_cb_t</span> <span class="o">*</span><span class="n">cb</span><span class="p">;</span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="cm">/*!< test callback function */</span></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">88</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">ast_test_init_cb_t</span> <span class="o">*</span><span class="n">init_cb</span><span class="p">;</span><span class="tb">        </span><span class="tb">        </span><span class="cm">/*!< test init function */</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">89</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="kt">ast_test_cleanup_cb_t</span> <span class="o">*</span><span class="n">cleanup_cb</span><span class="p">;</span><span class="tb">        </span><span class="cm">/*!< test cleanup function */</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">More tabs that should be spaces</pre>
</div>
<br />
<p>- jrose</p>
<br />
<p>On May 1st, 2013, 6:37 p.m. UTC, Matt Jordan wrote:</p>
<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 May 1, 2013, 6:37 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-21196">ASTERISK-21196</a>
</div>
<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;">Sorry for e-mail spam folks, but apparently Review Board chocked on the last posting. Hopefully this one takes.
This patch reworks CDRs for Asterisk 12. For more information on why and what the records should look like, please view the specification on the wiki: https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CDR+Specification
Since the Bridge API migration resulted in all CDR code in features.c no longer being applicable, and the model of masquerades during transfers now no longer occurs (mostly), the vast majority of complex CDR code sprinkled throughout Asterisk was either wrong, or would never be executed. Rather than piling the CDR code back into the Bridging API, this patch instead builds CDRs off of messages received over the Stasis-Core message bus. However, as a result, all direct manipulation of CDRs by channel drivers, applications, and the Asterisk core is now highly suspect and most likely null and void.
This patch rips most of the existing code out.
Messages received over Stasis-Core are first dispatched by top level message handlers. The handlers job is to (a) find the CDRs that are affected by the message, (b) dispatch the message to the CDRs, and (c) based on the statuses, determine if more CDRs are needed.
Each CDR has a virtual table that determines what effect the message has on it. Depending on the state of the CDR, the message may be dropped; invalid; or it may alter the state of the CDR. CDRs transition states when they need to, and the top level message handlers generally don't care what state the CDR is in.
CDRs exist in a chain. As a channel does stuff, additional CDRs may be appended to the chain, and there may be multiple active CDRs at any given moment in time.
As a result of all of this, ForkCDR, NoCDR, and ResetCDR have essentially been rewritten and simplified greatly. The need for ForkCDR is significantly less, as additional CDRs are created between all pairs of channels in multi-party and transfer situations.
A new CDR function, CDR_PROP, has been added that lets the dialplan override who is the Party A when two channels enter into a bridge together. This function also lets you disable/re-enable CDRs on a channel, which precludes the need for NoCDR and one of ResetCDR's options.
Finally, a set of unit tests have been written that cover the existing functionality.
This patch is not complete - there is still some additional work to do and testing to perform. The following needs to be covered under subsequent reviews:
* Linkedid propagation. As CEL will need this as well, this will most likely become a core concept (if possible)
* Park. A unit test exists for this, however, the holding bridge is not yet handled properly. This is rather trivial, as most of the Bridge state logic simply needs to be avoided if a holding bridge is entered.
* Call Pickup. We need the Stasis Message for this before this can be completed.
* Attended transfers into an application. We need the Stasis Message for this too.
* Quite a few BUGBUG comments in app_queue (which needs the Dial messages - see ASTERISK-21551) and the media channel (see ASTERISK-21713)
Hopefully, this patch is far enough along that the approach can be verified and major bugs can be commented on. Ideally, this would go into bridge_construction so that the Test Suite running against it can be updated.
A few open questions:
* What do we want to do with peeraccount? In general, this property on the channel needs to be set by the bridging API, but much like the BRIDGEPEER channel variable, has issues in reasonably complex scenarios. Right now, the peeraccount is passed through the CDRs by virtue of the CDR engine knowing who the channel is bridged with, but inspecting this value through a function becomes problematic since we can't return a single value in multi-party bridges. CEL will also need an answer to this question. (There is also some bridging logic that applies a channel's accountcode to who its bridged with if the other channel doesn't have an accountcode; this does need to be performed by the bridging layer)
* There is certainly room for debate with where the userfield, accountcode, and amaflags should live. Currently that is CDR, channel, channel. The channel userfield is generally unused. These could all be combined; however, that forces some parity between CEL userfield and CDR userfield that didn't used to exist.</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;">Unit testing</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>team/group/bridge_construction/include/asterisk/config_options.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/channel.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/cel.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/cdr.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/funcs/func_channel.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/funcs/func_cdr.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/funcs/func_callerid.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_unistim.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_skinny.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_sip.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_mgcp.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_local.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_iax2.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_h323.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_dahdi.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/channels/chan_agent.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cel/cel_tds.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cel/cel_radius.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cel/cel_manager.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_tds.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_syslog.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_radius.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_pgsql.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_odbc.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_manager.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_custom.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_csv.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/cdr/cdr_adaptive_odbc.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/bridges/bridge_softmix.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_queue.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_osplookup.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_forkcdr.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_followme.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_dumpchan.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_disa.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_dial.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_cdr.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/apps/app_authenticate.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/addons/chan_ooh323.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/addons/cdr_mysql.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/UPGRADE.txt <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/CHANGES <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/stasis_channels.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/strings.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/test.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/include/asterisk/time.h <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/asterisk.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/bridging.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/cdr.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/cel.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/channel.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/channel_internal_api.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/cli.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/config_options.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/features.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/manager.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/manager_channels.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/pbx.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/stasis_channels.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/test.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/main/utils.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/res/res_agi.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/res/res_config_sqlite.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/res/res_monitor.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/res/res_stasis.c <span style="color: grey">(387018)</span></li>
<li>team/group/bridge_construction/tests/test_cdr.c <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2486/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>