47 #if defined(AST_DEVMODE)
86 #if defined(AST_DEVMODE)
91 for (i = get_params; i; i = i->
next) {
92 if (strcmp(i->
name,
"lang") == 0) {
95 if (strcmp(i->
name,
"format") == 0) {
105 #if defined(AST_DEVMODE)
110 is_valid = response->
message == NULL;
117 if (200 <= code && code <= 299) {
121 ast_log(LOG_ERROR,
"Invalid error response %d for /sounds\n", code);
127 ast_log(LOG_ERROR,
"Response validation failed for /sounds\n");
129 "Internal Server Error",
"Response validation failed");
133 fin: __attribute__((unused))
152 #if defined(AST_DEVMODE)
157 for (i = path_vars; i; i = i->
next) {
158 if (strcmp(i->
name,
"soundId") == 0) {
164 #if defined(AST_DEVMODE)
169 is_valid = response->
message == NULL;
176 if (200 <= code && code <= 299) {
180 ast_log(LOG_ERROR,
"Invalid error response %d for /sounds/{soundId}\n", code);
186 ast_log(LOG_ERROR,
"Response validation failed for /sounds/{soundId}\n");
188 "Internal Server Error",
"Response validation failed");
192 fin: __attribute__((unused))
216 static int unload_module(
void)
222 static int load_module(
void)
236 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Sound resources",
237 .support_level = AST_MODULE_SUPPORT_CORE,
239 .unload = unload_module,
240 .requires =
"res_ari,res_ari_model,res_stasis",
struct ast_variable * next
Asterisk main include file. File version handling, generic pbx functions.
void ast_ari_sounds_get(struct ast_variable *headers, struct ast_ari_sounds_get_args *args, struct ast_ari_response *response)
Get a sound's details.
void ast_ari_sounds_list(struct ast_variable *headers, struct ast_ari_sounds_list_args *args, struct ast_ari_response *response)
List all sounds.
Structure for variables, used for configurations and for channel variables.
Generated file - declares stubs to be implemented in res/ari/resource_sounds.c.
Generated file - Build validators for ARI model objects.
static struct stasis_rest_handlers sounds_soundId
REST handler for /api-docs/sounds.json.
static void ast_ari_sounds_get_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /sounds/{soundId}.
static void ast_ari_sounds_list_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /sounds.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
int ast_ari_validate_sound(struct ast_json *json)
Validator for Sound.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
describes a server instance
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
Module has failed to load, may be in an inconsistent state.
struct ast_json * message
const char * path_segment
ari_validator ast_ari_validate_sound_fn(void)
Function pointer to ast_ari_validate_sound().
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Abstract JSON element (object, array, string, int, ...).
Stasis Application API. See Stasis Application API for detailed documentation.
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
int ast_ari_sounds_list_parse_body(struct ast_json *body, struct ast_ari_sounds_list_args *args)
Body parsing function for /sounds.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
Handler for a single RESTful path segment.