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



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Only trivial stuff.</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/2639/diff/3/?file=40687#file40687line626" style="color: black; font-weight: bold; text-decoration: underline;">/team/dlee/ari-url-shuffle/main/stasis_channels.c</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; ">struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">624</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">json_chan</span> <span class="o">=</span> <span class="n">ast_json_pack</span><span class="p">(</span><span class="s">&quot;{ s: s, s: s, s: s, s: s, s: s, s: s, s: s,&quot;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">625</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">json_chan</span> <span class="o">=</span> <span class="n">ast_json_pack</span><span class="p">(</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">625</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="tb">        </span>  <span class="s">&quot;  s: s, s: s, s: s, s: s, s: o, s: o, s: o,&quot;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">626</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="cm">/* Broken up into groups of three for readability */</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">626</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="tb">        </span>  <span class="s">&quot;  s: o&quot;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">627</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="s">&quot;{ s: s, s: s, s: s,&quot;</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">627</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="tb">        </span>  <span class="s">&quot;}&quot;</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">628</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="s">&quot;  s: o, s: o, s: s,&quot;</span></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">629</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="s">&quot;  s: o, s: o }&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">630</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="cm">/* First line */</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">631</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="tb">        </span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="n">snapshot</span><span class="o">-&gt;</span><span class="n">uniqueid</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;">Because it feels appropriate...

http://www.youtube.com/watch?v=juFZh92MUOY
</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/2639/diff/3/?file=40692#file40692line1060" style="color: black; font-weight: bold; text-decoration: underline;">/team/dlee/ari-url-shuffle/res/res_stasis.c</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; ">static void sub_bridge_enter_handler(void *data,</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">974</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">stasis_cache_update_type</span><span class="p">(),</span> <span class="n">sub_channel_snapshot_handler</span><span class="p">,</span> <span class="nb">NULL</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">948</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">stasis_cache_update_type</span><span class="p">(),</span> <span class="n">sub_channel_snapshot_handler</span><span class="p">,</span> <span class="nb">NULL</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">975</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_user_event_type</span><span class="p">(),</span> <span class="n">sub_userevent_handler</span><span class="p">,</span> <span class="nb">NULL</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">949</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="cm">/* </span><span class="cs">TODO</span><span class="cm">: This could be handled a lot better. Instead of subscribing to</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">976</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_varset_type</span><span class="p">(),</span> <span class="n">sub_varset_handler</span><span class="p">,</span> <span class="nb">NULL</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">950</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"><span class="tb">        </span> * the one caching topic and filtering out messages by channel id, we</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">977</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_dtmf_begin_type</span><span class="p">(),</span> <span class="n">sub_dtmf_handler</span><span class="p">,</span> <span class="nb">NULL</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">951</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"><span class="tb">        </span> * should have individual caching topics per-channel, with a shared</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">978</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_hangup_request_type</span><span class="p">(),</span> <span class="n">sub_hangup_request_handler</span><span class="p">,</span> <span class="nb">NULL</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">952</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"><span class="tb">        </span> * back-end cache. That would simplify a lot of what&#39;s going on right</span></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">953</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"><span class="tb">        </span> * here.</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">954</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"><span class="tb">        </span> */</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">955</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_user_event_type</span><span class="p">(),</span> <span class="n">sub_channel_blob_handler</span><span class="p">,</span> <span class="nb">NULL</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">956</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_varset_type</span><span class="p">(),</span> <span class="n">sub_channel_blob_handler</span><span class="p">,</span> <span class="nb">NULL</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">957</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_dtmf_end_type</span><span class="p">(),</span> <span class="n">sub_channel_blob_handler</span><span class="p">,</span> <span class="nb">NULL</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">958</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="n">r</span> <span class="o">|=</span> <span class="n">stasis_message_router_add</span><span class="p">(</span><span class="n">channel_router</span><span class="p">,</span> <span class="n">ast_channel_hangup_request_type</span><span class="p">(),</span> <span class="n">sub_channel_blob_handler</span><span class="p">,</span> <span class="nb">NULL</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">979</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="k">if</span> <span class="p">(</span><span class="n">r</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">959</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">        </span><span class="k">if</span> <span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">980</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="k">return</span> <span class="n">AST_MODULE_LOAD_FAILURE</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">960</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="k">return</span> <span class="n">AST_MODULE_LOAD_FAILURE</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;">I&#39;d say go ahead and open an issue to do this. Even if we don&#39;t do it now, it&#39;d be good to have something on the queue for it.</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/2639/diff/3/?file=40695#file40695line47" style="color: black; font-weight: bold; text-decoration: underline;">/team/dlee/ari-url-shuffle/res/res_stasis_http_bridges.c</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <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">47</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#if defined(AST_DEVMODE)</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">48</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#include &quot;stasis_http/ari_model.h&quot;</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">49</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#endif</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;">On initial inspection I couldn&#39;t tell why we only include this header in DEVMODE. Once I looked at it, it was obvious - it only includes validators.

