summaryrefslogtreecommitdiff
path: root/res/res_ari_recordings.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-08-30 13:28:50 +0000
committerDavid M. Lee <dlee@digium.com>2013-08-30 13:28:50 +0000
commit7f547872e41ee53ad85a5b0820a8c0ff7c7f1c04 (patch)
treea86c66df9f37f9de9ffc4f3db3c19de51cb4046a /res/res_ari_recordings.c
parent51cd0ea28b143d6b686831b101e76a942fbbcd90 (diff)
ARI: Implement /recordings/stored API's
his patch implements the ARI API's for stored recordings. While the original task only specified deleting a recording, it was simple enough to implement the GET for all recordings, and for an individual recording. The recording playback operation was modified to use the same code for accessing the recording as the REST API, so that they will behave consistently. There were several problems with the api-docs that were also fixed, bringing the ARI spec in line with the implementation. There were some 'wishful thinking' fields on the stored recording model (duration and timestamp) that were removed, because I ended up not implementing a metadata file to go along with the recording to store such information. The GET /recordings/live operation was removed, since it's not really that useful to get a list of all recordings that are currently going on in the system. (At least, if we did that, we'd probably want to also list all of the current playbacks. Which seems weird.) (closes issue ASTERISK-21582) Review: https://reviewboard.asterisk.org/r/2693/ ........ Merged revisions 397985 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397988 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_ari_recordings.c')
-rw-r--r--res/res_ari_recordings.c52
1 files changed, 2 insertions, 50 deletions
diff --git a/res/res_ari_recordings.c b/res/res_ari_recordings.c
index 77fc830cf..3f7458324 100644
--- a/res/res_ari_recordings.c
+++ b/res/res_ari_recordings.c
@@ -134,6 +134,7 @@ static void ast_ari_get_stored_recording_cb(
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -190,6 +191,7 @@ static void ast_ari_delete_stored_recording_cb(
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -213,55 +215,6 @@ fin: __attribute__((unused))
return;
}
/*!
- * \brief Parameter parsing callback for /recordings/live.
- * \param get_params GET parameters in the HTTP request.
- * \param path_vars Path variables extracted from the request.
- * \param headers HTTP headers.
- * \param[out] response Response to the HTTP request.
- */
-static void ast_ari_get_live_recordings_cb(
- struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
-{
- struct ast_get_live_recordings_args args = {};
-#if defined(AST_DEVMODE)
- int is_valid;
- int code;
-#endif /* AST_DEVMODE */
-
- ast_ari_get_live_recordings(headers, &args, response);
-#if defined(AST_DEVMODE)
- code = response->response_code;
-
- switch (code) {
- case 0: /* Implementation is still a stub, or the code wasn't set */
- is_valid = response->message == NULL;
- break;
- case 500: /* Internal Server Error */
- case 501: /* Not Implemented */
- is_valid = 1;
- break;
- default:
- if (200 <= code && code <= 299) {
- is_valid = ast_ari_validate_list(response->message,
- ast_ari_validate_live_recording_fn());
- } else {
- ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live\n", code);
- is_valid = 0;
- }
- }
-
- if (!is_valid) {
- ast_log(LOG_ERROR, "Response validation failed for /recordings/live\n");
- ast_ari_response_error(response, 500,
- "Internal Server Error", "Response validation failed");
- }
-#endif /* AST_DEVMODE */
-
-fin: __attribute__((unused))
- return;
-}
-/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}.
* \param get_params GET parameters in the HTTP request.
* \param path_vars Path variables extracted from the request.
@@ -745,7 +698,6 @@ static struct stasis_rest_handlers recordings_live_recordingName = {
static struct stasis_rest_handlers recordings_live = {
.path_segment = "live",
.callbacks = {
- [AST_HTTP_GET] = ast_ari_get_live_recordings_cb,
},
.num_children = 1,
.children = { &recordings_live_recordingName, }