<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/1363/">https://reviewboard.asterisk.org/r/1363/</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/1363/diff/3/?file=18475#file18475line13" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </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; "></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">13</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        same =&gt; n,Wait(2)</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 agree, but I&#39;m not sure what else to do here.  The Wait() ensures that the UserEvent is delivered to the test suite prior to the channel being hanged up.  Without it, I noticed that the UserEvents failed to get delivered.</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/1363/diff/3/?file=18484#file18484line46" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/run-test</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </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; "></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">46</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        if state == &#39;AUTHENTICATED&#39;:</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">47</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            self.changeState(AuthenticatedTestState(self.controller, self.voiceMailTest))</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">48</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        elif state == &#39;PLAYBACK&#39;:</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;">The ordering in these blocks is typically going to try to match the order in which the statements come back from app_voicemail (although they aren&#39;t always in the same order, so it&#39;s a rule that&#39;s bound to be broken)

In this case this is backwards, so I&#39;ll switch it - but there are going to be times when the code makes more sense with the larger blobs in the middle or end.

Think of these if-elif blocks less of a binary conditional test and more as a switch statement.</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/1363/diff/3/?file=18484#file18484line62" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/run-test</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </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; "></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">62</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        return &quot;START&quot;</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;">Not that I like repeating myself in code, but doing that does two things:
1. It breaks the OO pattern by tying the concrete implementations to definitions in the base class
2. It ties the test tighter to what is defined in app_voicemail - the test is more likely to be a subset of the states that are possible in app_voicemail, rather than there being a perfect one to one correlation

As it is, I could use the python class name instead of having this method, but that can get a little tricky to print out (and isn&#39;t always as nicely formatted)</pre>
</div>
<br />



<p>- mjordan</p>


<br />
<p>On August 16th, 2011, 4:55 p.m., mjordan 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, David Vossel and Paul Belanger.</div>
<div>By mjordan.</div>


<p style="color: grey;"><i>Updated Aug. 16, 2011, 4:55 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;">This review is part 2 of 2.  It demonstrates writing a test in the Asterisk Test Suite that takes advantage of the TestEvent in Asterisk to exercise functionality in a complex application.  The test does the following:

1. Calls into VoiceMailMain and enters a password (optionally, it would also do a user mailbox, but the dialplan takes care of that.  The test is &#39;smart enough&#39; to recognize this)
2. Listens to an Urgent message, making sure that it hears the Urgent message first, then saves it to the old folder
3. Listens to two new messages, saving them to the old folder as well
4. Exits cleanly

This involves triggering off a number of events returned from app_voicemail, telling the test where it is in the sequence of playing voice prompts and what menu it happens to be in.  Since app_voicemail tends to recycle voice prompts in various places, the test &#39;helps itself&#39; a few times, but by and large the states are driven completely off of what is being sent from the application itself.</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>/asterisk/trunk/lib/python/asterisk/TestCase.py <span style="color: grey">(1839)</span></li>

 <li>/asterisk/trunk/lib/python/asterisk/TestState.py <span style="color: grey">(PRE-CREATION)</span></li>

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

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

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/manager.general.conf.inc <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/manager.users.conf.inc <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/sip.conf <span style="color: grey">(PRE-CREATION)</span></li>

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

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast2/extensions.conf <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast2/manager.general.conf.inc <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast2/manager.users.conf.inc <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast2/sip.conf <span style="color: grey">(PRE-CREATION)</span></li>

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

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

 <li>/asterisk/trunk/tests/apps/voicemail/tests.yaml <span style="color: grey">(1839)</span></li>

</ul>

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




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








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