<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/3326/">https://reviewboard.asterisk.org/r/3326/</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 are two calls to ast_sorcery_apply_default() in bucket.c:ast_bucket_init() that check the return value.  You should update these call to handle the new return codes.</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/3326/diff/5/?file=56180#file56180line380" style="color: black; font-weight: bold; text-decoration: underline;">/branches/12/include/asterisk/sorcery.h</a>
    <span style="font-weight: normal;">

     (Diff revision 5)

    </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_sorcery *__ast_sorcery_open(const char *module);</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">380</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \return What happened when attempting to apply the default.</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;">s/the default/the config/</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/3326/diff/5/?file=56181#file56181line777" style="color: black; font-weight: bold; text-decoration: underline;">/branches/12/main/sorcery.c</a>
    <span style="font-weight: normal;">

     (Diff revision 5)

    </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; ">int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module)</pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">enum ast_sorcery_apply_result  __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">752</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="cm">/* Any error immediately causes us to stop */</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">777</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="cm">/* Any error immediately causes us to stop */</span></pre></td>
  </tr>

 </tbody>


 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">753</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="k">if</span> <span class="p">(</span><span class="n">sorcery_apply_wizard_mapping</span><span class="p">(</span><span class="n">sorcery</span><span class="p">,</span> <span class="n">type</span><span class="p">,</span> <span class="n">module</span><span class="p">,</span> <span class="n">wizard</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">caching</span><span class="p">))</span> <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">778</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="k">if</span> <span class="p">(</span><span class="n">sorcery_apply_wizard_mapping</span><span class="p">(</span><span class="n">sorcery</span><span class="p">,</span> <span class="n">type</span><span class="p">,</span> <span class="n">module</span><span class="p">,</span> <span class="n">wizard</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">caching</span><span class="p">)</span><span class="hl"> </span><span class="o"><span class="hl">==</span></span><span class="hl"> </span><span class="n"><span class="hl">AST_SORCERY_APPLY_FAIL</span></span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">754</font></th>
    <td bgcolor="#fdfebc" 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="n">res</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">779</font></th>
    <td bgcolor="#fdfebc" 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="n">res</span> <span class="o">=</span> <span class="n">AST_SORCERY_APPLY_FAIL</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;">Should a duplicate wizard be considered a failure here?  If so we should:
res = sorcery_apply_wizard_mapping()
if (res != success)
   break</pre>
</div>
<br />



<p>- rmudgett</p>


<br />
<p>On March 17th, 2014, 3:31 p.m. CDT, Mark Michelson 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.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By Mark Michelson.</div>


<p style="color: grey;"><i>Updated March 17, 2014, 3:31 p.m.</i></p>









<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;">When performing some realtime tests, I noticed that the AMI command PJSIPShowEndpoints was listing all of my endpoints twice. This is because ast_sorcery_apply_config() was being called twice from res_pjsip code, once when initializing system configuration, and once again when initializing the rest of the configuration data. This patch aims to fix the problem on two fronts:

1) Remove the ast_sorcery_apply_config() calls from the PJSIP code entirely in favor of having sorcery automatically apply configuration for the module when sorcery is opened. This reduces the chance of accidentally attempting to apply the same configuration twice. I also removed the call to ast_sorcery_apply_config from res_mwi_external since it is no longer necessary either.

2) Adjust sorcery_apply_wizard_mapping() not to apply the same wizard to an object type more than once, just in case someone does make the error of calling ast_sorcery_apply_config() multiple times for the same object type.</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;">My tests of retrieving data from realtime now get the expected objects. I don't have any automated tests to post yet because the realtime testsuite is a work in progress.</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>/branches/12/tests/test_sorcery_realtime.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/tests/test_sorcery_astdb.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/tests/test_sorcery.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/res/res_pjsip/pjsip_configuration.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/res/res_pjsip/config_system.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/res/res_mwi_external.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/main/sorcery.c <span style="color: grey">(410696)</span></li>

 <li>/branches/12/include/asterisk/sorcery.h <span style="color: grey">(410696)</span></li>

 <li>/branches/12/configs/sorcery.conf.sample <span style="color: grey">(410696)</span></li>

</ul>

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







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








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