47 #if defined(AST_DEVMODE)
68 #if defined(AST_DEVMODE)
74 #if defined(AST_DEVMODE)
79 is_valid = response->
message == NULL;
86 if (200 <= code && code <= 299) {
90 ast_log(LOG_ERROR,
"Invalid error response %d for /applications\n", code);
96 ast_log(LOG_ERROR,
"Response validation failed for /applications\n");
98 "Internal Server Error",
"Response validation failed");
102 fin: __attribute__((unused))
121 #if defined(AST_DEVMODE)
126 for (i = path_vars; i; i = i->
next) {
127 if (strcmp(i->
name,
"applicationName") == 0) {
133 #if defined(AST_DEVMODE)
138 is_valid = response->
message == NULL;
146 if (200 <= code && code <= 299) {
150 ast_log(LOG_ERROR,
"Invalid error response %d for /applications/{applicationName}\n", code);
156 ast_log(LOG_ERROR,
"Response validation failed for /applications/{applicationName}\n");
158 "Internal Server Error",
"Response validation failed");
162 fin: __attribute__((unused))
219 #if defined(AST_DEVMODE)
224 for (i = get_params; i; i = i->
next) {
225 if (strcmp(i->
name,
"eventSource") == 0) {
227 char *vals[MAX_VALS];
254 "Too many values for event_source");
270 for (i = path_vars; i; i = i->
next) {
271 if (strcmp(i->
name,
"applicationName") == 0) {
281 #if defined(AST_DEVMODE)
286 is_valid = response->
message == NULL;
296 if (200 <= code && code <= 299) {
300 ast_log(LOG_ERROR,
"Invalid error response %d for /applications/{applicationName}/subscription\n", code);
306 ast_log(LOG_ERROR,
"Response validation failed for /applications/{applicationName}/subscription\n");
308 "Internal Server Error",
"Response validation failed");
312 fin: __attribute__((unused))
371 #if defined(AST_DEVMODE)
376 for (i = get_params; i; i = i->
next) {
377 if (strcmp(i->
name,
"eventSource") == 0) {
379 char *vals[MAX_VALS];
406 "Too many values for event_source");
422 for (i = path_vars; i; i = i->
next) {
423 if (strcmp(i->
name,
"applicationName") == 0) {
433 #if defined(AST_DEVMODE)
438 is_valid = response->
message == NULL;
449 if (200 <= code && code <= 299) {
453 ast_log(LOG_ERROR,
"Invalid error response %d for /applications/{applicationName}/subscription\n", code);
459 ast_log(LOG_ERROR,
"Response validation failed for /applications/{applicationName}/subscription\n");
461 "Internal Server Error",
"Response validation failed");
465 fin: __attribute__((unused))
494 #if defined(AST_DEVMODE)
499 for (i = path_vars; i; i = i->
next) {
500 if (strcmp(i->
name,
"applicationName") == 0) {
507 #if defined(AST_DEVMODE)
512 is_valid = response->
message == NULL;
521 if (200 <= code && code <= 299) {
525 ast_log(LOG_ERROR,
"Invalid error response %d for /applications/{applicationName}/eventFilter\n", code);
531 ast_log(LOG_ERROR,
"Response validation failed for /applications/{applicationName}/eventFilter\n");
533 "Internal Server Error",
"Response validation failed");
537 fin: __attribute__((unused))
580 static int unload_module(
void)
586 static int load_module(
void)
600 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Stasis application resources",
601 .support_level = AST_MODULE_SUPPORT_CORE,
603 .unload = unload_module,
604 .requires =
"res_ari,res_ari_model,res_stasis",
struct ast_variable * next
Asterisk main include file. File version handling, generic pbx functions.
static void ast_ari_applications_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 /applications.
static struct stasis_rest_handlers applications_applicationName_eventFilter
REST handler for /api-docs/applications.json.
const char * application_name
void ast_ari_applications_list(struct ast_variable *headers, struct ast_ari_applications_list_args *args, struct ast_ari_response *response)
List all applications.
char * event_source_parse
Structure for variables, used for configurations and for channel variables.
char * event_source_parse
void ast_ari_applications_unsubscribe(struct ast_variable *headers, struct ast_ari_applications_unsubscribe_args *args, struct ast_ari_response *response)
Unsubscribe an application from an event source.
static struct stasis_rest_handlers applications
REST handler for /api-docs/applications.json.
static void ast_ari_applications_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 /applications/{applicationName}.
Generated file - Build validators for ARI model objects.
#define ast_strdup(str)
A wrapper for strdup()
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
void ast_ari_applications_get(struct ast_variable *headers, struct ast_ari_applications_get_args *args, struct ast_ari_response *response)
Get details of an application.
void ast_ari_applications_subscribe(struct ast_variable *headers, struct ast_ari_applications_subscribe_args *args, struct ast_ari_response *response)
Subscribe an application to a event source.
const char ** event_source
size_t event_source_count
int ast_ari_applications_filter_parse_body(struct ast_json *body, struct ast_ari_applications_filter_args *args)
Body parsing function for /applications/{applicationName}/eventFilter.
ari_validator ast_ari_validate_application_fn(void)
Function pointer to ast_ari_validate_application().
int ast_ari_applications_subscribe_parse_body(struct ast_json *body, struct ast_ari_applications_subscribe_args *args)
Body parsing function for /applications/{applicationName}/subscription.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
#define ast_malloc(len)
A wrapper for malloc()
describes a server instance
static void ast_ari_applications_unsubscribe_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 /applications/{applicationName}/subscription.
static void ast_ari_applications_filter_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 /applications/{applicationName}/eventFilter.
int ast_ari_applications_unsubscribe_parse_body(struct ast_json *body, struct ast_ari_applications_unsubscribe_args *args)
Body parsing function for /applications/{applicationName}/subscription.
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
static struct stasis_rest_handlers applications_applicationName_subscription
REST handler for /api-docs/applications.json.
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.
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
Module has failed to load, may be in an inconsistent state.
struct ast_json * message
int ast_ari_validate_application(struct ast_json *json)
Validator for Application.
const char * application_name
const char * path_segment
static struct stasis_rest_handlers applications_applicationName
REST handler for /api-docs/applications.json.
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.
Abstract JSON element (object, array, string, int, ...).
Generated file - declares stubs to be implemented in res/ari/resource_applications.c.
Stasis Application API. See Stasis Application API for detailed documentation.
const char ** event_source
const char * application_name
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
size_t event_source_count
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static void ast_ari_applications_subscribe_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 /applications/{applicationName}/subscription.
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
Handler for a single RESTful path segment.
void ast_ari_applications_filter(struct ast_variable *headers, struct ast_ari_applications_filter_args *args, struct ast_ari_response *response)
Filter application events types.
const char * application_name