summaryrefslogtreecommitdiff
path: root/res/res_ari_recordings.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-11-07 21:10:31 +0000
committerDavid M. Lee <dlee@digium.com>2013-11-07 21:10:31 +0000
commit7d0d1a1efb1d484cce28137f1abc1a6ece61d7e9 (patch)
treea61c7891a423ff7a70ae5bb3a5880ba4437702fd /res/res_ari_recordings.c
parentcdfbc02df164a9bc49e23900fae66e696c4623aa (diff)
ari: User better nicknames for ARI operations
While working on building client libraries from the Swagger API, I noticed a problem with the nicknames. channel.deleteChannel() channel.answerChannel() channel.muteChannel() Etc. We put the object name in the nickname (since we were generating C code), but it makes OO generators redundant. This patch makes the nicknames more OO friendly. This resulted in a lot of name changing within the res_ari_*.so modules, but not much else. There were a couple of other fixed I made in the process. * When reversible operations (POST /hold, POST /unhold) were made more RESTful (POST /hold, DELETE /unhold), the path for the second operation was left in the API declaration. This worked, but really the two operations should have been on the same API. * The POST /unmute operation had still not been REST-ified. Review: https://reviewboard.asterisk.org/r/2940/ ........ Merged revisions 402528 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_ari_recordings.c')
-rw-r--r--res/res_ari_recordings.c112
1 files changed, 48 insertions, 64 deletions
diff --git a/res/res_ari_recordings.c b/res/res_ari_recordings.c
index 3f7458324..3a4afdc71 100644
--- a/res/res_ari_recordings.c
+++ b/res/res_ari_recordings.c
@@ -58,17 +58,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_get_stored_recordings_cb(
+static void ast_ari_recordings_list_stored_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_get_stored_recordings_args args = {};
+ struct ast_ari_recordings_list_stored_args args = {};
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- ast_ari_get_stored_recordings(headers, &args, response);
+ ast_ari_recordings_list_stored(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -107,11 +107,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_get_stored_recording_cb(
+static void ast_ari_recordings_get_stored_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_get_stored_recording_args args = {};
+ struct ast_ari_recordings_get_stored_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -124,7 +124,7 @@ static void ast_ari_get_stored_recording_cb(
} else
{}
}
- ast_ari_get_stored_recording(headers, &args, response);
+ ast_ari_recordings_get_stored(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -164,11 +164,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_delete_stored_recording_cb(
+static void ast_ari_recordings_delete_stored_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_delete_stored_recording_args args = {};
+ struct ast_ari_recordings_delete_stored_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -181,7 +181,7 @@ static void ast_ari_delete_stored_recording_cb(
} else
{}
}
- ast_ari_delete_stored_recording(headers, &args, response);
+ ast_ari_recordings_delete_stored(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -221,11 +221,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_get_live_recording_cb(
+static void ast_ari_recordings_get_live_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_get_live_recording_args args = {};
+ struct ast_ari_recordings_get_live_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -238,7 +238,7 @@ static void ast_ari_get_live_recording_cb(
} else
{}
}
- ast_ari_get_live_recording(headers, &args, response);
+ ast_ari_recordings_get_live(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -278,11 +278,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_cancel_recording_cb(
+static void ast_ari_recordings_cancel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_cancel_recording_args args = {};
+ struct ast_ari_recordings_cancel_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -295,7 +295,7 @@ static void ast_ari_cancel_recording_cb(
} else
{}
}
- ast_ari_cancel_recording(headers, &args, response);
+ ast_ari_recordings_cancel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -335,11 +335,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_stop_recording_cb(
+static void ast_ari_recordings_stop_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_stop_recording_args args = {};
+ struct ast_ari_recordings_stop_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -352,7 +352,7 @@ static void ast_ari_stop_recording_cb(
} else
{}
}
- ast_ari_stop_recording(headers, &args, response);
+ ast_ari_recordings_stop(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -392,11 +392,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_pause_recording_cb(
+static void ast_ari_recordings_pause_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_pause_recording_args args = {};
+ struct ast_ari_recordings_pause_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -409,7 +409,7 @@ static void ast_ari_pause_recording_cb(
} else
{}
}
- ast_ari_pause_recording(headers, &args, response);
+ ast_ari_recordings_pause(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -444,17 +444,17 @@ fin: __attribute__((unused))
return;
}
/*!
- * \brief Parameter parsing callback for /recordings/live/{recordingName}/unpause.
+ * \brief Parameter parsing callback for /recordings/live/{recordingName}/pause.
* \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_unpause_recording_cb(
+static void ast_ari_recordings_unpause_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_unpause_recording_args args = {};
+ struct ast_ari_recordings_unpause_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -467,7 +467,7 @@ static void ast_ari_unpause_recording_cb(
} else
{}
}
- ast_ari_unpause_recording(headers, &args, response);
+ ast_ari_recordings_unpause(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -486,13 +486,13 @@ static void ast_ari_unpause_recording_cb(
is_valid = ast_ari_validate_void(
response->message);
} else {
- ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/unpause\n", code);
+ ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/pause\n", code);
is_valid = 0;
}
}
if (!is_valid) {
- ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/unpause\n");
+ ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/pause\n");
ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
@@ -508,11 +508,11 @@ fin: __attribute__((unused))
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void ast_ari_mute_recording_cb(
+static void ast_ari_recordings_mute_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_mute_recording_args args = {};
+ struct ast_ari_recordings_mute_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -525,7 +525,7 @@ static void ast_ari_mute_recording_cb(
} else
{}
}
- ast_ari_mute_recording(headers, &args, response);
+ ast_ari_recordings_mute(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -560,17 +560,17 @@ fin: __attribute__((unused))
return;
}
/*!
- * \brief Parameter parsing callback for /recordings/live/{recordingName}/unmute.
+ * \brief Parameter parsing callback for /recordings/live/{recordingName}/mute.
* \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_unmute_recording_cb(
+static void ast_ari_recordings_unmute_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
- struct ast_unmute_recording_args args = {};
+ struct ast_ari_recordings_unmute_args args = {};
struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
@@ -583,7 +583,7 @@ static void ast_ari_unmute_recording_cb(
} else
{}
}
- ast_ari_unmute_recording(headers, &args, response);
+ ast_ari_recordings_unmute(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -602,13 +602,13 @@ static void ast_ari_unmute_recording_cb(
is_valid = ast_ari_validate_void(
response->message);
} else {
- ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/unmute\n", code);
+ ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/mute\n", code);
is_valid = 0;
}
}
if (!is_valid) {
- ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/unmute\n");
+ ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/mute\n");
ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
@@ -623,8 +623,8 @@ static struct stasis_rest_handlers recordings_stored_recordingName = {
.path_segment = "recordingName",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = ast_ari_get_stored_recording_cb,
- [AST_HTTP_DELETE] = ast_ari_delete_stored_recording_cb,
+ [AST_HTTP_GET] = ast_ari_recordings_get_stored_cb,
+ [AST_HTTP_DELETE] = ast_ari_recordings_delete_stored_cb,
},
.num_children = 0,
.children = { }
@@ -633,7 +633,7 @@ static struct stasis_rest_handlers recordings_stored_recordingName = {
static struct stasis_rest_handlers recordings_stored = {
.path_segment = "stored",
.callbacks = {
- [AST_HTTP_GET] = ast_ari_get_stored_recordings_cb,
+ [AST_HTTP_GET] = ast_ari_recordings_list_stored_cb,
},
.num_children = 1,
.children = { &recordings_stored_recordingName, }
@@ -642,7 +642,7 @@ static struct stasis_rest_handlers recordings_stored = {
static struct stasis_rest_handlers recordings_live_recordingName_stop = {
.path_segment = "stop",
.callbacks = {
- [AST_HTTP_POST] = ast_ari_stop_recording_cb,
+ [AST_HTTP_POST] = ast_ari_recordings_stop_cb,
},
.num_children = 0,
.children = { }
@@ -651,16 +651,8 @@ static struct stasis_rest_handlers recordings_live_recordingName_stop = {
static struct stasis_rest_handlers recordings_live_recordingName_pause = {
.path_segment = "pause",
.callbacks = {
- [AST_HTTP_POST] = ast_ari_pause_recording_cb,
- },
- .num_children = 0,
- .children = { }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_live_recordingName_unpause = {
- .path_segment = "unpause",
- .callbacks = {
- [AST_HTTP_POST] = ast_ari_unpause_recording_cb,
+ [AST_HTTP_POST] = ast_ari_recordings_pause_cb,
+ [AST_HTTP_DELETE] = ast_ari_recordings_unpause_cb,
},
.num_children = 0,
.children = { }
@@ -669,16 +661,8 @@ static struct stasis_rest_handlers recordings_live_recordingName_unpause = {
static struct stasis_rest_handlers recordings_live_recordingName_mute = {
.path_segment = "mute",
.callbacks = {
- [AST_HTTP_POST] = ast_ari_mute_recording_cb,
- },
- .num_children = 0,
- .children = { }
-};
-/*! \brief REST handler for /api-docs/recordings.{format} */
-static struct stasis_rest_handlers recordings_live_recordingName_unmute = {
- .path_segment = "unmute",
- .callbacks = {
- [AST_HTTP_POST] = ast_ari_unmute_recording_cb,
+ [AST_HTTP_POST] = ast_ari_recordings_mute_cb,
+ [AST_HTTP_DELETE] = ast_ari_recordings_unmute_cb,
},
.num_children = 0,
.children = { }
@@ -688,11 +672,11 @@ static struct stasis_rest_handlers recordings_live_recordingName = {
.path_segment = "recordingName",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = ast_ari_get_live_recording_cb,
- [AST_HTTP_DELETE] = ast_ari_cancel_recording_cb,
+ [AST_HTTP_GET] = ast_ari_recordings_get_live_cb,
+ [AST_HTTP_DELETE] = ast_ari_recordings_cancel_cb,
},
- .num_children = 5,
- .children = { &recordings_live_recordingName_stop,&recordings_live_recordingName_pause,&recordings_live_recordingName_unpause,&recordings_live_recordingName_mute,&recordings_live_recordingName_unmute, }
+ .num_children = 3,
+ .children = { &recordings_live_recordingName_stop,&recordings_live_recordingName_pause,&recordings_live_recordingName_mute, }
};
/*! \brief REST handler for /api-docs/recordings.{format} */
static struct stasis_rest_handlers recordings_live = {