<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/1765/">https://reviewboard.asterisk.org/r/1765/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Looks good except for the permutation thing.</pre>
 <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/1765/diff/2/?file=25097#file25097line125" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/lib/python/asterisk/cdr.py</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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; ">def match(self, other):</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">125</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">for</span> <span class="n">permutation</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</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">126</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="n">match</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">other</span><span class="p">[</span><span class="n">permutation</span><span class="p">[</span><span class="n">i</span><span class="p">]],</span> <span class="n">silent</span><span class="o">=</span><span class="bp">True</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">127</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                     <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</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">128</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="n">match</span> <span class="o">=</span> <span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">match</span> <span class="k">if</span> <span class="n">i</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">129</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="ow">not</span> <span class="n">best_match</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">best_match</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">match</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">130</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">best_match</span> <span class="o">=</span> <span class="p">(</span><span class="n">permutation</span><span class="p">,</span> <span class="n">match</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">131</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">best_match</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">match</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</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">132</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">logger</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&quot;More than one CDR permutation results in success&quot;</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">133</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">break</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;">I would prefer a solution that scales better than factorially since we have no idea how many records will be available. Iterating through  2.4e18 permutations for 20 records would be unpleasant.

Perhaps removing matched items from the list would be &quot;good enough&quot; as long as people write sane tests with regexes that match single records.</pre>
</div>
<br />



<p>- Terry</p>


<br />
<p>On February 28th, 2012, 4:06 p.m., wdoekes wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/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 wdoekes.</div>


<p style="color: grey;"><i>Updated Feb. 28, 2012, 4:06 p.m.</i></p>




<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;">There&#39;s a change in the CDRs between 1.6.2 and 1.8 with regards to the CDR(accountcode).

I created an example:

exten =&gt; 1,1,Set(CDR(accountcode)=initial)
exten =&gt; 1,n,Dial(Local/2@default)
exten =&gt; 2,1,Dial(Local/3@default)
exten =&gt; 3,1,Set(CDR(accountcode)=third)

Master.csv of 1.6.2:

&quot;third&quot;,&quot;&quot;,&quot;3&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/3@default-ABCD;2&quot;,&quot;&quot;,&quot;Hangup&quot;,&quot;&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.5&quot;,&quot;&quot;
&quot;initial&quot;,&quot;&quot;,&quot;2&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/2@default-ABCD;2&quot;,&quot;Local/3@default-ABCD;1&quot;,&quot;Dial&quot;,&quot;Local/3@default&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.3&quot;,&quot;&quot;
&quot;initial&quot;,&quot;&quot;,&quot;1&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/1@default-ABCD;2&quot;,&quot;Local/2@default-ABCD;1&quot;,&quot;Dial&quot;,&quot;Local/2@default&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.1&quot;,&quot;&quot;
&quot;&quot;,&quot;&quot;,&quot;1&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/1@default-ABCD;1&quot;,&quot;&quot;,&quot;Echo&quot;,&quot;&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.0&quot;,&quot;&quot;

.. seems logically ordered.

Master.csv of 1.8:

&quot;&quot;,&quot;&quot;,&quot;2&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/2@default-ABCD;2&quot;,&quot;Local/3@default-ABCD;1&quot;,&quot;Dial&quot;,&quot;Local/3@default&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.3&quot;,&quot;&quot;
&quot;third&quot;,&quot;&quot;,&quot;3&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/3@default-ABCD;2&quot;,&quot;&quot;,&quot;Hangup&quot;,&quot;&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.5&quot;,&quot;&quot;
&quot;initial&quot;,&quot;&quot;,&quot;1&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/1@default-ABCD;2&quot;,&quot;Local/2@default-ABCD;1&quot;,&quot;Dial&quot;,&quot;Local/2@default&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.1&quot;,&quot;&quot;
&quot;&quot;,&quot;&quot;,&quot;1&quot;,&quot;default&quot;,&quot;&quot;,&quot;Local/1@default-ABCD;1&quot;,&quot;&quot;,&quot;Echo&quot;,&quot;&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,&quot;2012-02-22 00:00:00&quot;,0,0,&quot;ANSWERED&quot;,&quot;DOCUMENTATION&quot;,&quot;1329946580.0&quot;,&quot;&quot;

.. has disorder where the first record should be second, and I&#39;m missing the CDR(accountcode) in said record.

I don&#39;t know if CSV ordering is important (although the CDR tests&#39; add_expectation() seems to imply they are fixed), but not having the CDR(accountcode) propagated to the Local channels is an undesirable change.</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;">See above.

Can someone confirm that the CSV of 1.6.2 is the &quot;correct&quot; one?</pre>
  </td>
 </tr>
</table>



<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-19384">ASTERISK-19384</a>


</div>


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

 <li>/asterisk/trunk/lib/python/asterisk/cdr.py <span style="color: grey">(3071)</span></li>

 <li>/asterisk/trunk/tests/cdr/cdr_accountcode/configs/ast1/cdr.conf <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/cdr/cdr_accountcode/configs/ast1/extensions.conf <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/cdr/cdr_accountcode/run-test <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/cdr/cdr_accountcode/test-config.yaml <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/cdr/tests.yaml <span style="color: grey">(3071)</span></li>

</ul>

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




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








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