From ed483779946553e2ec42472c6b665b86dcb07066 Mon Sep 17 00:00:00 2001 From: Kevin Harwell Date: Sat, 23 Nov 2013 17:48:28 +0000 Subject: ARI: Implement device state API 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: Create/Change the state of an ARI controlled device PUT /deviceStates/{deviceName}&{deviceState} Retrieve all ARI controlled devices GET /deviceStates Retrieve the current state of a device GET /deviceStates/{deviceName} Destroy a device-state controlled by ARI DELETE /deviceStates/{deviceName} 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. (issue ASTERISK-22838) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3025/ ........ Merged revisions 403134 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403135 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/ari/ari_model_validators.h | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'res/ari/ari_model_validators.h') diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h index a1e5b099e..979fa4a47 100644 --- a/res/ari/ari_model_validators.h +++ b/res/ari/ari_model_validators.h @@ -480,6 +480,24 @@ int ast_ari_validate_playback(struct ast_json *json); */ ari_validator ast_ari_validate_playback_fn(void); +/*! + * \brief Validator for DeviceState. + * + * Represents the state of a device. + * + * \param json JSON object to validate. + * \returns True (non-zero) if valid. + * \returns False (zero) if invalid. + */ +int ast_ari_validate_device_state(struct ast_json *json); + +/*! + * \brief Function pointer to ast_ari_validate_device_state(). + * + * See \ref ast_ari_model_validators.h for more details. + */ +ari_validator ast_ari_validate_device_state_fn(void); + /*! * \brief Validator for ApplicationReplaced. * @@ -754,6 +772,24 @@ int ast_ari_validate_channel_varset(struct ast_json *json); */ ari_validator ast_ari_validate_channel_varset_fn(void); +/*! + * \brief Validator for DeviceStateChanged. + * + * Notification that a device state has changed. + * + * \param json JSON object to validate. + * \returns True (non-zero) if valid. + * \returns False (zero) if invalid. + */ +int ast_ari_validate_device_state_changed(struct ast_json *json); + +/*! + * \brief Function pointer to ast_ari_validate_device_state_changed(). + * + * See \ref ast_ari_model_validators.h for more details. + */ +ari_validator ast_ari_validate_device_state_changed_fn(void); + /*! * \brief Validator for EndpointStateChange. * @@ -1052,6 +1088,9 @@ ari_validator ast_ari_validate_application_fn(void); * - media_uri: string (required) * - state: string (required) * - target_uri: string (required) + * DeviceState + * - name: string (required) + * - state: string (required) * ApplicationReplaced * - type: string (required) * - application: string (required) @@ -1143,6 +1182,11 @@ ari_validator ast_ari_validate_application_fn(void); * - channel: Channel * - value: string (required) * - variable: string (required) + * DeviceStateChanged + * - type: string (required) + * - application: string (required) + * - timestamp: Date + * - device_state: DeviceState (required) * EndpointStateChange * - type: string (required) * - application: string (required) @@ -1187,6 +1231,7 @@ ari_validator ast_ari_validate_application_fn(void); * Application * - bridge_ids: List[string] (required) * - channel_ids: List[string] (required) + * - device_names: List[string] (required) * - endpoint_ids: List[string] (required) * - name: string (required) */ -- cgit v1.2.3