> On Nov. 21, 2013, 6:04 p.m., Mark Michelson wrote:
> > branches/12/res/res_stasis_device_state.c, lines 142-149
> > <https://reviewboard.asterisk.org/r/3025/diff/1/?file=48549#file48549line142>
> >
> >     Instead of constructing a device_state_subscription and searching by 
> > OBJ_SEARCH_OBJECT, just use the name that was passed in and search by 
> > OBJ_SEARCH_KEY. That way, you save the overhead of the creation and 
> > destruction of an ao2_object whenever this function is called.

I need to search by the app name and device name in order to find the device 
subscribed to and OBJ_SEARCH_KEY only allows me to search using a single string 
field, so I create the object and search on that instead.


> On Nov. 21, 2013, 6:04 p.m., Mark Michelson wrote:
> > branches/12/res/res_stasis_device_state.c, lines 329-331
> > <https://reviewboard.asterisk.org/r/3025/diff/1/?file=48549#file48549line329>
> >
> >     You could save some cycles here by just calling 
> >     
> >     ao2_find(device_state_subscriptions, name, OBJ_SEARCH_KEY | OBJ_UNLINK 
> > | OBJ_NODATA);

Similar to above.  The data stored in device_state_subscriptions is essentially 
keyed off of two values instead of one: app_name and device_name.  This is done 
because the list could contain subscriptions with multiple app and device 
names.  So searches/finds have to be able to pass in both "keys" if you will.  
It first tries to match on the device name and if found then it tries to match 
on the app_name.  If both match the search returns the located subscription for 
that app and device.


- Kevin


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


On Nov. 21, 2013, 1:12 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, 1:12 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 402955 
>   branches/12/rest-api/api-docs/events.json 402955 
>   branches/12/rest-api/api-docs/deviceStates.json PRE-CREATION 
>   branches/12/rest-api/api-docs/applications.json 402955 
>   branches/12/res/stasis/app.c 402955 
>   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 402955 
>   branches/12/res/res_ari_deviceStates.c PRE-CREATION 
>   branches/12/res/ari/resource_deviceStates.c PRE-CREATION 
>   branches/12/res/ari/resource_deviceStates.h PRE-CREATION 
>   branches/12/res/ari/resource_applications.h 402955 
>   branches/12/res/ari/ari_model_validators.c 402955 
>   branches/12/res/ari/ari_model_validators.h 402955 
>   branches/12/res/ari.make 402955 
>   branches/12/main/devicestate.c 402955 
>   branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
>   branches/12/include/asterisk/stasis_app.h 402955 
>   branches/12/include/asterisk/devicestate.h 402955 
> 
> 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
> 
>

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to