49 #if defined(AST_DEVMODE)
70 #if defined(AST_DEVMODE)
76 #if defined(AST_DEVMODE)
81 is_valid = response->
message == NULL;
88 if (200 <= code && code <= 299) {
92 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges\n", code);
98 ast_log(LOG_ERROR,
"Response validation failed for /bridges\n");
100 "Internal Server Error",
"Response validation failed");
104 fin: __attribute__((unused))
144 #if defined(AST_DEVMODE)
149 for (i = get_params; i; i = i->
next) {
150 if (strcmp(i->
name,
"type") == 0) {
153 if (strcmp(i->
name,
"bridgeId") == 0) {
156 if (strcmp(i->
name,
"name") == 0) {
166 #if defined(AST_DEVMODE)
171 is_valid = response->
message == NULL;
178 if (200 <= code && code <= 299) {
182 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges\n", code);
188 ast_log(LOG_ERROR,
"Response validation failed for /bridges\n");
190 "Internal Server Error",
"Response validation failed");
194 fin: __attribute__((unused))
230 #if defined(AST_DEVMODE)
235 for (i = get_params; i; i = i->
next) {
236 if (strcmp(i->
name,
"type") == 0) {
239 if (strcmp(i->
name,
"name") == 0) {
244 for (i = path_vars; i; i = i->
next) {
245 if (strcmp(i->
name,
"bridgeId") == 0) {
255 #if defined(AST_DEVMODE)
260 is_valid = response->
message == NULL;
267 if (200 <= code && code <= 299) {
271 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}\n", code);
277 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}\n");
279 "Internal Server Error",
"Response validation failed");
283 fin: __attribute__((unused))
302 #if defined(AST_DEVMODE)
307 for (i = path_vars; i; i = i->
next) {
308 if (strcmp(i->
name,
"bridgeId") == 0) {
314 #if defined(AST_DEVMODE)
319 is_valid = response->
message == NULL;
327 if (200 <= code && code <= 299) {
331 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}\n", code);
337 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}\n");
339 "Internal Server Error",
"Response validation failed");
343 fin: __attribute__((unused))
362 #if defined(AST_DEVMODE)
367 for (i = path_vars; i; i = i->
next) {
368 if (strcmp(i->
name,
"bridgeId") == 0) {
374 #if defined(AST_DEVMODE)
379 is_valid = response->
message == NULL;
387 if (200 <= code && code <= 299) {
391 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}\n", code);
397 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}\n");
399 "Internal Server Error",
"Response validation failed");
403 fin: __attribute__((unused))
476 #if defined(AST_DEVMODE)
481 for (i = get_params; i; i = i->
next) {
482 if (strcmp(i->
name,
"channel") == 0) {
484 char *vals[MAX_VALS];
511 "Too many values for channel");
525 if (strcmp(i->
name,
"role") == 0) {
528 if (strcmp(i->
name,
"absorbDTMF") == 0) {
531 if (strcmp(i->
name,
"mute") == 0) {
534 if (strcmp(i->
name,
"inhibitConnectedLineUpdates") == 0) {
539 for (i = path_vars; i; i = i->
next) {
540 if (strcmp(i->
name,
"bridgeId") == 0) {
550 #if defined(AST_DEVMODE)
555 is_valid = response->
message == NULL;
566 if (200 <= code && code <= 299) {
570 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/addChannel\n", code);
576 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/addChannel\n");
578 "Internal Server Error",
"Response validation failed");
582 fin: __attribute__((unused))
641 #if defined(AST_DEVMODE)
646 for (i = get_params; i; i = i->
next) {
647 if (strcmp(i->
name,
"channel") == 0) {
649 char *vals[MAX_VALS];
676 "Too many values for channel");
692 for (i = path_vars; i; i = i->
next) {
693 if (strcmp(i->
name,
"bridgeId") == 0) {
703 #if defined(AST_DEVMODE)
708 is_valid = response->
message == NULL;
719 if (200 <= code && code <= 299) {
723 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/removeChannel\n", code);
729 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/removeChannel\n");
731 "Internal Server Error",
"Response validation failed");
735 fin: __attribute__((unused))
756 #if defined(AST_DEVMODE)
761 for (i = path_vars; i; i = i->
next) {
762 if (strcmp(i->
name,
"bridgeId") == 0) {
765 if (strcmp(i->
name,
"channelId") == 0) {
771 #if defined(AST_DEVMODE)
776 is_valid = response->
message == NULL;
786 if (200 <= code && code <= 299) {
790 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/videoSource/{channelId}\n", code);
796 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/videoSource/{channelId}\n");
798 "Internal Server Error",
"Response validation failed");
802 fin: __attribute__((unused))
821 #if defined(AST_DEVMODE)
826 for (i = path_vars; i; i = i->
next) {
827 if (strcmp(i->
name,
"bridgeId") == 0) {
833 #if defined(AST_DEVMODE)
838 is_valid = response->
message == NULL;
846 if (200 <= code && code <= 299) {
850 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/videoSource\n", code);
856 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/videoSource\n");
858 "Internal Server Error",
"Response validation failed");
862 fin: __attribute__((unused))
894 #if defined(AST_DEVMODE)
899 for (i = get_params; i; i = i->
next) {
900 if (strcmp(i->
name,
"mohClass") == 0) {
905 for (i = path_vars; i; i = i->
next) {
906 if (strcmp(i->
name,
"bridgeId") == 0) {
916 #if defined(AST_DEVMODE)
921 is_valid = response->
message == NULL;
930 if (200 <= code && code <= 299) {
934 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
940 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/moh\n");
942 "Internal Server Error",
"Response validation failed");
946 fin: __attribute__((unused))
965 #if defined(AST_DEVMODE)
970 for (i = path_vars; i; i = i->
next) {
971 if (strcmp(i->
name,
"bridgeId") == 0) {
977 #if defined(AST_DEVMODE)
982 is_valid = response->
message == NULL;
991 if (200 <= code && code <= 299) {
995 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
1001 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/moh\n");
1003 "Internal Server Error",
"Response validation failed");
1007 fin: __attribute__((unused))
1021 ast_free(args->
media);
1080 #if defined(AST_DEVMODE)
1085 for (i = get_params; i; i = i->
next) {
1086 if (strcmp(i->
name,
"media") == 0) {
1088 char *vals[MAX_VALS];
1115 "Too many values for media");
1126 args.
media[j] = (vals[j]);
1129 if (strcmp(i->
name,
"lang") == 0) {
1132 if (strcmp(i->
name,
"offsetms") == 0) {
1135 if (strcmp(i->
name,
"skipms") == 0) {
1138 if (strcmp(i->
name,
"playbackId") == 0) {
1143 for (i = path_vars; i; i = i->
next) {
1144 if (strcmp(i->
name,
"bridgeId") == 0) {
1154 #if defined(AST_DEVMODE)
1159 is_valid = response->
message == NULL;
1168 if (200 <= code && code <= 299) {
1172 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/play\n", code);
1178 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/play\n");
1180 "Internal Server Error",
"Response validation failed");
1184 fin: __attribute__((unused))
1186 ast_free(args.
media);
1200 ast_free(args->
media);
1255 #if defined(AST_DEVMODE)
1260 for (i = get_params; i; i = i->
next) {
1261 if (strcmp(i->
name,
"media") == 0) {
1263 char *vals[MAX_VALS];
1290 "Too many values for media");
1301 args.
media[j] = (vals[j]);
1304 if (strcmp(i->
name,
"lang") == 0) {
1307 if (strcmp(i->
name,
"offsetms") == 0) {
1310 if (strcmp(i->
name,
"skipms") == 0) {
1315 for (i = path_vars; i; i = i->
next) {
1316 if (strcmp(i->
name,
"bridgeId") == 0) {
1319 if (strcmp(i->
name,
"playbackId") == 0) {
1329 #if defined(AST_DEVMODE)
1334 is_valid = response->
message == NULL;
1343 if (200 <= code && code <= 299) {
1347 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/play/{playbackId}\n", code);
1353 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/play/{playbackId}\n");
1355 "Internal Server Error",
"Response validation failed");
1359 fin: __attribute__((unused))
1361 ast_free(args.
media);
1417 #if defined(AST_DEVMODE)
1422 for (i = get_params; i; i = i->
next) {
1423 if (strcmp(i->
name,
"name") == 0) {
1426 if (strcmp(i->
name,
"format") == 0) {
1429 if (strcmp(i->
name,
"maxDurationSeconds") == 0) {
1432 if (strcmp(i->
name,
"maxSilenceSeconds") == 0) {
1435 if (strcmp(i->
name,
"ifExists") == 0) {
1438 if (strcmp(i->
name,
"beep") == 0) {
1441 if (strcmp(i->
name,
"terminateOn") == 0) {
1446 for (i = path_vars; i; i = i->
next) {
1447 if (strcmp(i->
name,
"bridgeId") == 0) {
1457 #if defined(AST_DEVMODE)
1462 is_valid = response->
message == NULL;
1473 if (200 <= code && code <= 299) {
1477 ast_log(LOG_ERROR,
"Invalid error response %d for /bridges/{bridgeId}/record\n", code);
1483 ast_log(LOG_ERROR,
"Response validation failed for /bridges/{bridgeId}/record\n");
1485 "Internal Server Error",
"Response validation failed");
1489 fin: __attribute__((unused))
1591 static int unload_module(
void)
1597 static int load_module(
void)
1611 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Bridge resources",
1612 .support_level = AST_MODULE_SUPPORT_CORE,
1613 .load = load_module,
1614 .unload = unload_module,
1615 .requires =
"res_ari,res_ari_model,res_stasis,res_stasis_recording,res_stasis_playback",
static void ast_ari_bridges_stop_moh_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 /bridges/{bridgeId}/moh.
struct ast_variable * next
int ast_ari_bridges_start_moh_parse_body(struct ast_json *body, struct ast_ari_bridges_start_moh_args *args)
Body parsing function for /bridges/{bridgeId}/moh.
void ast_ari_bridges_start_moh(struct ast_variable *headers, struct ast_ari_bridges_start_moh_args *args, struct ast_ari_response *response)
Play music on hold to a bridge or change the MOH class that is playing.
Asterisk main include file. File version handling, generic pbx functions.
static void ast_ari_bridges_remove_channel_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 /bridges/{bridgeId}/removeChannel.
void ast_ari_bridges_play_with_id(struct ast_variable *headers, struct ast_ari_bridges_play_with_id_args *args, struct ast_ari_response *response)
Start playback of media on a bridge.
void ast_ari_bridges_get(struct ast_variable *headers, struct ast_ari_bridges_get_args *args, struct ast_ari_response *response)
Get bridge details.
static struct stasis_rest_handlers bridges_bridgeId_record
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_videoSource
REST handler for /api-docs/bridges.json.
void ast_ari_bridges_add_channel(struct ast_variable *headers, struct ast_ari_bridges_add_channel_args *args, struct ast_ari_response *response)
Add a channel to a bridge.
static void ast_ari_bridges_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 /bridges.
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_bridges_remove_channel(struct ast_variable *headers, struct ast_ari_bridges_remove_channel_args *args, struct ast_ari_response *response)
Remove a channel from a bridge.
void ast_ari_bridges_create(struct ast_variable *headers, struct ast_ari_bridges_create_args *args, struct ast_ari_response *response)
Create a new bridge.
static void ast_ari_bridges_create_with_id_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 /bridges/{bridgeId}.
Generated file - Build validators for ARI model objects.
static struct stasis_rest_handlers bridges_bridgeId_moh
REST handler for /api-docs/bridges.json.
#define ast_strdup(str)
A wrapper for strdup()
static void ast_ari_bridges_add_channel_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 /bridges/{bridgeId}/addChannel.
static void ast_ari_bridges_clear_video_source_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 /bridges/{bridgeId}/videoSource.
int ast_ari_bridges_play_parse_body(struct ast_json *body, struct ast_ari_bridges_play_args *args)
Body parsing function for /bridges/{bridgeId}/play.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
void ast_ari_bridges_play(struct ast_variable *headers, struct ast_ari_bridges_play_args *args, struct ast_ari_response *response)
Start playback of media on a bridge.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
ari_validator ast_ari_validate_bridge_fn(void)
Function pointer to ast_ari_validate_bridge().
static struct stasis_rest_handlers bridges_bridgeId_play_playbackId
REST handler for /api-docs/bridges.json.
static void ast_ari_bridges_record_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 /bridges/{bridgeId}/record.
int ast_ari_bridges_create_with_id_parse_body(struct ast_json *body, struct ast_ari_bridges_create_with_id_args *args)
Body parsing function for /bridges/{bridgeId}.
void ast_ari_bridges_stop_moh(struct ast_variable *headers, struct ast_ari_bridges_stop_moh_args *args, struct ast_ari_response *response)
Stop playing music on hold to a bridge.
static void ast_ari_bridges_set_video_source_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 /bridges/{bridgeId}/videoSource/{channelId}.
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()
static void ast_ari_bridges_play_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 /bridges/{bridgeId}/play.
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
static struct stasis_rest_handlers bridges_bridgeId_play
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_videoSource_channelId
REST handler for /api-docs/bridges.json.
describes a server instance
void ast_ari_bridges_destroy(struct ast_variable *headers, struct ast_ari_bridges_destroy_args *args, struct ast_ari_response *response)
Shut down a bridge.
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".
const char * terminate_on
int ast_ari_bridges_add_channel_parse_body(struct ast_json *body, struct ast_ari_bridges_add_channel_args *args)
Body parsing function for /bridges/{bridgeId}/addChannel.
static struct stasis_rest_handlers bridges_bridgeId
REST handler for /api-docs/bridges.json.
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_bridges_play_with_id_parse_body(struct ast_json *body, struct ast_ari_bridges_play_with_id_args *args)
Body parsing function for /bridges/{bridgeId}/play/{playbackId}.
static void ast_ari_bridges_destroy_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 /bridges/{bridgeId}.
void ast_ari_bridges_clear_video_source(struct ast_variable *headers, struct ast_ari_bridges_clear_video_source_args *args, struct ast_ari_response *response)
Removes any explicit video source in a multi-party mixing bridge. This operation has no effect on bri...
int ast_ari_bridges_remove_channel_parse_body(struct ast_json *body, struct ast_ari_bridges_remove_channel_args *args)
Body parsing function for /bridges/{bridgeId}/removeChannel.
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
void ast_ari_bridges_list(struct ast_variable *headers, struct ast_ari_bridges_list_args *args, struct ast_ari_response *response)
List all active bridges in Asterisk.
static struct stasis_rest_handlers bridges
REST handler for /api-docs/bridges.json.
static void ast_ari_bridges_create_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 /bridges.
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_bridges_create_with_id(struct ast_variable *headers, struct ast_ari_bridges_create_with_id_args *args, struct ast_ari_response *response)
Create a new bridge or updates an existing one.
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.
static struct stasis_rest_handlers bridges_bridgeId_addChannel
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_removeChannel
REST handler for /api-docs/bridges.json.
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.
int inhibit_connected_line_updates
struct ast_json * message
Generated file - declares stubs to be implemented in res/ari/resource_bridges.c.
const char * path_segment
void ast_ari_bridges_record(struct ast_variable *headers, struct ast_ari_bridges_record_args *args, struct ast_ari_response *response)
Start a recording.
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_bridges_play_with_id_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 /bridges/{bridgeId}/play/{playbackId}.
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, ...).
static void ast_ari_bridges_start_moh_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 /bridges/{bridgeId}/moh.
Stasis Application API. See Stasis Application API for detailed documentation.
void ast_ari_bridges_set_video_source(struct ast_variable *headers, struct ast_ari_bridges_set_video_source_args *args, struct ast_ari_response *response)
Set a channel as the video source in a multi-party mixing bridge. This operation has no effect on bri...
static void ast_ari_bridges_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 /bridges/{bridgeId}.
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.
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...
int ast_ari_bridges_record_parse_body(struct ast_json *body, struct ast_ari_bridges_record_args *args)
Body parsing function for /bridges/{bridgeId}/record.
Handler for a single RESTful path segment.
int ast_ari_bridges_create_parse_body(struct ast_json *body, struct ast_ari_bridges_create_args *args)
Body parsing function for /bridges.