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 /endpoints\n", code);
96 ast_log(LOG_ERROR,
"Response validation failed for /endpoints\n");
98 "Internal Server Error",
"Response validation failed");
102 fin: __attribute__((unused))
142 #if defined(AST_DEVMODE)
147 for (i = get_params; i; i = i->
next) {
148 if (strcmp(i->
name,
"to") == 0) {
151 if (strcmp(i->
name,
"from") == 0) {
154 if (strcmp(i->
name,
"body") == 0) {
159 args.variables = body;
161 #if defined(AST_DEVMODE)
166 is_valid = response->
message == NULL;
175 if (200 <= code && code <= 299) {
179 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/sendMessage\n", code);
185 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/sendMessage\n");
187 "Internal Server Error",
"Response validation failed");
191 fin: __attribute__((unused))
235 #if defined(AST_DEVMODE)
240 for (i = get_params; i; i = i->
next) {
241 if (strcmp(i->
name,
"to") == 0) {
244 if (strcmp(i->
name,
"from") == 0) {
247 if (strcmp(i->
name,
"refer_to") == 0) {
250 if (strcmp(i->
name,
"to_self") == 0) {
257 #if defined(AST_DEVMODE)
262 is_valid = response->
message == NULL;
271 if (200 <= code && code <= 299) {
275 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/refer\n", code);
281 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/refer\n");
283 "Internal Server Error",
"Response validation failed");
287 fin: __attribute__((unused))
306 #if defined(AST_DEVMODE)
311 for (i = path_vars; i; i = i->
next) {
312 if (strcmp(i->
name,
"tech") == 0) {
318 #if defined(AST_DEVMODE)
323 is_valid = response->
message == NULL;
331 if (200 <= code && code <= 299) {
335 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/{tech}\n", code);
341 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/{tech}\n");
343 "Internal Server Error",
"Response validation failed");
347 fin: __attribute__((unused))
366 #if defined(AST_DEVMODE)
371 for (i = path_vars; i; i = i->
next) {
372 if (strcmp(i->
name,
"tech") == 0) {
375 if (strcmp(i->
name,
"resource") == 0) {
381 #if defined(AST_DEVMODE)
386 is_valid = response->
message == NULL;
395 if (200 <= code && code <= 299) {
399 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/{tech}/{resource}\n", code);
405 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/{tech}/{resource}\n");
407 "Internal Server Error",
"Response validation failed");
411 fin: __attribute__((unused))
447 #if defined(AST_DEVMODE)
452 for (i = get_params; i; i = i->
next) {
453 if (strcmp(i->
name,
"from") == 0) {
456 if (strcmp(i->
name,
"body") == 0) {
461 for (i = path_vars; i; i = i->
next) {
462 if (strcmp(i->
name,
"tech") == 0) {
465 if (strcmp(i->
name,
"resource") == 0) {
470 args.variables = body;
472 #if defined(AST_DEVMODE)
477 is_valid = response->
message == NULL;
486 if (200 <= code && code <= 299) {
490 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/{tech}/{resource}/sendMessage\n", code);
496 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/{tech}/{resource}/sendMessage\n");
498 "Internal Server Error",
"Response validation failed");
502 fin: __attribute__((unused))
542 #if defined(AST_DEVMODE)
547 for (i = get_params; i; i = i->
next) {
548 if (strcmp(i->
name,
"from") == 0) {
551 if (strcmp(i->
name,
"refer_to") == 0) {
554 if (strcmp(i->
name,
"to_self") == 0) {
559 for (i = path_vars; i; i = i->
next) {
560 if (strcmp(i->
name,
"tech") == 0) {
563 if (strcmp(i->
name,
"resource") == 0) {
570 #if defined(AST_DEVMODE)
575 is_valid = response->
message == NULL;
584 if (200 <= code && code <= 299) {
588 ast_log(LOG_ERROR,
"Invalid error response %d for /endpoints/{tech}/{resource}/refer\n", code);
594 ast_log(LOG_ERROR,
"Response validation failed for /endpoints/{tech}/{resource}/refer\n");
596 "Internal Server Error",
"Response validation failed");
600 fin: __attribute__((unused))
670 static int unload_module(
void)
676 static int load_module(
void)
690 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Endpoint resources",
691 .support_level = AST_MODULE_SUPPORT_CORE,
693 .unload = unload_module,
694 .requires =
"res_ari,res_ari_model,res_stasis",
struct ast_variable * next
int ast_ari_endpoints_refer_parse_body(struct ast_json *body, struct ast_ari_endpoints_refer_args *args)
Body parsing function for /endpoints/refer.
Asterisk main include file. File version handling, generic pbx functions.
static struct stasis_rest_handlers endpoints_sendMessage
REST handler for /api-docs/endpoints.json.
static void ast_ari_endpoints_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 /endpoints.
static void ast_ari_endpoints_refer_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 /endpoints/refer.
static struct stasis_rest_handlers endpoints_refer
REST handler for /api-docs/endpoints.json.
int ast_json_is_true(const struct ast_json *value)
Check if value is JSON true.
Structure for variables, used for configurations and for channel variables.
void ast_ari_endpoints_refer(struct ast_variable *headers, struct ast_ari_endpoints_refer_args *args, struct ast_ari_response *response)
Refer an endpoint or technology URI to some technology URI or endpoint.
static struct stasis_rest_handlers endpoints_tech_resource_sendMessage
REST handler for /api-docs/endpoints.json.
void ast_ari_endpoints_get(struct ast_variable *headers, struct ast_ari_endpoints_get_args *args, struct ast_ari_response *response)
Details for an endpoint.
Generated file - Build validators for ARI model objects.
void ast_ari_endpoints_refer_to_endpoint(struct ast_variable *headers, struct ast_ari_endpoints_refer_to_endpoint_args *args, struct ast_ari_response *response)
Refer an endpoint or technology URI to some technology URI or endpoint.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
static void ast_ari_endpoints_send_message_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 /endpoints/sendMessage.
void ast_ari_endpoints_list(struct ast_variable *headers, struct ast_ari_endpoints_list_args *args, struct ast_ari_response *response)
List all endpoints.
struct ast_json * variables
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
describes a server instance
void ast_ari_endpoints_list_by_tech(struct ast_variable *headers, struct ast_ari_endpoints_list_by_tech_args *args, struct ast_ari_response *response)
List available endoints for a given endpoint technology.
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
int ast_ari_validate_endpoint(struct ast_json *json)
Validator for Endpoint.
int ast_ari_endpoints_send_message_to_endpoint_parse_body(struct ast_json *body, struct ast_ari_endpoints_send_message_to_endpoint_args *args)
Body parsing function for /endpoints/{tech}/{resource}/sendMessage.
int ast_ari_endpoints_refer_to_endpoint_parse_body(struct ast_json *body, struct ast_ari_endpoints_refer_to_endpoint_args *args)
Body parsing function for /endpoints/{tech}/{resource}/refer.
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
static struct stasis_rest_handlers endpoints
REST handler for /api-docs/endpoints.json.
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 struct stasis_rest_handlers endpoints_tech_resource_refer
REST handler for /api-docs/endpoints.json.
static void ast_ari_endpoints_send_message_to_endpoint_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 /endpoints/{tech}/{resource}/sendMessage.
struct ast_json * variables
Module has failed to load, may be in an inconsistent state.
static void ast_ari_endpoints_list_by_tech_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 /endpoints/{tech}.
static struct stasis_rest_handlers endpoints_tech
REST handler for /api-docs/endpoints.json.
struct ast_json * message
void ast_ari_endpoints_send_message_to_endpoint(struct ast_variable *headers, struct ast_ari_endpoints_send_message_to_endpoint_args *args, struct ast_ari_response *response)
Send a message to some endpoint in a technology.
void ast_ari_endpoints_send_message(struct ast_variable *headers, struct ast_ari_endpoints_send_message_args *args, struct ast_ari_response *response)
Send a message to some technology URI or endpoint.
const char * path_segment
Generated file - declares stubs to be implemented in res/ari/resource_endpoints.c.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
static void ast_ari_endpoints_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 /endpoints/{tech}/{resource}.
static void ast_ari_endpoints_refer_to_endpoint_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 /endpoints/{tech}/{resource}/refer.
Abstract JSON element (object, array, string, int, ...).
int ast_ari_endpoints_send_message_parse_body(struct ast_json *body, struct ast_ari_endpoints_send_message_args *args)
Body parsing function for /endpoints/sendMessage.
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.
ari_validator ast_ari_validate_endpoint_fn(void)
Function pointer to ast_ari_validate_endpoint().
Asterisk module definitions.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static struct stasis_rest_handlers endpoints_tech_resource
REST handler for /api-docs/endpoints.json.
Handler for a single RESTful path segment.