<div dir="ltr">Hi,<div><br></div><div>I've added comments below, please forgive me if I've missed something in previous discussions about the ARI, not had a chance to keep up with it all for a little while<br><div class="gmail_extra">
<br><div class="gmail_quote">On Wed, Dec 18, 2013 at 10:25 PM, Jonathan Rose <span dir="ltr"><<a href="mailto:jrose@digium.com" target="_blank">jrose@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>ARI Mailboxes resource</div><div><br></div><div>I'm currently starting on some basic implementation of the mailboxes</div><div>resource described at</div><div><a href="https://wiki.asterisk.org/wiki/display/AST/Blinky+Lights+API" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Blinky+Lights+API</a></div>

<div><br></div><div>Data Model:</div><div><br></div><div>name: string        name of the mailbox</div><div>new_messages: int   count of messages that have not been marked as old</div><div>old_messages: int   count of messages that have been marked as old</div>

<div><br></div><div>As such, I'm currently writing stub functions for the following commands</div><div><br></div><div>Method   URL                        Return type  </div><div>GET      /mailboxes                 list(mailbox)</div>

<div>POST     /mailboxes                 mailbox</div><div>GET      /mailboxes/{mailboxName}   void</div><div>PUT      /mailboxes/{mailboxName}   void</div><div>DELETE   /mailboxes/{mailboxName}   void</div><div><br></div>

<div>GET /mailboxes</div><div>List all mailboxes in Asterisk</div></div></blockquote><div><br></div><div>Is this purely returning a list of mailbox ids/names or mailbox objects with a subset of data in compared to  /mailboxes/{mailboxName}?  I can see why I'd want to list all mailboxes and how many messages are in each one.</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>POST /mailboxes</div><div>
Create an empty mailbox</div><div>query parameters:</div><div>  mailboxName - name for the mailbox</div></div></blockquote><div><br></div><div>Would this not possibly return an error if the name already existed? Is the name mandatory or optional? If optional, would it just create a randomly named mailbox? I don't see why you'd want to do this but... </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<br></div><div>GET /mailboxes/{mailboxName}</div><div>Get the current state of a mailbox</div><div>path parameters:</div><div>  mailboxName - name of the mailbox</div><div>error responses:</div><div>  404 - Mailbox not found </div>
</div></blockquote><div><br></div><div>What kind of response would a mailbox look like? An Object with what parameters in?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div> </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">

<div><br></div><div>PUT /mailboxes/{mailboxName}</div><div>Change the state of a mailbox</div><div>path parameters:</div><div>  mailboxName - name of the mailbox to be modified</div><div>query parameters:</div><div>  new_messages - count of new messages in the mailbox</div>

<div>  old_messages - count of old messages in the mailbox</div><div>error responses:</div><div>  404 - Mailbox not found</div><div>  409 - Mailbox not in a stasis application</div></div></blockquote><div><br></div><div>
Something about this seems wrong to me but I can't put my finger on it, a mailbox only has messages and so messages shouldn't need to be in the name of params as it's self documenting as such. I can't access the wiki to get access to other route's documentation right now so I'm not sure if this is in keeping with the rest of the ARI or not.</div>
<div><br></div><div>Are both of these parameters required? If there are X number of messages in the mailbox and only 2 are new then old messages is X-2; or am I missing something? If they are both required then will there be validation to say that old + new must equal the total number of messages in the mailbox?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>DELETE /mailboxes/{mailboxName}</div>

<div>Delete an existing mailbox</div><div>path parameters:</div><div>  mailboxName -name of the mailbox to be deleted</div><div>error responses:</div><div>  404 - Mailbox not found</div><div>  409 - Mailbox not in a stasis application</div>
</div></blockquote><div><br></div><div>Are there any other reasons why a mailbox couldn't be deleted? What if it was being written to at that moment?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div></div><div>Events:</div><div>MailboxStateChanged</div><div>  The contents of a mailbox have changed</div><div>  mailbox - name of the mailbox that was changed</div></div></blockquote><div><br></div><div>
Would it only give you the fact it changed? Or would it detail the change itself?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><br></div><div>MailboxUpdateRequested</div>
<div>  When Asterisk starts, it has no mailbox state from the external</div><div>    application. This event requests that the external voicemail</div><div>    application put the current mailbox state back into Asterisk.</div>

<div>  mailbox - name of the mailbox Asterisk</div><div><br></div><div>I'm still a little hazy on some details, such as whether or not</div><div>mailbox data will be persisted. There was something of a debate</div><div>

over the topic that I couldn't quite tell whether it reached a</div><div>concensus and the wiki proposal contained conflicting information.</div><div>I'm unsure how that will affect the ARI work.</div><div><br></div>

<div>If anyone has any input into this, I'd appreciate hearing it before</div><div>getting too deep into the coding of it.</div><div><br></div><div>Also, it's worth noting that the Mailboxes resource will not be</div>

<div>released with Asterisk 12.0, and will likely be a new feature</div><div>slightly down the road (targeting 12.1).</div><div><br></div><div>If all of this seems appropriate, I'll go ahead and start trimming</div><div>

the more generic topics proposal and getting the details fleshed</div><div>out on the wiki page.</div></div></blockquote><div><br></div><div>Great to see more stuff being added to the ARI :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><span class=""><font color="#888888"><div><br></div>-- <br><div dir="ltr">Jonathan R. Rose<br>Digium, Inc. | Software Engineer<br>445 Jan Davis Drive NW - Huntsville, AL 35806 - US<br>
direct <a href="tel:%2B1%20256%20428%206139" value="+12564286139" target="_blank">+1 256 428 6139</a> <br><br>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a><br>
<br></div>
</font></span></div>
<br>_______________________________________________<br>
asterisk-app-dev mailing list<br>
<a href="mailto:asterisk-app-dev@lists.digium.com">asterisk-app-dev@lists.digium.com</a><br>
<a href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev" target="_blank">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a><br>
<br></blockquote></div><br></div></div><div class="gmail_extra">Dan</div></div>