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

2013-12-09 Thread Kevin Harwell

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

(Updated Nov. 23, 2013, 11:38 a.m.)


Status
--

This change has been marked as submitted.


Review request for Asterisk Developers, David Lee and Matt Jordan.


Changes
---

Committed in revision 403134


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 403013 
  branches/12/rest-api/api-docs/events.json 403013 
  branches/12/rest-api/api-docs/deviceStates.json PRE-CREATION 
  branches/12/rest-api/api-docs/applications.json 403013 
  branches/12/rest-api-templates/ari.make.mustache 403013 
  branches/12/res/stasis/app.c 403013 
  branches/12/res/stasis/app.h 403013 
  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 403013 
  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 403013 
  branches/12/res/ari/ari_model_validators.c 403013 
  branches/12/res/ari/ari_model_validators.h 403013 
  branches/12/res/ari.make 403013 
  branches/12/main/devicestate.c 403013 
  branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
  branches/12/include/asterisk/stasis_app.h 403013 
  branches/12/include/asterisk/devicestate.h 403013 

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

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

2013-12-09 Thread Kevin Harwell

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

(Updated Nov. 22, 2013, 10:52 a.m.)


Review request for Asterisk Developers, David Lee and Matt Jordan.


Changes
---

Fixed a small problem that occurred when trying to delete a device that was not 
in the cache.  Also made a change to the ari.make template to use the c_name.


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 (updated)
-

  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

-- 
_
-- 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

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

2013-12-09 Thread Kevin Harwell

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

(Updated Nov. 22, 2013, 1:36 p.m.)


Review request for Asterisk Developers, David Lee and Matt Jordan.


Changes
---

Made is so searches on the subscriptions list using OBJ_SEARCH_KEY or 
OBJ_SEARCH_OBJECT check the same fields on comparison.


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 (updated)
-

  branches/12/rest-api/resources.json 403013 
  branches/12/rest-api/api-docs/events.json 403013 
  branches/12/rest-api/api-docs/deviceStates.json PRE-CREATION 
  branches/12/rest-api/api-docs/applications.json 403013 
  branches/12/rest-api-templates/ari.make.mustache 403013 
  branches/12/res/stasis/app.c 403013 
  branches/12/res/stasis/app.h 403013 
  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 403013 
  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 403013 
  branches/12/res/ari/ari_model_validators.c 403013 
  branches/12/res/ari/ari_model_validators.h 403013 
  branches/12/res/ari.make 403013 
  branches/12/main/devicestate.c 403013 
  branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
  branches/12/include/asterisk/stasis_app.h 403013 
  branches/12/include/asterisk/devicestate.h 403013 

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

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

2013-11-22 Thread Kevin Harwell


 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
 


-- 
_
-- 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

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

2013-11-22 Thread Kevin Harwell


 On Nov. 21, 2013, 3:03 p.m., opticron wrote:
  branches/12/res/res_stasis_device_state.c, lines 139-150
  https://reviewboard.asterisk.org/r/3025/diff/2/?file=48597#file48597line139
 
  Why not search via OBJ_SEARCH_KEY? This seems like a pretty expensive 
  operation when it doesn't have to be.

I need to search by the app name and device name in order to find the device 
subscribed to, so I create the object and search on that.


- Kevin


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


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
 


-- 
_
-- 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

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

2013-11-22 Thread Matt Jordan

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

Ship it!


Ship It!

- Matt Jordan


