[asterisk-dev] [Code Review] 3025: ARI: Implement device state API

Kevin Harwell reviewboard at asterisk.org
Fri Nov 22 10:49:16 CST 2013



> On Nov. 21, 2013, 3:30 p.m., David Lee wrote:
> > branches/12/main/devicestate.c, lines 741-742
> > <https://reviewboard.asterisk.org/r/3025/diff/2/?file=48588#file48588line741>
> >
> >     Unused.

Actually this does get used as it before the function returns the device state data gets unref'ed and destroyed.  However doing it this way is a bit cryptic, so I'll change it to just do a cleanup at the end of the function with RAII_VAR.


> On Nov. 21, 2013, 3:30 p.m., David Lee wrote:
> > branches/12/res/ari/resource_deviceStates.c, lines 54-59
> > <https://reviewboard.asterisk.org/r/3025/diff/2/?file=48594#file48594line54>
> >
> >     Isn't a 404 Not Found also possible here?

No because it will return a device state of "UNKNOWN" for a device that is is not currently aware of.  However, I did remove it from the json definition as it made it look like it could be returned.


- Kevin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3025/#review10257
-----------------------------------------------------------


On Nov. 21, 2013, 6:25 p.m., Kevin Harwell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3025/
> -----------------------------------------------------------
> 
> (Updated Nov. 21, 2013, 6:25 p.m.)
> 
> 
> Review request for Asterisk Developers, David Lee and Matt Jordan.
> 
> 
> Bugs: ASTERISK-22838
>     https://issues.asterisk.org/jira/browse/ASTERISK-22838
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Created a data model and implemented functionality for an ARI device state resource.  The following operations have been added that allow a user to manipulate an ARI controlled device:
> 
> PUT    /device-states/{deviceName}&{deviceState} - Create/Change the state of an ARI controlled device
> GET    /device-states/{deviceName} - Retrieve the current state of a device
> DELETE /device-states/{deviceName} - Destroy a device-state controlled by ARI
> 
> The ARI controlled device must begin with 'Stasis:'.  An example controlled device name would be Stasis:Example.
> 
> A 'DeviceStateChanged' event has also been added so that an application can subscribe and receive device change events.  Any device state, ARI controlled or not, can be subscribed to.
> 
> While adding the event, the underlying subscription control mechanism was refactored so that all current and future resource subscriptions would be the same.  Each event resource must now register itself in order to be able to properly handle [un]subscribes.
> 
> 
> Diffs
> -----
> 
>   branches/12/rest-api/resources.json 402993 
>   branches/12/rest-api/api-docs/events.json 402993 
>   branches/12/rest-api/api-docs/deviceStates.json PRE-CREATION 
>   branches/12/rest-api/api-docs/applications.json 402993 
>   branches/12/rest-api-templates/ari.make.mustache 402993 
>   branches/12/res/stasis/app.c 402993 
>   branches/12/res/stasis/app.h 402993 
>   branches/12/res/res_stasis_device_state.exports.in PRE-CREATION 
>   branches/12/res/res_stasis_device_state.c PRE-CREATION 
>   branches/12/res/res_stasis.c 402993 
>   branches/12/res/res_ari_device_states.c PRE-CREATION 
>   branches/12/res/ari/resource_device_states.c PRE-CREATION 
>   branches/12/res/ari/resource_device_states.h PRE-CREATION 
>   branches/12/res/ari/resource_applications.h 402993 
>   branches/12/res/ari/ari_model_validators.c 402993 
>   branches/12/res/ari/ari_model_validators.h 402993 
>   branches/12/res/ari.make 402993 
>   branches/12/main/devicestate.c 402993 
>   branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
>   branches/12/include/asterisk/stasis_app.h 402993 
>   branches/12/include/asterisk/devicestate.h 402993 
> 
> Diff: https://reviewboard.asterisk.org/r/3025/diff/
> 
> 
> Testing
> -------
> 
> Some basic testing done using the swagger framework and a websocket connection.  Testing adding, changing, and removing device state with regards to an ARI controlled device were successful.  Also tested [un]subscribing to the events from device with success.  Planning on writing some testsuite test cases as well.
> 
> 
> Thanks,
> 
> Kevin Harwell
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131122/67461d1a/attachment-0001.html>


More information about the asterisk-dev mailing list