<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/2042/">https://reviewboard.asterisk.org/r/2042/</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;">There is quite a bit of shared code used in context-finding between complete_dialplan_add_include and complete_dialplan_remove_context (and probably others).  I would suggest refactoring this into a function.</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/2042/diff/1/?file=30207#file30207line1117" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/pbx/pbx_config.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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static char *complete_dialplan_remove_context(struct ast_cli_args *a)</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">1082</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="p">}</span><span class="ew"> </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;">Red blob.</pre>
</div>
<br />



<p>- opticron</p>


<br />
<p>On July 13th, 2012, 4:41 a.m., corruptor 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 corruptor.</div>


<p style="color: grey;"><i>Updated July 13, 2012, 4:41 a.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;">I&#39;ve noticed that we can remove particular extension from context with dialplan remove extension command but in order to remove all extensions in the context we should delete them on by one. I&#39;ve created dialplan remove context command which uses ast_context_destroy to destroy the whole context with all extensions. I&#39;ve created to functions for in pbx_config.c: handle_cli_dialplan_remove_context which actually removes context and complete_dialplan_remove_context which completes input. They are based on other similar functions and pretty trivial but I can be mistaken somewhere.

I&#39;ve also modified dialplan add include &lt;context2&gt; into &lt;context1&gt;. I&#39;ve made it similar dialplan add extension ... command. It creates &lt;context1&gt; if it doesn&#39;t exist and I&#39;ve also modified complete_dialplan_add_include and removed check for existance of &lt;context2&gt; because we can include non-existent context into another one. (I usually include empty (non-existent) contexts in advance). Should we raise warning in this case as it&#39;s raised while reading extensions.conf?

I use those functions with AMI. I think manager commands should be created in addition to those CLI commands.</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;">We&#39;ve used both functions very often for the last couple of months and they seem to work good.
</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>/trunk/pbx/pbx_config.c <span style="color: grey">(370052)</span></li>

</ul>

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




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








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