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








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On June 1st, 2011, 4:18 p.m., <b>David Vossel</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<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/1244/diff/1/?file=16807#file16807line1127" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/main/asterisk.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_network_puts_mutable(const char *string, int level)</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1127</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">fd</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1127</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">fd</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1128</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="k">if</span> <span class="p">(</span><span class="o"><span class="hl">!</span></span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">levels</span><span class="p">[</span><span class="n">level</span><span class="p">])</span><span class="ew"> </span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1128</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="k">if</span> <span class="p">(</span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">levels</span><span class="p">[</span><span class="n">level</span><span class="p">])</span></pre></td>
  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1129</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="n">fdprint</span><span class="p">(</span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">string</span><span class="p">);</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1129</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="n">fdprint</span><span class="p">(</span><span class="n">consoles</span><span class="p">[</span><span class="n">x</span><span class="p">].</span><span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">string</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1130</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="p">}</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1130</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="p">}</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This logically makes sense to me, but I am very confused.  svn blame shows this line has existed this way for years, how has this gone unnoticed?  If this just broke recently I&#39;d like to know what caused it as this isn&#39;t the reason.</pre>
 </blockquote>



 <p>On June 2nd, 2011, 10:47 a.m., <b>jrose</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes, I was thinking the same thing.  At the same time though, I was looking at this and it seems so obviously wrong that it just seems like it has to be the problem&#39;s source.

I&#39;ll checkout to that revision and see if this is how it&#39;s working there.  I imagine it would be very easy for this to go unnoticed though depending on how frequently users actually change the logger settings in CLI.

Before I posted it Edit:  I can confirm that as far back as the beginning of 2009 that this behavior has been the reverse of what you would expect with logger set levels ____ on turning logging off and &quot; off turning logging on within the connected console.

Since I couldn&#39;t get the actual revision in question compiled, but the above came only moderately later and shows the same problems, I&#39;m currently standing by this fix.  I&#39;ll try to go back as early as I can though.</pre>
 </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ok, so I finally managed to test this in the revision that this line is blamed for...


JonUbuntu*CLI&gt; logger set level WARNING on
Logger status for &#39;WARNING&#39; has been set to &#39;on&#39;.
  == Using SIP RTP CoS mark 5
  == Using UDPTL CoS mark 5
    -- Executing [1001@sipphones:1] Answer(&quot;SIP/evilhost-08d3f688&quot;, &quot;&quot;) in new stack
    -- Executing [1001@sipphones:2] Playback(&quot;SIP/evilhost-08d3f688&quot;, &quot;tt-weasels&quot;) in new stack
    -- &lt;SIP/evilhost-08d3f688&gt; Playing &#39;tt-weasels.gsm&#39; (language &#39;en&#39;)
    -- Executing [1001@sipphones:3] BackGround(&quot;SIP/evilhost-08d3f688&quot;, &quot;tt-codezone&quot;) in new stack
    -- Executing [1001@sipphones:4] Hangup(&quot;SIP/evilhost-08d3f688&quot;, &quot;&quot;) in new stack
  == Spawn extension (sipphones, 1001, 4) exited non-zero on &#39;SIP/evilhost-08d3f688&#39;
logger set level WARNING off
Logger status for &#39;WARNING&#39; has been set to &#39;off&#39;.
  == Using SIP RTP CoS mark 5
  == Using UDPTL CoS mark 5
    -- Executing [1001@sipphones:1] Answer(&quot;SIP/evilhost-08d28448&quot;, &quot;&quot;) in new stack
    -- Executing [1001@sipphones:2] Playback(&quot;SIP/evilhost-08d28448&quot;, &quot;tt-weasels&quot;) in new stack
    -- &lt;SIP/evilhost-08d28448&gt; Playing &#39;tt-weasels.gsm&#39; (language &#39;en&#39;)
    -- Executing [1001@sipphones:3] BackGround(&quot;SIP/evilhost-08d28448&quot;, &quot;tt-codezone&quot;) in new stack
[2011-06-0212:58:30] WARNING[16296]: file.c:582 ast_openstream_full: File tt-codezone does not exist in any format
[2011-06-0212:58:30] WARNING[16296]: file.c:896 ast_streamfile: Unable to open tt-codezone (format 0x2 (gsm)): No such file or directory
[2011-06-0212:58:30] WARNING[16296]: pbx.c:7656 pbx_builtin_background: ast_streamfile failed on SIP/evilhost-08d28448 for tt-codezone
    -- Executing [1001@sipphones:4] Hangup(&quot;SIP/evilhost-08d28448&quot;, &quot;&quot;) in new stack
  == Spawn extension (sipphones, 1001, 4) exited non-zero on &#39;SIP/evilhost-08d28448&#39;
JonUbuntu*CLI&gt; 



So as you can see, the logger settings have been reversed all along.

Also, this feature was added in that revision to start with, so that pretty much says it all I guess.</pre>
<br />




<p>- jrose</p>


<br />
<p>On June 1st, 2011, 3:58 p.m., jrose wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/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, Russell Bryant and David Vossel.</div>
<div>By jrose.</div>


<p style="color: grey;"><i>Updated 2011-06-01 15:58:14</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;">ast_network_puts_mutable writes to a connected console client only if it&#39;s level was set to false.  This changes that function to write it only if it is set to true to resolve the reverse behavior from expectations issue.

This seems like the way to go, but I can&#39;t see for the life of me why this mistake would be made if it really was just a mistake.  It&#39;s hard to say.</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;">Just tested with a couple of connected clients.  I&#39;ll test more tomorrow.</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/view.php?id=19287">19287</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>/branches/1.8/main/asterisk.c <span style="color: grey">(321530)</span></li>

</ul>

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




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








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