47#if defined(AST_DEVMODE)
69#if defined(AST_DEVMODE)
74 for (i = path_vars; i; i = i->
next) {
75 if (strcmp(i->
name,
"configClass") == 0) {
78 if (strcmp(i->
name,
"objectType") == 0) {
81 if (strcmp(i->
name,
"id") == 0) {
87#if defined(AST_DEVMODE)
100 if (200 <= code && code <= 299) {
104 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n", code);
110 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n");
112 "Internal Server Error",
"Response validation failed");
116fin: __attribute__((unused))
143#if defined(AST_DEVMODE)
148 for (i = path_vars; i; i = i->
next) {
149 if (strcmp(i->
name,
"configClass") == 0) {
152 if (strcmp(i->
name,
"objectType") == 0) {
155 if (strcmp(i->
name,
"id") == 0) {
162#if defined(AST_DEVMODE)
177 if (200 <= code && code <= 299) {
181 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n", code);
187 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n");
189 "Internal Server Error",
"Response validation failed");
193fin: __attribute__((unused))
212#if defined(AST_DEVMODE)
217 for (i = path_vars; i; i = i->
next) {
218 if (strcmp(i->
name,
"configClass") == 0) {
221 if (strcmp(i->
name,
"objectType") == 0) {
224 if (strcmp(i->
name,
"id") == 0) {
230#if defined(AST_DEVMODE)
244 if (200 <= code && code <= 299) {
248 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n", code);
254 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/config/dynamic/{configClass}/{objectType}/{id}\n");
256 "Internal Server Error",
"Response validation failed");
260fin: __attribute__((unused))
285 for (i = 0; i <
args->only_count; ++i) {
290 args->only_count = 1;
317#if defined(AST_DEVMODE)
322 for (i = get_params; i; i = i->
next) {
323 if (strcmp(i->
name,
"only") == 0) {
329 if (!
args.only_parse) {
334 if (strlen(
args.only_parse) == 0) {
337 vals[0] =
args.only_parse;
340 args.only_parse,
',', vals,
344 if (
args.only_count == 0) {
352 "Too many values for only");
362 for (j = 0; j <
args.only_count; ++j) {
363 args.only[j] = (vals[j]);
373#if defined(AST_DEVMODE)
385 if (200 <= code && code <= 299) {
397 "Internal Server Error",
"Response validation failed");
401fin: __attribute__((unused))
421#if defined(AST_DEVMODE)
427#if defined(AST_DEVMODE)
439 if (200 <= code && code <= 299) {
451 "Internal Server Error",
"Response validation failed");
455fin: __attribute__((unused))
473#if defined(AST_DEVMODE)
479#if defined(AST_DEVMODE)
491 if (200 <= code && code <= 299) {
495 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/modules\n", code);
503 "Internal Server Error",
"Response validation failed");
507fin: __attribute__((unused))
526#if defined(AST_DEVMODE)
531 for (i = path_vars; i; i = i->
next) {
532 if (strcmp(i->
name,
"moduleName") == 0) {
538#if defined(AST_DEVMODE)
552 if (200 <= code && code <= 299) {
556 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/modules/{moduleName}\n", code);
562 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/modules/{moduleName}\n");
564 "Internal Server Error",
"Response validation failed");
568fin: __attribute__((unused))
587#if defined(AST_DEVMODE)
592 for (i = path_vars; i; i = i->
next) {
593 if (strcmp(i->
name,
"moduleName") == 0) {
599#if defined(AST_DEVMODE)
612 if (200 <= code && code <= 299) {
616 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/modules/{moduleName}\n", code);
622 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/modules/{moduleName}\n");
624 "Internal Server Error",
"Response validation failed");
628fin: __attribute__((unused))
647#if defined(AST_DEVMODE)
652 for (i = path_vars; i; i = i->
next) {
653 if (strcmp(i->
name,
"moduleName") == 0) {
659#if defined(AST_DEVMODE)
673 if (200 <= code && code <= 299) {
677 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/modules/{moduleName}\n", code);
683 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/modules/{moduleName}\n");
685 "Internal Server Error",
"Response validation failed");
689fin: __attribute__((unused))
708#if defined(AST_DEVMODE)
713 for (i = path_vars; i; i = i->
next) {
714 if (strcmp(i->
name,
"moduleName") == 0) {
720#if defined(AST_DEVMODE)
734 if (200 <= code && code <= 299) {
738 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/modules/{moduleName}\n", code);
744 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/modules/{moduleName}\n");
746 "Internal Server Error",
"Response validation failed");
750fin: __attribute__((unused))
768#if defined(AST_DEVMODE)
774#if defined(AST_DEVMODE)
786 if (200 <= code && code <= 299) {
790 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/logging\n", code);
798 "Internal Server Error",
"Response validation failed");
802fin: __attribute__((unused))
834#if defined(AST_DEVMODE)
839 for (i = get_params; i; i = i->
next) {
840 if (strcmp(i->
name,
"configuration") == 0) {
845 for (i = path_vars; i; i = i->
next) {
846 if (strcmp(i->
name,
"logChannelName") == 0) {
856#if defined(AST_DEVMODE)
870 if (200 <= code && code <= 299) {
874 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/logging/{logChannelName}\n", code);
880 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/logging/{logChannelName}\n");
882 "Internal Server Error",
"Response validation failed");
886fin: __attribute__((unused))
905#if defined(AST_DEVMODE)
910 for (i = path_vars; i; i = i->
next) {
911 if (strcmp(i->
name,
"logChannelName") == 0) {
917#if defined(AST_DEVMODE)
930 if (200 <= code && code <= 299) {
934 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/logging/{logChannelName}\n", code);
940 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/logging/{logChannelName}\n");
942 "Internal Server Error",
"Response validation failed");
946fin: __attribute__((unused))
965#if defined(AST_DEVMODE)
970 for (i = path_vars; i; i = i->
next) {
971 if (strcmp(i->
name,
"logChannelName") == 0) {
977#if defined(AST_DEVMODE)
990 if (200 <= code && code <= 299) {
994 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/logging/{logChannelName}/rotate\n", code);
1000 ast_log(
LOG_ERROR,
"Response validation failed for /asterisk/logging/{logChannelName}/rotate\n");
1002 "Internal Server Error",
"Response validation failed");
1006fin: __attribute__((unused))
1038#if defined(AST_DEVMODE)
1043 for (i = get_params; i; i = i->
next) {
1044 if (strcmp(i->
name,
"variable") == 0) {
1054#if defined(AST_DEVMODE)
1067 if (200 <= code && code <= 299) {
1071 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/variable\n", code);
1079 "Internal Server Error",
"Response validation failed");
1083fin: __attribute__((unused))
1119#if defined(AST_DEVMODE)
1124 for (i = get_params; i; i = i->
next) {
1125 if (strcmp(i->
name,
"variable") == 0) {
1128 if (strcmp(i->
name,
"value") == 0) {
1138#if defined(AST_DEVMODE)
1151 if (200 <= code && code <= 299) {
1155 ast_log(
LOG_ERROR,
"Invalid error response %d for /asterisk/variable\n", code);
1163 "Internal Server Error",
"Response validation failed");
1167fin: __attribute__((unused))
1329 .
requires =
"res_ari,res_ari_model,res_stasis",
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.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
int ast_ari_validate_variable(struct ast_json *json)
Validator for Variable.
int ast_ari_validate_module(struct ast_json *json)
Validator for Module.
ari_validator ast_ari_validate_config_tuple_fn(void)
Function pointer to ast_ari_validate_config_tuple().
int ast_ari_validate_asterisk_info(struct ast_json *json)
Validator for AsteriskInfo.
int ast_ari_validate_asterisk_ping(struct ast_json *json)
Validator for AsteriskPing.
ari_validator ast_ari_validate_log_channel_fn(void)
Function pointer to ast_ari_validate_log_channel().
ari_validator ast_ari_validate_module_fn(void)
Function pointer to ast_ari_validate_module().
Generated file - Build validators for ARI model objects.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_malloc(len)
A wrapper for malloc()
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define ast_app_separate_args(a, b, c, d)
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static struct stasis_rest_handlers asterisk_logging_logChannelName_rotate
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk_config_dynamic
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk_config_dynamic_configClass
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_reload_module_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 /asterisk/modules/{moduleName}.
static struct stasis_rest_handlers asterisk_logging
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_update_object_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 /asterisk/config/dynamic/{configClass}/{objectType}/{id}.
static void ast_ari_asterisk_delete_object_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 /asterisk/config/dynamic/{configClass}/{objectType}/{id}.
static struct stasis_rest_handlers asterisk_ping
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_unload_module_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 /asterisk/modules/{moduleName}.
static struct stasis_rest_handlers asterisk_config_dynamic_configClass_objectType_id
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk_modules_moduleName
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_get_object_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 /asterisk/config/dynamic/{configClass}/{objectType}/{id}.
static void ast_ari_asterisk_list_modules_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 /asterisk/modules.
static void ast_ari_asterisk_list_log_channels_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 /asterisk/logging.
static struct stasis_rest_handlers asterisk_modules
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_delete_log_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 /asterisk/logging/{logChannelName}.
int ast_ari_asterisk_add_log_parse_body(struct ast_json *body, struct ast_ari_asterisk_add_log_args *args)
Body parsing function for /asterisk/logging/{logChannelName}.
int ast_ari_asterisk_get_global_var_parse_body(struct ast_json *body, struct ast_ari_asterisk_get_global_var_args *args)
Body parsing function for /asterisk/variable.
static void ast_ari_asterisk_ping_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 /asterisk/ping.
static void ast_ari_asterisk_rotate_log_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 /asterisk/logging/{logChannelName}/rotate.
int ast_ari_asterisk_get_info_parse_body(struct ast_json *body, struct ast_ari_asterisk_get_info_args *args)
Body parsing function for /asterisk/info.
static struct stasis_rest_handlers asterisk_info
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk_logging_logChannelName
REST handler for /api-docs/asterisk.json.
static void ast_ari_asterisk_get_module_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 /asterisk/modules/{moduleName}.
static void ast_ari_asterisk_get_info_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 /asterisk/info.
static struct stasis_rest_handlers asterisk_variable
REST handler for /api-docs/asterisk.json.
static int load_module(void)
int ast_ari_asterisk_set_global_var_parse_body(struct ast_json *body, struct ast_ari_asterisk_set_global_var_args *args)
Body parsing function for /asterisk/variable.
static int unload_module(void)
static void ast_ari_asterisk_add_log_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 /asterisk/logging/{logChannelName}.
static void ast_ari_asterisk_load_module_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 /asterisk/modules/{moduleName}.
static void ast_ari_asterisk_get_global_var_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 /asterisk/variable.
int ast_ari_asterisk_update_object_parse_body(struct ast_json *body, struct ast_ari_asterisk_update_object_args *args)
Body parsing function for /asterisk/config/dynamic/{configClass}/{objectType}/{id}.
static void ast_ari_asterisk_set_global_var_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 /asterisk/variable.
static struct stasis_rest_handlers asterisk_config_dynamic_configClass_objectType
REST handler for /api-docs/asterisk.json.
static struct stasis_rest_handlers asterisk_config
REST handler for /api-docs/asterisk.json.
void ast_ari_asterisk_unload_module(struct ast_variable *headers, struct ast_ari_asterisk_unload_module_args *args, struct ast_ari_response *response)
Unload an Asterisk module.
void ast_ari_asterisk_set_global_var(struct ast_variable *headers, struct ast_ari_asterisk_set_global_var_args *args, struct ast_ari_response *response)
Set the value of a global variable.
void ast_ari_asterisk_get_global_var(struct ast_variable *headers, struct ast_ari_asterisk_get_global_var_args *args, struct ast_ari_response *response)
Get the value of a global variable.
void ast_ari_asterisk_delete_object(struct ast_variable *headers, struct ast_ari_asterisk_delete_object_args *args, struct ast_ari_response *response)
Delete a dynamic configuration object.
void ast_ari_asterisk_get_module(struct ast_variable *headers, struct ast_ari_asterisk_get_module_args *args, struct ast_ari_response *response)
Get Asterisk module information.
void ast_ari_asterisk_rotate_log(struct ast_variable *headers, struct ast_ari_asterisk_rotate_log_args *args, struct ast_ari_response *response)
Rotates a log channel.
void ast_ari_asterisk_add_log(struct ast_variable *headers, struct ast_ari_asterisk_add_log_args *args, struct ast_ari_response *response)
Adds a log channel.
void ast_ari_asterisk_ping(struct ast_variable *headers, struct ast_ari_asterisk_ping_args *args, struct ast_ari_response *response)
Response pong message.
void ast_ari_asterisk_update_object(struct ast_variable *headers, struct ast_ari_asterisk_update_object_args *args, struct ast_ari_response *response)
Create or update a dynamic configuration object.
void ast_ari_asterisk_get_info(struct ast_variable *headers, struct ast_ari_asterisk_get_info_args *args, struct ast_ari_response *response)
Gets Asterisk system information.
void ast_ari_asterisk_delete_log(struct ast_variable *headers, struct ast_ari_asterisk_delete_log_args *args, struct ast_ari_response *response)
Deletes a log channel.
void ast_ari_asterisk_load_module(struct ast_variable *headers, struct ast_ari_asterisk_load_module_args *args, struct ast_ari_response *response)
Load an Asterisk module.
void ast_ari_asterisk_reload_module(struct ast_variable *headers, struct ast_ari_asterisk_reload_module_args *args, struct ast_ari_response *response)
Reload an Asterisk module.
void ast_ari_asterisk_list_modules(struct ast_variable *headers, struct ast_ari_asterisk_list_modules_args *args, struct ast_ari_response *response)
List Asterisk modules.
void ast_ari_asterisk_list_log_channels(struct ast_variable *headers, struct ast_ari_asterisk_list_log_channels_args *args, struct ast_ari_response *response)
Gets Asterisk log channel information.
void ast_ari_asterisk_get_object(struct ast_variable *headers, struct ast_ari_asterisk_get_object_args *args, struct ast_ari_response *response)
Retrieve a dynamic configuration object.
Generated file - declares stubs to be implemented in res/ari/resource_asterisk.c.
Stasis Application API. See Stasis Application API for detailed documentation.
struct ast_json * message
Abstract JSON element (object, array, string, int, ...).
describes a server instance
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Handler for a single RESTful path segment.
const char * path_segment