On Nov. 22, 2013, 7:36 p.m., Kevin Harwell wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviewboard.asterisk.org/r/3025/
 ---
 
 (Updated Nov. 22, 2013, 7:36 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 403013 
   branches/12/rest-api/api-docs/events.json 403013 
   branches/12/rest-api/api-docs/deviceStates.json PRE-CREATION 
   branches/12/rest-api/api-docs/applications.json 403013 
   branches/12/rest-api-templates/ari.make.mustache 403013 
   branches/12/res/stasis/app.c 403013 
   branches/12/res/stasis/app.h 403013 
   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 403013 
   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 403013 
   branches/12/res/ari/ari_model_validators.c 403013 
   branches/12/res/ari/ari_model_validators.h 403013 
   branches/12/res/ari.make 403013 
   branches/12/main/devicestate.c 403013 
   branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
   branches/12/include/asterisk/stasis_app.h 403013 
   branches/12/include/asterisk/devicestate.h 403013 
 
 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

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

2013-11-21 Thread Joshua Colp


 On Nov. 21, 2013, 12:59 a.m., Paul Belanger wrote:
  branches/12/rest-api/api-docs/device_states.json, line 11
  https://reviewboard.asterisk.org/r/3025/diff/1/?file=48553#file48553line11
 
  Hmm, not a fan of this URL schema.  At first glance, what about just 
  /states.
  
  Additionally, I know within asterisk it is a device state however from 
  ARI we don't actually have a device, we have endpoints.  So, that in itself 
  is confusing.
  
  I think the snake_case here is the issue, since most everything else 
  has moved to camelCase.   Consistency FTW!

I completely disagree with changing this to /states. That's not descriptive 
enough and is completely generic, which the API itself is not. If I'm a 
developer looking at that the first question I'd ask would be states for what? 
channels?. Having something else with it (even if not device) gives immediate 
information and makes it much clearer.


- Joshua


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


On Nov. 20, 2013, 10:25 p.m., Kevin Harwell wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviewboard.asterisk.org/r/3025/
 ---
 
 (Updated Nov. 20, 2013, 10: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 402915 
   branches/12/rest-api/api-docs/events.json 402915 
   branches/12/rest-api/api-docs/device_states.json PRE-CREATION 
   branches/12/rest-api/api-docs/applications.json 402915 
   branches/12/res/stasis/app.c 402915 
   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 402915 
   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 402915 
   branches/12/res/ari/ari_model_validators.c 402915 
   branches/12/res/ari/ari_model_validators.h 402915 
   branches/12/res/ari.make 402915 
   branches/12/main/devicestate.c 402915 
   branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
   branches/12/include/asterisk/stasis_app.h 402915 
   branches/12/include/asterisk/devicestate.h 402915 
 
 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

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

2013-11-21 Thread opticron

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



branches/12/include/asterisk/stasis_app.h
https://reviewboard.asterisk.org/r/3025/#comment19605

If this is going to be exposed globally, it needs to be renamed.



branches/12/include/asterisk/stasis_app.h
https://reviewboard.asterisk.org/r/3025/#comment19603

There's no need to forward declare this a second time.



branches/12/res/res_stasis_device_state.c
https://reviewboard.asterisk.org/r/3025/#comment19613

Why not search via OBJ_SEARCH_KEY? This seems like a pretty expensive 
operation when it doesn't have to be.


- opticron


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

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

2013-11-21 Thread David Lee

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



branches/12/include/asterisk/stasis_app.h
https://reviewboard.asterisk.org/r/3025/#comment19612

This was declared above.



branches/12/main/devicestate.c
https://reviewboard.asterisk.org/r/3025/#comment19614

Unused.



branches/12/res/ari.make
https://reviewboard.asterisk.org/r/3025/#comment19617

device_states should be snake_case instead of camelCase. That's my bad in 
the generator.

Fixed on 12 in r402981. Merge from the latest 12, run make ari-stubs, and 
rename your files to snake_case.

Sorry about that.



branches/12/res/ari/resource_deviceStates.c
https://reviewboard.asterisk.org/r/3025/#comment19618

Isn't a 404 Not Found also possible here?



branches/12/res/ari/resource_deviceStates.c
https://reviewboard.asterisk.org/r/3025/#comment19619

This should be a 409 Conflict, since it's a user error (wrong sort of 
device state) and not a server side error.



branches/12/res/ari/resource_deviceStates.c
https://reviewboard.asterisk.org/r/3025/#comment19621

1. I would have thought that missing would be a 404, and unknown a 500
2. You have a bad fall through to the default case.
3. You shouldn't be using default anyways. Be specific, so when new 
response codes are added, GCC will tell us about missing cases in dev mode.



branches/12/res/ari/resource_deviceStates.c
https://reviewboard.asterisk.org/r/3025/#comment19622

409



branches/12/res/ari/resource_deviceStates.c
https://reviewboard.asterisk.org/r/3025/#comment19623

Similar comment as above.



branches/12/res/res_stasis.c
https://reviewboard.asterisk.org/r/3025/#comment19615

No sense having both app_name and stasis_app_name. Just 
s/app_name/stasis_app_name/ and make it public.



branches/12/res/res_stasis.c
https://reviewboard.asterisk.org/r/3025/#comment19616

Since res_stasis registers its own event sources, you might have a module 
reference problem here. It will bump its own reference count during module 
load. Since the unload won't run until the reference count goes back down to 
zero, and the unregister happens during the unload process, much sadness.


Mostly good. Just a few problems.

- David Lee


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 
   

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

2013-11-21 Thread Mark Michelson

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



branches/12/res/res_stasis_device_state.c
https://reviewboard.asterisk.org/r/3025/#comment19629

This could probably stand to be a lot smaller (like 64 maybe)



branches/12/res/res_stasis_device_state.c
https://reviewboard.asterisk.org/r/3025/#comment19627

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.



branches/12/res/res_stasis_device_state.c
https://reviewboard.asterisk.org/r/3025/#comment19628

ao2_unlink_flags() ignores any OBJ_SEARCH_* flags that are passed into it. 
You can just use ao2_unlink() here instead.



branches/12/res/res_stasis_device_state.c
https://reviewboard.asterisk.org/r/3025/#comment19630

You could save some cycles here by just calling 

ao2_find(device_state_subscriptions, name, OBJ_SEARCH_KEY | OBJ_UNLINK | 
OBJ_NODATA);


- Mark Michelson


On Nov. 21, 2013, 7: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, 7: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

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

2013-11-21 Thread Joshua Colp


 On Nov. 21, 2013, 12:59 a.m., Paul Belanger wrote:
  Thanks for this, I plan to spend some time over the weekend trying this 
  out.  My comments are mostly from the ARIs POV, specifically what is a 
  device in ARI? and is that the same as an endpoint?

I'd akin this more to a virtual generic entity/device. It's not a real 
device, and it's certainly not an endpoint you can dial.


- Joshua


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


On Nov. 20, 2013, 10:25 p.m., Kevin Harwell wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviewboard.asterisk.org/r/3025/
 ---
 
 (Updated Nov. 20, 2013, 10: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 402915 
   branches/12/rest-api/api-docs/events.json 402915 
   branches/12/rest-api/api-docs/device_states.json PRE-CREATION 
   branches/12/rest-api/api-docs/applications.json 402915 
   branches/12/res/stasis/app.c 402915 
   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 402915 
   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 402915 
   branches/12/res/ari/ari_model_validators.c 402915 
   branches/12/res/ari/ari_model_validators.h 402915 
   branches/12/res/ari.make 402915 
   branches/12/main/devicestate.c 402915 
   branches/12/include/asterisk/stasis_app_device_state.h PRE-CREATION 
   branches/12/include/asterisk/stasis_app.h 402915 
   branches/12/include/asterisk/devicestate.h 402915 
 
 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

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

2013-11-21 Thread Kevin Harwell


 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 

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

2013-11-21 Thread Kevin Harwell

---
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.


Changes
---

Addressed review findings.


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 (updated)
-

  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

-- 
_
-- 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

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

2013-11-21 Thread rmudgett


 On Nov. 22, 2013, 12:04 a.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.
 
 Kevin Harwell wrote:
 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.

This is not true.  The OBJ_SEARCH_KEY could be anything you setup the container 
callbacks to take as the key.  The template code on the wiki assumes the key is 
a simple string.

In this case you could pass a struct pointer that contains two string pointers.
struct device_container_key {
  const char *app_name;
  const char *device_name;
}


- rmudgett


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


On Nov. 22, 2013, 12:25 a.m., Kevin Harwell wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviewboard.asterisk.org/r/3025/
 ---
 
 (Updated Nov. 22, 2013, 12:25 a.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
 


-- 
_
-- 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

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

2013-11-21 Thread Kevin Harwell

---
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.


Changes
---

Addressed various review findings.  Also, Added a listing command: GET 
/deviceStates


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 (updated)
-

  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