mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
ARI playback: Rename ARI Playback to Playbacks
Before playback was the only non plural resource. It has been renamed to playbacks for consistency. (closes issue ASTERISK-22737) Reported by: Paul Belanger ........ Merged revisions 402560 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -41,9 +41,9 @@ res_ari_sounds.so: ari/resource_sounds.o
|
||||
|
||||
ari/resource_sounds.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_sounds)
|
||||
|
||||
res_ari_playback.so: ari/resource_playback.o
|
||||
res_ari_playbacks.so: ari/resource_playbacks.o
|
||||
|
||||
ari/resource_playback.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_playback)
|
||||
ari/resource_playbacks.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_playbacks)
|
||||
|
||||
res_ari_events.so: ari/resource_events.o
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
/*! \file
|
||||
*
|
||||
* \brief /api-docs/playback.{format} implementation- Playback control resources
|
||||
* \brief /api-docs/playbacks.{format} implementation- Playback control resources
|
||||
*
|
||||
* \author David M. Lee, II <dlee@digium.com>
|
||||
*/
|
||||
@@ -28,10 +28,10 @@
|
||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#include "asterisk/stasis_app_playback.h"
|
||||
#include "resource_playback.h"
|
||||
#include "resource_playbacks.h"
|
||||
|
||||
void ast_ari_playback_get(struct ast_variable *headers,
|
||||
struct ast_ari_playback_get_args *args,
|
||||
void ast_ari_playbacks_get(struct ast_variable *headers,
|
||||
struct ast_ari_playbacks_get_args *args,
|
||||
struct ast_ari_response *response)
|
||||
{
|
||||
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
|
||||
@@ -53,8 +53,8 @@ void ast_ari_playback_get(struct ast_variable *headers,
|
||||
|
||||
ast_ari_response_ok(response, ast_json_ref(json));
|
||||
}
|
||||
void ast_ari_playback_stop(struct ast_variable *headers,
|
||||
struct ast_ari_playback_stop_args *args,
|
||||
void ast_ari_playbacks_stop(struct ast_variable *headers,
|
||||
struct ast_ari_playbacks_stop_args *args,
|
||||
struct ast_ari_response *response)
|
||||
{
|
||||
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
|
||||
@@ -84,8 +84,8 @@ void ast_ari_playback_stop(struct ast_variable *headers,
|
||||
return;
|
||||
}
|
||||
}
|
||||
void ast_ari_playback_control(struct ast_variable *headers,
|
||||
struct ast_ari_playback_control_args *args,
|
||||
void ast_ari_playbacks_control(struct ast_variable *headers,
|
||||
struct ast_ari_playbacks_control_args *args,
|
||||
struct ast_ari_response *response)
|
||||
{
|
||||
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
|
@@ -40,7 +40,7 @@
|
||||
#include "asterisk/ari.h"
|
||||
|
||||
/*! \brief Argument struct for ast_ari_playback_get() */
|
||||
struct ast_ari_playback_get_args {
|
||||
struct ast_ari_playbacks_get_args {
|
||||
/*! \brief Playback's id */
|
||||
const char *playback_id;
|
||||
};
|
||||
@@ -51,9 +51,9 @@ struct ast_ari_playback_get_args {
|
||||
* \param args Swagger parameters
|
||||
* \param[out] response HTTP response
|
||||
*/
|
||||
void ast_ari_playback_get(struct ast_variable *headers, struct ast_ari_playback_get_args *args, struct ast_ari_response *response);
|
||||
void ast_ari_playbacks_get(struct ast_variable *headers, struct ast_ari_playbacks_get_args *args, struct ast_ari_response *response);
|
||||
/*! \brief Argument struct for ast_ari_playback_stop() */
|
||||
struct ast_ari_playback_stop_args {
|
||||
struct ast_ari_playbacks_stop_args {
|
||||
/*! \brief Playback's id */
|
||||
const char *playback_id;
|
||||
};
|
||||
@@ -64,9 +64,9 @@ struct ast_ari_playback_stop_args {
|
||||
* \param args Swagger parameters
|
||||
* \param[out] response HTTP response
|
||||
*/
|
||||
void ast_ari_playback_stop(struct ast_variable *headers, struct ast_ari_playback_stop_args *args, struct ast_ari_response *response);
|
||||
void ast_ari_playbacks_stop(struct ast_variable *headers, struct ast_ari_playbacks_stop_args *args, struct ast_ari_response *response);
|
||||
/*! \brief Argument struct for ast_ari_playback_control() */
|
||||
struct ast_ari_playback_control_args {
|
||||
struct ast_ari_playbacks_control_args {
|
||||
/*! \brief Playback's id */
|
||||
const char *playback_id;
|
||||
/*! \brief Operation to perform on the playback. */
|
||||
@@ -79,6 +79,6 @@ struct ast_ari_playback_control_args {
|
||||
* \param args Swagger parameters
|
||||
* \param[out] response HTTP response
|
||||
*/
|
||||
void ast_ari_playback_control(struct ast_variable *headers, struct ast_ari_playback_control_args *args, struct ast_ari_response *response);
|
||||
void ast_ari_playbacks_control(struct ast_variable *headers, struct ast_ari_playbacks_control_args *args, struct ast_ari_response *response);
|
||||
|
||||
#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
|
@@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/stasis_app.h"
|
||||
#include "ari/resource_playback.h"
|
||||
#include "ari/resource_playbacks.h"
|
||||
#if defined(AST_DEVMODE)
|
||||
#include "ari/ari_model_validators.h"
|
||||
#endif
|
||||
@@ -52,17 +52,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#define MAX_VALS 128
|
||||
|
||||
/*!
|
||||
* \brief Parameter parsing callback for /playback/{playbackId}.
|
||||
* \brief Parameter parsing callback for /playbacks/{playbackId}.
|
||||
* \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_playback_get_cb(
|
||||
static void ast_ari_playbacks_get_cb(
|
||||
struct ast_variable *get_params, struct ast_variable *path_vars,
|
||||
struct ast_variable *headers, struct ast_ari_response *response)
|
||||
{
|
||||
struct ast_ari_playback_get_args args = {};
|
||||
struct ast_ari_playbacks_get_args args = {};
|
||||
struct ast_variable *i;
|
||||
#if defined(AST_DEVMODE)
|
||||
int is_valid;
|
||||
@@ -75,7 +75,7 @@ static void ast_ari_playback_get_cb(
|
||||
} else
|
||||
{}
|
||||
}
|
||||
ast_ari_playback_get(headers, &args, response);
|
||||
ast_ari_playbacks_get(headers, &args, response);
|
||||
#if defined(AST_DEVMODE)
|
||||
code = response->response_code;
|
||||
|
||||
@@ -93,13 +93,13 @@ static void ast_ari_playback_get_cb(
|
||||
is_valid = ast_ari_validate_playback(
|
||||
response->message);
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}\n", code);
|
||||
is_valid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_valid) {
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}\n");
|
||||
ast_ari_response_error(response, 500,
|
||||
"Internal Server Error", "Response validation failed");
|
||||
}
|
||||
@@ -109,17 +109,17 @@ fin: __attribute__((unused))
|
||||
return;
|
||||
}
|
||||
/*!
|
||||
* \brief Parameter parsing callback for /playback/{playbackId}.
|
||||
* \brief Parameter parsing callback for /playbacks/{playbackId}.
|
||||
* \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_playback_stop_cb(
|
||||
static void ast_ari_playbacks_stop_cb(
|
||||
struct ast_variable *get_params, struct ast_variable *path_vars,
|
||||
struct ast_variable *headers, struct ast_ari_response *response)
|
||||
{
|
||||
struct ast_ari_playback_stop_args args = {};
|
||||
struct ast_ari_playbacks_stop_args args = {};
|
||||
struct ast_variable *i;
|
||||
#if defined(AST_DEVMODE)
|
||||
int is_valid;
|
||||
@@ -132,7 +132,7 @@ static void ast_ari_playback_stop_cb(
|
||||
} else
|
||||
{}
|
||||
}
|
||||
ast_ari_playback_stop(headers, &args, response);
|
||||
ast_ari_playbacks_stop(headers, &args, response);
|
||||
#if defined(AST_DEVMODE)
|
||||
code = response->response_code;
|
||||
|
||||
@@ -150,13 +150,13 @@ static void ast_ari_playback_stop_cb(
|
||||
is_valid = ast_ari_validate_void(
|
||||
response->message);
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}\n", code);
|
||||
is_valid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_valid) {
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}\n");
|
||||
ast_ari_response_error(response, 500,
|
||||
"Internal Server Error", "Response validation failed");
|
||||
}
|
||||
@@ -166,17 +166,17 @@ fin: __attribute__((unused))
|
||||
return;
|
||||
}
|
||||
/*!
|
||||
* \brief Parameter parsing callback for /playback/{playbackId}/control.
|
||||
* \brief Parameter parsing callback for /playbacks/{playbackId}/control.
|
||||
* \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_playback_control_cb(
|
||||
static void ast_ari_playbacks_control_cb(
|
||||
struct ast_variable *get_params, struct ast_variable *path_vars,
|
||||
struct ast_variable *headers, struct ast_ari_response *response)
|
||||
{
|
||||
struct ast_ari_playback_control_args args = {};
|
||||
struct ast_ari_playbacks_control_args args = {};
|
||||
struct ast_variable *i;
|
||||
#if defined(AST_DEVMODE)
|
||||
int is_valid;
|
||||
@@ -195,7 +195,7 @@ static void ast_ari_playback_control_cb(
|
||||
} else
|
||||
{}
|
||||
}
|
||||
ast_ari_playback_control(headers, &args, response);
|
||||
ast_ari_playbacks_control(headers, &args, response);
|
||||
#if defined(AST_DEVMODE)
|
||||
code = response->response_code;
|
||||
|
||||
@@ -215,13 +215,13 @@ static void ast_ari_playback_control_cb(
|
||||
is_valid = ast_ari_validate_void(
|
||||
response->message);
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}/control\n", code);
|
||||
ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}/control\n", code);
|
||||
is_valid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_valid) {
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}/control\n");
|
||||
ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}/control\n");
|
||||
ast_ari_response_error(response, 500,
|
||||
"Internal Server Error", "Response validation failed");
|
||||
}
|
||||
@@ -231,46 +231,46 @@ fin: __attribute__((unused))
|
||||
return;
|
||||
}
|
||||
|
||||
/*! \brief REST handler for /api-docs/playback.{format} */
|
||||
static struct stasis_rest_handlers playback_playbackId_control = {
|
||||
/*! \brief REST handler for /api-docs/playbacks.{format} */
|
||||
static struct stasis_rest_handlers playbacks_playbackId_control = {
|
||||
.path_segment = "control",
|
||||
.callbacks = {
|
||||
[AST_HTTP_POST] = ast_ari_playback_control_cb,
|
||||
[AST_HTTP_POST] = ast_ari_playbacks_control_cb,
|
||||
},
|
||||
.num_children = 0,
|
||||
.children = { }
|
||||
};
|
||||
/*! \brief REST handler for /api-docs/playback.{format} */
|
||||
static struct stasis_rest_handlers playback_playbackId = {
|
||||
/*! \brief REST handler for /api-docs/playbacks.{format} */
|
||||
static struct stasis_rest_handlers playbacks_playbackId = {
|
||||
.path_segment = "playbackId",
|
||||
.is_wildcard = 1,
|
||||
.callbacks = {
|
||||
[AST_HTTP_GET] = ast_ari_playback_get_cb,
|
||||
[AST_HTTP_DELETE] = ast_ari_playback_stop_cb,
|
||||
[AST_HTTP_GET] = ast_ari_playbacks_get_cb,
|
||||
[AST_HTTP_DELETE] = ast_ari_playbacks_stop_cb,
|
||||
},
|
||||
.num_children = 1,
|
||||
.children = { &playback_playbackId_control, }
|
||||
.children = { &playbacks_playbackId_control, }
|
||||
};
|
||||
/*! \brief REST handler for /api-docs/playback.{format} */
|
||||
static struct stasis_rest_handlers playback = {
|
||||
.path_segment = "playback",
|
||||
/*! \brief REST handler for /api-docs/playbacks.{format} */
|
||||
static struct stasis_rest_handlers playbacks = {
|
||||
.path_segment = "playbacks",
|
||||
.callbacks = {
|
||||
},
|
||||
.num_children = 1,
|
||||
.children = { &playback_playbackId, }
|
||||
.children = { &playbacks_playbackId, }
|
||||
};
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
int res = 0;
|
||||
stasis_app_ref();
|
||||
res |= ast_ari_add_handler(&playback);
|
||||
res |= ast_ari_add_handler(&playbacks);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
ast_ari_remove_handler(&playback);
|
||||
ast_ari_remove_handler(&playbacks);
|
||||
stasis_app_unref();
|
||||
return 0;
|
||||
}
|
@@ -5,10 +5,10 @@
|
||||
"apiVersion": "0.0.1",
|
||||
"swaggerVersion": "1.1",
|
||||
"basePath": "http://localhost:8088/stasis",
|
||||
"resourcePath": "/api-docs/playback.{format}",
|
||||
"resourcePath": "/api-docs/playbacks.{format}",
|
||||
"apis": [
|
||||
{
|
||||
"path": "/playback/{playbackId}",
|
||||
"path": "/playbacks/{playbackId}",
|
||||
"description": "Control object for a playback operation.",
|
||||
"operations": [
|
||||
{
|
||||
@@ -58,7 +58,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/playback/{playbackId}/control",
|
||||
"path": "/playbacks/{playbackId}/control",
|
||||
"description": "Control object for a playback operation.",
|
||||
"operations": [
|
||||
{
|
@@ -31,7 +31,7 @@
|
||||
"description": "Sound resources"
|
||||
},
|
||||
{
|
||||
"path": "/api-docs/playback.{format}",
|
||||
"path": "/api-docs/playbacks.{format}",
|
||||
"description": "Playback control resources"
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user