Is there a reason why this isn&#39;t called ari_model_validators or something similar?</pre>
</div>
<br />



<p>- Matt</p>


<br />
<p>On June 28th, 2013, 9:37 p.m. UTC, David Lee 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.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers and opticron.</div>
<div>By David Lee.</div>


<p style="color: grey;"><i>Updated June 28, 2013, 9:37 p.m.</i></p>







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


</div>



<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;">This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:

    { &quot;stasis_start&quot;: { &quot;args&quot;: [], &quot;channel&quot;: { ... } } }

The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.

This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.

 [1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ

In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.

The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don&#39;t match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.

Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.

The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.

 * The model for a channel snapshot was trimmed down to match the
   information sent via AMI. Many of the field being sent were not
   useful in the general case.

 * The model for a bridge snapshot was updated to be more consistent
   with the other ARI models.

Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.

Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.

This patch relies on the work in /team/dlee/ari-url-shuffle[2].

 [2]: https://reviewboard.asterisk.org/r/2621/</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;">Unit tests for validator.

Created some channels, put them in Stasis(), using the ARI /bridges API to bridge them together. And it worked.</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>/team/dlee/ari-url-shuffle/res/res_stasis.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_ari_model.exports.in <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_ari_model.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/Makefile <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/main/stasis_endpoints.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/main/stasis_channels.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/main/stasis_bridging.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/main/json.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/include/asterisk/stasis_http.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/include/asterisk/json.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/Makefile <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_asterisk.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_bridges.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_channels.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_endpoints.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_events.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_playback.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_recordings.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_http_sounds.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_asterisk.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_asterisk.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_bridges.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_bridges.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_channels.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_channels.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_endpoints.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_endpoints.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_events.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_events.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_playback.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_playback.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_recordings.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_recordings.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_sounds.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/res_stasis_json_sounds.exports.in <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_http/ari_model.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_http/ari_model.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_http/ari_websockets.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_http/resource_recordings.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_http/resource_recordings.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_asterisk.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_bridges.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_channels.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_endpoints.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_events.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_playback.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_recordings.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/res/stasis_json/resource_sounds.h <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/api.wiki.mustache <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/ari_model.c.mustache <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/ari_model.h.mustache <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/asterisk_processor.py <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/event_function_decl.mustache <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/make_ari_stubs.py <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/make_stasis_http_stubs.py <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/models.wiki.mustache <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_json_resource.c.mustache <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_json_resource.exports.mustache <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/stasis_json_resource.h.mustache <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api-templates/transform.py <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/asterisk.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/bridges.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/channels.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/endpoints.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/events.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/playback.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/recordings.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/rest-api/api-docs/sounds.json <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/tests/test_ari_model.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/dlee/ari-url-shuffle/tests/test_res_stasis.c <span style="color: grey">(393218)</span></li>

 <li>/team/dlee/ari-url-shuffle/tests/test_stasis_channels.c <span style="color: grey">(393218)</span></li>

</ul>

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







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








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