48 #if defined(AST_DEVMODE)
69 #if defined(AST_DEVMODE)
75 #if defined(AST_DEVMODE)
80 is_valid = response->
message == NULL;
87 if (200 <= code && code <= 299) {
91 ast_log(LOG_ERROR,
"Invalid error response %d for /mailboxes\n", code);
97 ast_log(LOG_ERROR,
"Response validation failed for /mailboxes\n");
99 "Internal Server Error",
"Response validation failed");
103 fin: __attribute__((unused))
122 #if defined(AST_DEVMODE)
127 for (i = path_vars; i; i = i->
next) {
128 if (strcmp(i->
name,
"mailboxName") == 0) {
134 #if defined(AST_DEVMODE)
139 is_valid = response->
message == NULL;
147 if (200 <= code && code <= 299) {
151 ast_log(LOG_ERROR,
"Invalid error response %d for /mailboxes/{mailboxName}\n", code);
157 ast_log(LOG_ERROR,
"Response validation failed for /mailboxes/{mailboxName}\n");
159 "Internal Server Error",
"Response validation failed");
163 fin: __attribute__((unused))
199 #if defined(AST_DEVMODE)
204 for (i = get_params; i; i = i->
next) {
205 if (strcmp(i->
name,
"oldMessages") == 0) {
208 if (strcmp(i->
name,
"newMessages") == 0) {
213 for (i = path_vars; i; i = i->
next) {
214 if (strcmp(i->
name,
"mailboxName") == 0) {
224 #if defined(AST_DEVMODE)
229 is_valid = response->
message == NULL;
237 if (200 <= code && code <= 299) {
241 ast_log(LOG_ERROR,
"Invalid error response %d for /mailboxes/{mailboxName}\n", code);
247 ast_log(LOG_ERROR,
"Response validation failed for /mailboxes/{mailboxName}\n");
249 "Internal Server Error",
"Response validation failed");
253 fin: __attribute__((unused))
272 #if defined(AST_DEVMODE)
277 for (i = path_vars; i; i = i->
next) {
278 if (strcmp(i->
name,
"mailboxName") == 0) {
284 #if defined(AST_DEVMODE)
289 is_valid = response->
message == NULL;
297 if (200 <= code && code <= 299) {
301 ast_log(LOG_ERROR,
"Invalid error response %d for /mailboxes/{mailboxName}\n", code);
307 ast_log(LOG_ERROR,
"Response validation failed for /mailboxes/{mailboxName}\n");
309 "Internal Server Error",
"Response validation failed");
313 fin: __attribute__((unused))
339 static int unload_module(
void)
345 static int load_module(
void)
359 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Mailboxes resources",
360 .support_level = AST_MODULE_SUPPORT_CORE,
362 .unload = unload_module,
363 .requires =
"res_ari,res_ari_model,res_stasis,res_stasis_mailbox",
void ast_ari_mailboxes_update(struct ast_variable *headers, struct ast_ari_mailboxes_update_args *args, struct ast_ari_response *response)
Change the state of a mailbox. (Note - implicitly creates the mailbox).
struct ast_variable * next
ari_validator ast_ari_validate_mailbox_fn(void)
Function pointer to ast_ari_validate_mailbox().
int ast_ari_mailboxes_update_parse_body(struct ast_json *body, struct ast_ari_mailboxes_update_args *args)
Body parsing function for /mailboxes/{mailboxName}.
Asterisk main include file. File version handling, generic pbx functions.
static void ast_ari_mailboxes_delete_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 /mailboxes/{mailboxName}.
void ast_ari_mailboxes_delete(struct ast_variable *headers, struct ast_ari_mailboxes_delete_args *args, struct ast_ari_response *response)
Destroy a mailbox.
static struct stasis_rest_handlers mailboxes
REST handler for /api-docs/mailboxes.json.
Structure for variables, used for configurations and for channel variables.
Generated file - Build validators for ARI model objects.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
static void ast_ari_mailboxes_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 /mailboxes.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
static void ast_ari_mailboxes_update_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 /mailboxes/{mailboxName}.
const char * mailbox_name
describes a server instance
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Generated file - declares stubs to be implemented in res/ari/resource_mailboxes.c.
const char * mailbox_name
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.
static void ast_ari_mailboxes_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 /mailboxes/{mailboxName}.
const char * mailbox_name
Module has failed to load, may be in an inconsistent state.
struct ast_json * message
int ast_ari_validate_mailbox(struct ast_json *json)
Validator for Mailbox.
const char * path_segment
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
static struct stasis_rest_handlers mailboxes_mailboxName
REST handler for /api-docs/mailboxes.json.
Abstract JSON element (object, array, string, int, ...).
void ast_ari_mailboxes_get(struct ast_variable *headers, struct ast_ari_mailboxes_get_args *args, struct ast_ari_response *response)
Retrieve the current state of a mailbox.
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.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
Handler for a single RESTful path segment.
void ast_ari_mailboxes_list(struct ast_variable *headers, struct ast_ari_mailboxes_list_args *args, struct ast_ari_response *response)
List all mailboxes.