Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Macros | Functions | Variables
res_ari_bridges.c File Reference

Bridge resources. More...

#include "asterisk.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
#include "ari/resource_bridges.h"
Include dependency graph for res_ari_bridges.c:

Go to the source code of this file.

Macros

#define MAX_VALS   128
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
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.
 
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 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.
 
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.
 
int ast_ari_bridges_create_parse_body (struct ast_json *body, struct ast_ari_bridges_create_args *args)
 Body parsing function for /bridges.
 
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}.
 
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}.
 
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}.
 
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}.
 
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.
 
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_bridges_play_parse_body (struct ast_json *body, struct ast_ari_bridges_play_args *args)
 Body parsing function for /bridges/{bridgeId}/play.
 
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}.
 
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_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_record_parse_body (struct ast_json *body, struct ast_ari_bridges_record_args *args)
 Body parsing function for /bridges/{bridgeId}/record.
 
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.
 
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.
 
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}.
 
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.
 
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.
 
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_moduleAST_MODULE_SELF_SYM (void)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Bridge resources" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_recording,res_stasis_playback", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct stasis_rest_handlers bridges
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_addChannel
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_moh
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_play
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_play_playbackId
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_record
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_removeChannel
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_videoSource
 REST handler for /api-docs/bridges.json.
 
static struct stasis_rest_handlers bridges_bridgeId_videoSource_channelId
 REST handler for /api-docs/bridges.json.
 

Detailed Description

Bridge resources.

Author
David M. Lee, II dlee@.nosp@m.digi.nosp@m.um.co.nosp@m.m

Definition in file res_ari_bridges.c.

Macro Definition Documentation

◆ MAX_VALS

#define MAX_VALS   128

Definition at line 53 of file res_ari_bridges.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 1641 of file res_ari_bridges.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 1641 of file res_ari_bridges.c.

◆ ast_ari_bridges_add_channel_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/addChannel.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 471 of file res_ari_bridges.c.

475{
477 struct ast_variable *i;
478#if defined(AST_DEVMODE)
479 int is_valid;
480 int code;
481#endif /* AST_DEVMODE */
482
483 for (i = get_params; i; i = i->next) {
484 if (strcmp(i->name, "channel") == 0) {
485 /* Parse comma separated list */
486 char *vals[MAX_VALS];
487 size_t j;
488
489 args.channel_parse = ast_strdup(i->value);
490 if (!args.channel_parse) {
492 goto fin;
493 }
494
495 if (strlen(args.channel_parse) == 0) {
496 /* ast_app_separate_args can't handle "" */
497 args.channel_count = 1;
498 vals[0] = args.channel_parse;
499 } else {
500 args.channel_count = ast_app_separate_args(
501 args.channel_parse, ',', vals,
502 ARRAY_LEN(vals));
503 }
504
505 if (args.channel_count == 0) {
507 goto fin;
508 }
509
510 if (args.channel_count >= MAX_VALS) {
511 ast_ari_response_error(response, 400,
512 "Bad Request",
513 "Too many values for channel");
514 goto fin;
515 }
516
517 args.channel = ast_malloc(sizeof(*args.channel) * args.channel_count);
518 if (!args.channel) {
520 goto fin;
521 }
522
523 for (j = 0; j < args.channel_count; ++j) {
524 args.channel[j] = (vals[j]);
525 }
526 } else
527 if (strcmp(i->name, "role") == 0) {
528 args.role = (i->value);
529 } else
530 if (strcmp(i->name, "absorbDTMF") == 0) {
531 args.absorb_dtmf = ast_true(i->value);
532 } else
533 if (strcmp(i->name, "mute") == 0) {
534 args.mute = ast_true(i->value);
535 } else
536 if (strcmp(i->name, "inhibitConnectedLineUpdates") == 0) {
537 args.inhibit_connected_line_updates = ast_true(i->value);
538 } else
539 {}
540 }
541 for (i = path_vars; i; i = i->next) {
542 if (strcmp(i->name, "bridgeId") == 0) {
543 args.bridge_id = (i->value);
544 } else
545 {}
546 }
549 goto fin;
550 }
551 ast_ari_bridges_add_channel(headers, &args, response);
552#if defined(AST_DEVMODE)
553 code = response->response_code;
554
555 switch (code) {
556 case 0: /* Implementation is still a stub, or the code wasn't set */
557 is_valid = response->message == NULL;
558 break;
559 case 500: /* Internal Server Error */
560 case 501: /* Not Implemented */
561 case 400: /* Channel not found */
562 case 404: /* Bridge not found */
563 case 409: /* Bridge not in Stasis application; Channel currently recording */
564 case 422: /* Channel not in Stasis application */
565 is_valid = 1;
566 break;
567 default:
568 if (200 <= code && code <= 299) {
569 is_valid = ast_ari_validate_void(
570 response->message);
571 } else {
572 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/addChannel\n", code);
573 is_valid = 0;
574 }
575 }
576
577 if (!is_valid) {
578 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/addChannel\n");
579 ast_ari_response_error(response, 500,
580 "Internal Server Error", "Response validation failed");
581 }
582#endif /* AST_DEVMODE */
583
584fin: __attribute__((unused))
585 ast_free(args.channel_parse);
586 ast_free(args.channel);
587 return;
588}
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.
Definition res_ari.c:212
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
Definition res_ari.c:251
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
#define ast_free(a)
Definition astmm.h:180
#define ast_strdup(str)
A wrapper for strdup()
Definition astmm.h:241
#define ast_malloc(len)
A wrapper for malloc()
Definition astmm.h:191
#define ast_log
Definition astobj2.c:42
#define ast_app_separate_args(a, b, c, d)
#define LOG_ERROR
#define MAX_VALS
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 @519 args
#define NULL
Definition resample.c:96
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.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition utils.c:2235
struct ast_json * message
Definition ari.h:103
int response_code
Definition ari.h:108
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
#define ARRAY_LEN(a)
Definition utils.h:706

References args, ARRAY_LEN, ast_app_separate_args, ast_ari_bridges_add_channel(), ast_ari_bridges_add_channel_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_void(), ast_free, ast_log, ast_malloc, ast_strdup, ast_true(), LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_add_channel_parse_body()

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.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 408 of file res_ari_bridges.c.

411{
412 struct ast_json *field;
413 /* Parse query parameters out of it */
414 field = ast_json_object_get(body, "channel");
415 if (field) {
416 /* If they were silly enough to both pass in a query param and a
417 * JSON body, free up the query value.
418 */
419 ast_free(args->channel);
420 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
421 /* Multiple param passed as array */
422 size_t i;
423 args->channel_count = ast_json_array_size(field);
424 args->channel = ast_malloc(sizeof(*args->channel) * args->channel_count);
425
426 if (!args->channel) {
427 return -1;
428 }
429
430 for (i = 0; i < args->channel_count; ++i) {
431 args->channel[i] = ast_json_string_get(ast_json_array_get(field, i));
432 }
433 } else {
434 /* Multiple param passed as single value */
435 args->channel_count = 1;
436 args->channel = ast_malloc(sizeof(*args->channel) * args->channel_count);
437 if (!args->channel) {
438 return -1;
439 }
440 args->channel[0] = ast_json_string_get(field);
441 }
442 }
443 field = ast_json_object_get(body, "role");
444 if (field) {
445 args->role = ast_json_string_get(field);
446 }
447 field = ast_json_object_get(body, "absorbDTMF");
448 if (field) {
449 args->absorb_dtmf = ast_json_is_true(field);
450 }
451 field = ast_json_object_get(body, "mute");
452 if (field) {
453 args->mute = ast_json_is_true(field);
454 }
455 field = ast_json_object_get(body, "inhibitConnectedLineUpdates");
456 if (field) {
457 args->inhibit_connected_line_updates = ast_json_is_true(field);
458 }
459 return 0;
460}
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
Definition json.c:78
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Definition json.c:370
@ AST_JSON_ARRAY
Definition json.h:165
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition json.c:283
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition json.c:407
int ast_json_is_true(const struct ast_json *value)
Check if value is JSON true.
Definition json.c:263
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Definition json.c:366
Abstract JSON element (object, array, string, int, ...).

References args, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_is_true(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.

Referenced by ast_ari_bridges_add_channel_cb().

◆ ast_ari_bridges_clear_video_source_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/videoSource.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 816 of file res_ari_bridges.c.

820{
822 struct ast_variable *i;
823#if defined(AST_DEVMODE)
824 int is_valid;
825 int code;
826#endif /* AST_DEVMODE */
827
828 for (i = path_vars; i; i = i->next) {
829 if (strcmp(i->name, "bridgeId") == 0) {
830 args.bridge_id = (i->value);
831 } else
832 {}
833 }
834 ast_ari_bridges_clear_video_source(headers, &args, response);
835#if defined(AST_DEVMODE)
836 code = response->response_code;
837
838 switch (code) {
839 case 0: /* Implementation is still a stub, or the code wasn't set */
840 is_valid = response->message == NULL;
841 break;
842 case 500: /* Internal Server Error */
843 case 501: /* Not Implemented */
844 case 404: /* Bridge not found */
845 is_valid = 1;
846 break;
847 default:
848 if (200 <= code && code <= 299) {
849 is_valid = ast_ari_validate_void(
850 response->message);
851 } else {
852 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/videoSource\n", code);
853 is_valid = 0;
854 }
855 }
856
857 if (!is_valid) {
858 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/videoSource\n");
859 ast_ari_response_error(response, 500,
860 "Internal Server Error", "Response validation failed");
861 }
862#endif /* AST_DEVMODE */
863
864fin: __attribute__((unused))
865 return;
866}
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...

References args, ast_ari_bridges_clear_video_source(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_create_cb()

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 
)
static

Parameter parsing callback for /bridges.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 137 of file res_ari_bridges.c.

141{
143 struct ast_variable *i;
144#if defined(AST_DEVMODE)
145 int is_valid;
146 int code;
147#endif /* AST_DEVMODE */
148
149 for (i = get_params; i; i = i->next) {
150 if (strcmp(i->name, "type") == 0) {
151 args.type = (i->value);
152 } else
153 if (strcmp(i->name, "bridgeId") == 0) {
154 args.bridge_id = (i->value);
155 } else
156 if (strcmp(i->name, "name") == 0) {
157 args.name = (i->value);
158 } else
159 {}
160 }
163 goto fin;
164 }
165 ast_ari_bridges_create(headers, &args, response);
166#if defined(AST_DEVMODE)
167 code = response->response_code;
168
169 switch (code) {
170 case 0: /* Implementation is still a stub, or the code wasn't set */
171 is_valid = response->message == NULL;
172 break;
173 case 500: /* Internal Server Error */
174 case 501: /* Not Implemented */
175 case 409: /* Bridge with the same bridgeId already exists */
176 is_valid = 1;
177 break;
178 default:
179 if (200 <= code && code <= 299) {
180 is_valid = ast_ari_validate_bridge(
181 response->message);
182 } else {
183 ast_log(LOG_ERROR, "Invalid error response %d for /bridges\n", code);
184 is_valid = 0;
185 }
186 }
187
188 if (!is_valid) {
189 ast_log(LOG_ERROR, "Response validation failed for /bridges\n");
190 ast_ari_response_error(response, 500,
191 "Internal Server Error", "Response validation failed");
192 }
193#endif /* AST_DEVMODE */
194
195fin: __attribute__((unused))
196 return;
197}
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_bridges_create_parse_body(struct ast_json *body, struct ast_ari_bridges_create_args *args)
Body parsing function for /bridges.
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.

References args, ast_ari_bridges_create(), ast_ari_bridges_create_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_bridge(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_create_parse_body()

int ast_ari_bridges_create_parse_body ( struct ast_json body,
struct ast_ari_bridges_create_args args 
)

Body parsing function for /bridges.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 107 of file res_ari_bridges.c.

110{
111 struct ast_json *field;
112 /* Parse query parameters out of it */
113 field = ast_json_object_get(body, "type");
114 if (field) {
115 args->type = ast_json_string_get(field);
116 }
117 field = ast_json_object_get(body, "bridgeId");
118 if (field) {
119 args->bridge_id = ast_json_string_get(field);
120 }
121 field = ast_json_object_get(body, "name");
122 if (field) {
123 args->name = ast_json_string_get(field);
124 }
125 return 0;
126}

References args, ast_json_object_get(), and ast_json_string_get().

Referenced by ast_ari_bridges_create_cb().

◆ ast_ari_bridges_create_with_id_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 224 of file res_ari_bridges.c.

228{
230 struct ast_variable *i;
231#if defined(AST_DEVMODE)
232 int is_valid;
233 int code;
234#endif /* AST_DEVMODE */
235
236 for (i = get_params; i; i = i->next) {
237 if (strcmp(i->name, "type") == 0) {
238 args.type = (i->value);
239 } else
240 if (strcmp(i->name, "name") == 0) {
241 args.name = (i->value);
242 } else
243 {}
244 }
245 for (i = path_vars; i; i = i->next) {
246 if (strcmp(i->name, "bridgeId") == 0) {
247 args.bridge_id = (i->value);
248 } else
249 {}
250 }
253 goto fin;
254 }
255 ast_ari_bridges_create_with_id(headers, &args, response);
256#if defined(AST_DEVMODE)
257 code = response->response_code;
258
259 switch (code) {
260 case 0: /* Implementation is still a stub, or the code wasn't set */
261 is_valid = response->message == NULL;
262 break;
263 case 500: /* Internal Server Error */
264 case 501: /* Not Implemented */
265 case 409: /* Bridge with the same bridgeId already exists */
266 is_valid = 1;
267 break;
268 default:
269 if (200 <= code && code <= 299) {
270 is_valid = ast_ari_validate_bridge(
271 response->message);
272 } else {
273 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}\n", code);
274 is_valid = 0;
275 }
276 }
277
278 if (!is_valid) {
279 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}\n");
280 ast_ari_response_error(response, 500,
281 "Internal Server Error", "Response validation failed");
282 }
283#endif /* AST_DEVMODE */
284
285fin: __attribute__((unused))
286 return;
287}
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_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.

References args, ast_ari_bridges_create_with_id(), ast_ari_bridges_create_with_id_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_bridge(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_create_with_id_parse_body()

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}.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 198 of file res_ari_bridges.c.

201{
202 struct ast_json *field;
203 /* Parse query parameters out of it */
204 field = ast_json_object_get(body, "type");
205 if (field) {
206 args->type = ast_json_string_get(field);
207 }
208 field = ast_json_object_get(body, "name");
209 if (field) {
210 args->name = ast_json_string_get(field);
211 }
212 return 0;
213}

References args, ast_json_object_get(), and ast_json_string_get().

Referenced by ast_ari_bridges_create_with_id_cb().

◆ ast_ari_bridges_destroy_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 357 of file res_ari_bridges.c.

361{
363 struct ast_variable *i;
364#if defined(AST_DEVMODE)
365 int is_valid;
366 int code;
367#endif /* AST_DEVMODE */
368
369 for (i = path_vars; i; i = i->next) {
370 if (strcmp(i->name, "bridgeId") == 0) {
371 args.bridge_id = (i->value);
372 } else
373 {}
374 }
375 ast_ari_bridges_destroy(headers, &args, response);
376#if defined(AST_DEVMODE)
377 code = response->response_code;
378
379 switch (code) {
380 case 0: /* Implementation is still a stub, or the code wasn't set */
381 is_valid = response->message == NULL;
382 break;
383 case 500: /* Internal Server Error */
384 case 501: /* Not Implemented */
385 case 404: /* Bridge not found */
386 is_valid = 1;
387 break;
388 default:
389 if (200 <= code && code <= 299) {
390 is_valid = ast_ari_validate_void(
391 response->message);
392 } else {
393 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}\n", code);
394 is_valid = 0;
395 }
396 }
397
398 if (!is_valid) {
399 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}\n");
400 ast_ari_response_error(response, 500,
401 "Internal Server Error", "Response validation failed");
402 }
403#endif /* AST_DEVMODE */
404
405fin: __attribute__((unused))
406 return;
407}
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.

References args, ast_ari_bridges_destroy(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_get_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 297 of file res_ari_bridges.c.

301{
302 struct ast_ari_bridges_get_args args = {};
303 struct ast_variable *i;
304#if defined(AST_DEVMODE)
305 int is_valid;
306 int code;
307#endif /* AST_DEVMODE */
308
309 for (i = path_vars; i; i = i->next) {
310 if (strcmp(i->name, "bridgeId") == 0) {
311 args.bridge_id = (i->value);
312 } else
313 {}
314 }
315 ast_ari_bridges_get(headers, &args, response);
316#if defined(AST_DEVMODE)
317 code = response->response_code;
318
319 switch (code) {
320 case 0: /* Implementation is still a stub, or the code wasn't set */
321 is_valid = response->message == NULL;
322 break;
323 case 500: /* Internal Server Error */
324 case 501: /* Not Implemented */
325 case 404: /* Bridge not found */
326 is_valid = 1;
327 break;
328 default:
329 if (200 <= code && code <= 299) {
330 is_valid = ast_ari_validate_bridge(
331 response->message);
332 } else {
333 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}\n", code);
334 is_valid = 0;
335 }
336 }
337
338 if (!is_valid) {
339 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}\n");
340 ast_ari_response_error(response, 500,
341 "Internal Server Error", "Response validation failed");
342 }
343#endif /* AST_DEVMODE */
344
345fin: __attribute__((unused))
346 return;
347}
void ast_ari_bridges_get(struct ast_variable *headers, struct ast_ari_bridges_get_args *args, struct ast_ari_response *response)
Get bridge details.

References args, ast_ari_bridges_get(), ast_ari_response_error(), ast_ari_validate_bridge(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_list_cb()

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 
)
static

Parameter parsing callback for /bridges.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 64 of file res_ari_bridges.c.

68{
70#if defined(AST_DEVMODE)
71 int is_valid;
72 int code;
73#endif /* AST_DEVMODE */
74
75 ast_ari_bridges_list(headers, &args, response);
76#if defined(AST_DEVMODE)
77 code = response->response_code;
78
79 switch (code) {
80 case 0: /* Implementation is still a stub, or the code wasn't set */
81 is_valid = response->message == NULL;
82 break;
83 case 500: /* Internal Server Error */
84 case 501: /* Not Implemented */
85 is_valid = 1;
86 break;
87 default:
88 if (200 <= code && code <= 299) {
89 is_valid = ast_ari_validate_list(response->message,
91 } else {
92 ast_log(LOG_ERROR, "Invalid error response %d for /bridges\n", code);
93 is_valid = 0;
94 }
95 }
96
97 if (!is_valid) {
98 ast_log(LOG_ERROR, "Response validation failed for /bridges\n");
99 ast_ari_response_error(response, 500,
100 "Internal Server Error", "Response validation failed");
101 }
102#endif /* AST_DEVMODE */
103
104fin: __attribute__((unused))
105 return;
106}
ari_validator ast_ari_validate_bridge_fn(void)
Function pointer to ast_ari_validate_bridge().
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
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.

References args, ast_ari_bridges_list(), ast_ari_response_error(), ast_ari_validate_bridge_fn(), ast_ari_validate_list(), ast_log, LOG_ERROR, ast_ari_response::message, NULL, and ast_ari_response::response_code.

◆ ast_ari_bridges_play_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/play.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 1079 of file res_ari_bridges.c.

1083{
1084 struct ast_ari_bridges_play_args args = {};
1085 struct ast_variable *i;
1086#if defined(AST_DEVMODE)
1087 int is_valid;
1088 int code;
1089#endif /* AST_DEVMODE */
1090
1091 for (i = get_params; i; i = i->next) {
1092 if (strcmp(i->name, "media") == 0) {
1093 /* Parse comma separated list */
1094 char *vals[MAX_VALS];
1095 size_t j;
1096
1097 args.media_parse = ast_strdup(i->value);
1098 if (!args.media_parse) {
1100 goto fin;
1101 }
1102
1103 if (strlen(args.media_parse) == 0) {
1104 /* ast_app_separate_args can't handle "" */
1105 args.media_count = 1;
1106 vals[0] = args.media_parse;
1107 } else {
1108 args.media_count = ast_app_separate_args(
1109 args.media_parse, ',', vals,
1110 ARRAY_LEN(vals));
1111 }
1112
1113 if (args.media_count == 0) {
1115 goto fin;
1116 }
1117
1118 if (args.media_count >= MAX_VALS) {
1119 ast_ari_response_error(response, 400,
1120 "Bad Request",
1121 "Too many values for media");
1122 goto fin;
1123 }
1124
1125 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
1126 if (!args.media) {
1128 goto fin;
1129 }
1130
1131 for (j = 0; j < args.media_count; ++j) {
1132 args.media[j] = (vals[j]);
1133 }
1134 } else
1135 if (strcmp(i->name, "announcer_format") == 0) {
1136 args.announcer_format = (i->value);
1137 } else
1138 if (strcmp(i->name, "lang") == 0) {
1139 args.lang = (i->value);
1140 } else
1141 if (strcmp(i->name, "offsetms") == 0) {
1142 args.offsetms = atoi(i->value);
1143 } else
1144 if (strcmp(i->name, "skipms") == 0) {
1145 args.skipms = atoi(i->value);
1146 } else
1147 if (strcmp(i->name, "playbackId") == 0) {
1148 args.playback_id = (i->value);
1149 } else
1150 {}
1151 }
1152 for (i = path_vars; i; i = i->next) {
1153 if (strcmp(i->name, "bridgeId") == 0) {
1154 args.bridge_id = (i->value);
1155 } else
1156 {}
1157 }
1160 goto fin;
1161 }
1162 ast_ari_bridges_play(headers, &args, response);
1163#if defined(AST_DEVMODE)
1164 code = response->response_code;
1165
1166 switch (code) {
1167 case 0: /* Implementation is still a stub, or the code wasn't set */
1168 is_valid = response->message == NULL;
1169 break;
1170 case 500: /* Internal Server Error */
1171 case 501: /* Not Implemented */
1172 case 404: /* Bridge not found */
1173 case 409: /* Bridge not in a Stasis application */
1174 case 422: /* The format specified is unknown on this system */
1175 is_valid = 1;
1176 break;
1177 default:
1178 if (200 <= code && code <= 299) {
1179 is_valid = ast_ari_validate_playback(
1180 response->message);
1181 } else {
1182 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/play\n", code);
1183 is_valid = 0;
1184 }
1185 }
1186
1187 if (!is_valid) {
1188 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/play\n");
1189 ast_ari_response_error(response, 500,
1190 "Internal Server Error", "Response validation failed");
1191 }
1192#endif /* AST_DEVMODE */
1193
1194fin: __attribute__((unused))
1195 ast_free(args.media_parse);
1196 ast_free(args.media);
1197 return;
1198}
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
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_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.

References args, ARRAY_LEN, ast_app_separate_args, ast_ari_bridges_play(), ast_ari_bridges_play_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_playback(), ast_free, ast_log, ast_malloc, ast_strdup, LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_play_parse_body()

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.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 1012 of file res_ari_bridges.c.

1015{
1016 struct ast_json *field;
1017 /* Parse query parameters out of it */
1018 field = ast_json_object_get(body, "media");
1019 if (field) {
1020 /* If they were silly enough to both pass in a query param and a
1021 * JSON body, free up the query value.
1022 */
1023 ast_free(args->media);
1024 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
1025 /* Multiple param passed as array */
1026 size_t i;
1027 args->media_count = ast_json_array_size(field);
1028 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1029
1030 if (!args->media) {
1031 return -1;
1032 }
1033
1034 for (i = 0; i < args->media_count; ++i) {
1035 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
1036 }
1037 } else {
1038 /* Multiple param passed as single value */
1039 args->media_count = 1;
1040 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1041 if (!args->media) {
1042 return -1;
1043 }
1044 args->media[0] = ast_json_string_get(field);
1045 }
1046 }
1047 field = ast_json_object_get(body, "announcer_format");
1048 if (field) {
1049 args->announcer_format = ast_json_string_get(field);
1050 }
1051 field = ast_json_object_get(body, "lang");
1052 if (field) {
1053 args->lang = ast_json_string_get(field);
1054 }
1055 field = ast_json_object_get(body, "offsetms");
1056 if (field) {
1057 args->offsetms = ast_json_integer_get(field);
1058 }
1059 field = ast_json_object_get(body, "skipms");
1060 if (field) {
1061 args->skipms = ast_json_integer_get(field);
1062 }
1063 field = ast_json_object_get(body, "playbackId");
1064 if (field) {
1065 args->playback_id = ast_json_string_get(field);
1066 }
1067 return 0;
1068}
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
Definition json.c:332

References args, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_integer_get(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.

Referenced by ast_ari_bridges_play_cb().

◆ ast_ari_bridges_play_with_id_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/play/{playbackId}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 1262 of file res_ari_bridges.c.

1266{
1268 struct ast_variable *i;
1269#if defined(AST_DEVMODE)
1270 int is_valid;
1271 int code;
1272#endif /* AST_DEVMODE */
1273
1274 for (i = get_params; i; i = i->next) {
1275 if (strcmp(i->name, "media") == 0) {
1276 /* Parse comma separated list */
1277 char *vals[MAX_VALS];
1278 size_t j;
1279
1280 args.media_parse = ast_strdup(i->value);
1281 if (!args.media_parse) {
1283 goto fin;
1284 }
1285
1286 if (strlen(args.media_parse) == 0) {
1287 /* ast_app_separate_args can't handle "" */
1288 args.media_count = 1;
1289 vals[0] = args.media_parse;
1290 } else {
1291 args.media_count = ast_app_separate_args(
1292 args.media_parse, ',', vals,
1293 ARRAY_LEN(vals));
1294 }
1295
1296 if (args.media_count == 0) {
1298 goto fin;
1299 }
1300
1301 if (args.media_count >= MAX_VALS) {
1302 ast_ari_response_error(response, 400,
1303 "Bad Request",
1304 "Too many values for media");
1305 goto fin;
1306 }
1307
1308 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
1309 if (!args.media) {
1311 goto fin;
1312 }
1313
1314 for (j = 0; j < args.media_count; ++j) {
1315 args.media[j] = (vals[j]);
1316 }
1317 } else
1318 if (strcmp(i->name, "announcer_format") == 0) {
1319 args.announcer_format = (i->value);
1320 } else
1321 if (strcmp(i->name, "lang") == 0) {
1322 args.lang = (i->value);
1323 } else
1324 if (strcmp(i->name, "offsetms") == 0) {
1325 args.offsetms = atoi(i->value);
1326 } else
1327 if (strcmp(i->name, "skipms") == 0) {
1328 args.skipms = atoi(i->value);
1329 } else
1330 {}
1331 }
1332 for (i = path_vars; i; i = i->next) {
1333 if (strcmp(i->name, "bridgeId") == 0) {
1334 args.bridge_id = (i->value);
1335 } else
1336 if (strcmp(i->name, "playbackId") == 0) {
1337 args.playback_id = (i->value);
1338 } else
1339 {}
1340 }
1343 goto fin;
1344 }
1345 ast_ari_bridges_play_with_id(headers, &args, response);
1346#if defined(AST_DEVMODE)
1347 code = response->response_code;
1348
1349 switch (code) {
1350 case 0: /* Implementation is still a stub, or the code wasn't set */
1351 is_valid = response->message == NULL;
1352 break;
1353 case 500: /* Internal Server Error */
1354 case 501: /* Not Implemented */
1355 case 404: /* Bridge not found */
1356 case 409: /* Bridge not in a Stasis application */
1357 case 422: /* The format specified is unknown on this system */
1358 is_valid = 1;
1359 break;
1360 default:
1361 if (200 <= code && code <= 299) {
1362 is_valid = ast_ari_validate_playback(
1363 response->message);
1364 } else {
1365 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/play/{playbackId}\n", code);
1366 is_valid = 0;
1367 }
1368 }
1369
1370 if (!is_valid) {
1371 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/play/{playbackId}\n");
1372 ast_ari_response_error(response, 500,
1373 "Internal Server Error", "Response validation failed");
1374 }
1375#endif /* AST_DEVMODE */
1376
1377fin: __attribute__((unused))
1378 ast_free(args.media_parse);
1379 ast_free(args.media);
1380 return;
1381}
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}.
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.

References args, ARRAY_LEN, ast_app_separate_args, ast_ari_bridges_play_with_id(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_playback(), ast_free, ast_log, ast_malloc, ast_strdup, LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_play_with_id_parse_body()

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}.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 1199 of file res_ari_bridges.c.

1202{
1203 struct ast_json *field;
1204 /* Parse query parameters out of it */
1205 field = ast_json_object_get(body, "media");
1206 if (field) {
1207 /* If they were silly enough to both pass in a query param and a
1208 * JSON body, free up the query value.
1209 */
1210 ast_free(args->media);
1211 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
1212 /* Multiple param passed as array */
1213 size_t i;
1214 args->media_count = ast_json_array_size(field);
1215 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1216
1217 if (!args->media) {
1218 return -1;
1219 }
1220
1221 for (i = 0; i < args->media_count; ++i) {
1222 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
1223 }
1224 } else {
1225 /* Multiple param passed as single value */
1226 args->media_count = 1;
1227 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1228 if (!args->media) {
1229 return -1;
1230 }
1231 args->media[0] = ast_json_string_get(field);
1232 }
1233 }
1234 field = ast_json_object_get(body, "announcer_format");
1235 if (field) {
1236 args->announcer_format = ast_json_string_get(field);
1237 }
1238 field = ast_json_object_get(body, "lang");
1239 if (field) {
1240 args->lang = ast_json_string_get(field);
1241 }
1242 field = ast_json_object_get(body, "offsetms");
1243 if (field) {
1244 args->offsetms = ast_json_integer_get(field);
1245 }
1246 field = ast_json_object_get(body, "skipms");
1247 if (field) {
1248 args->skipms = ast_json_integer_get(field);
1249 }
1250 return 0;
1251}

References args, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_integer_get(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.

Referenced by ast_ari_bridges_play_with_id_cb().

◆ ast_ari_bridges_record_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/record.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 1432 of file res_ari_bridges.c.

1436{
1438 struct ast_variable *i;
1439#if defined(AST_DEVMODE)
1440 int is_valid;
1441 int code;
1442#endif /* AST_DEVMODE */
1443
1444 for (i = get_params; i; i = i->next) {
1445 if (strcmp(i->name, "name") == 0) {
1446 args.name = (i->value);
1447 } else
1448 if (strcmp(i->name, "format") == 0) {
1449 args.format = (i->value);
1450 } else
1451 if (strcmp(i->name, "recorder_format") == 0) {
1452 args.recorder_format = (i->value);
1453 } else
1454 if (strcmp(i->name, "maxDurationSeconds") == 0) {
1455 args.max_duration_seconds = atoi(i->value);
1456 } else
1457 if (strcmp(i->name, "maxSilenceSeconds") == 0) {
1458 args.max_silence_seconds = atoi(i->value);
1459 } else
1460 if (strcmp(i->name, "ifExists") == 0) {
1461 args.if_exists = (i->value);
1462 } else
1463 if (strcmp(i->name, "beep") == 0) {
1464 args.beep = ast_true(i->value);
1465 } else
1466 if (strcmp(i->name, "terminateOn") == 0) {
1467 args.terminate_on = (i->value);
1468 } else
1469 {}
1470 }
1471 for (i = path_vars; i; i = i->next) {
1472 if (strcmp(i->name, "bridgeId") == 0) {
1473 args.bridge_id = (i->value);
1474 } else
1475 {}
1476 }
1479 goto fin;
1480 }
1481 ast_ari_bridges_record(headers, &args, response);
1482#if defined(AST_DEVMODE)
1483 code = response->response_code;
1484
1485 switch (code) {
1486 case 0: /* Implementation is still a stub, or the code wasn't set */
1487 is_valid = response->message == NULL;
1488 break;
1489 case 500: /* Internal Server Error */
1490 case 501: /* Not Implemented */
1491 case 400: /* Invalid parameters */
1492 case 404: /* Bridge not found */
1493 case 409: /* Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
1494 case 422: /* The format specified is unknown on this system */
1495 is_valid = 1;
1496 break;
1497 default:
1498 if (200 <= code && code <= 299) {
1500 response->message);
1501 } else {
1502 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/record\n", code);
1503 is_valid = 0;
1504 }
1505 }
1506
1507 if (!is_valid) {
1508 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/record\n");
1509 ast_ari_response_error(response, 500,
1510 "Internal Server Error", "Response validation failed");
1511 }
1512#endif /* AST_DEVMODE */
1513
1514fin: __attribute__((unused))
1515 return;
1516}
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.
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.
void ast_ari_bridges_record(struct ast_variable *headers, struct ast_ari_bridges_record_args *args, struct ast_ari_response *response)
Start a recording.

References args, ast_ari_bridges_record(), ast_ari_bridges_record_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_live_recording(), ast_log, ast_true(), LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_record_parse_body()

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.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 1382 of file res_ari_bridges.c.

1385{
1386 struct ast_json *field;
1387 /* Parse query parameters out of it */
1388 field = ast_json_object_get(body, "name");
1389 if (field) {
1390 args->name = ast_json_string_get(field);
1391 }
1392 field = ast_json_object_get(body, "format");
1393 if (field) {
1394 args->format = ast_json_string_get(field);
1395 }
1396 field = ast_json_object_get(body, "recorder_format");
1397 if (field) {
1398 args->recorder_format = ast_json_string_get(field);
1399 }
1400 field = ast_json_object_get(body, "maxDurationSeconds");
1401 if (field) {
1402 args->max_duration_seconds = ast_json_integer_get(field);
1403 }
1404 field = ast_json_object_get(body, "maxSilenceSeconds");
1405 if (field) {
1406 args->max_silence_seconds = ast_json_integer_get(field);
1407 }
1408 field = ast_json_object_get(body, "ifExists");
1409 if (field) {
1410 args->if_exists = ast_json_string_get(field);
1411 }
1412 field = ast_json_object_get(body, "beep");
1413 if (field) {
1414 args->beep = ast_json_is_true(field);
1415 }
1416 field = ast_json_object_get(body, "terminateOn");
1417 if (field) {
1418 args->terminate_on = ast_json_string_get(field);
1419 }
1420 return 0;
1421}

References args, ast_json_integer_get(), ast_json_is_true(), ast_json_object_get(), and ast_json_string_get().

Referenced by ast_ari_bridges_record_cb().

◆ ast_ari_bridges_remove_channel_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/removeChannel.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 636 of file res_ari_bridges.c.

640{
642 struct ast_variable *i;
643#if defined(AST_DEVMODE)
644 int is_valid;
645 int code;
646#endif /* AST_DEVMODE */
647
648 for (i = get_params; i; i = i->next) {
649 if (strcmp(i->name, "channel") == 0) {
650 /* Parse comma separated list */
651 char *vals[MAX_VALS];
652 size_t j;
653
654 args.channel_parse = ast_strdup(i->value);
655 if (!args.channel_parse) {
657 goto fin;
658 }
659
660 if (strlen(args.channel_parse) == 0) {
661 /* ast_app_separate_args can't handle "" */
662 args.channel_count = 1;
663 vals[0] = args.channel_parse;
664 } else {
665 args.channel_count = ast_app_separate_args(
666 args.channel_parse, ',', vals,
667 ARRAY_LEN(vals));
668 }
669
670 if (args.channel_count == 0) {
672 goto fin;
673 }
674
675 if (args.channel_count >= MAX_VALS) {
676 ast_ari_response_error(response, 400,
677 "Bad Request",
678 "Too many values for channel");
679 goto fin;
680 }
681
682 args.channel = ast_malloc(sizeof(*args.channel) * args.channel_count);
683 if (!args.channel) {
685 goto fin;
686 }
687
688 for (j = 0; j < args.channel_count; ++j) {
689 args.channel[j] = (vals[j]);
690 }
691 } else
692 {}
693 }
694 for (i = path_vars; i; i = i->next) {
695 if (strcmp(i->name, "bridgeId") == 0) {
696 args.bridge_id = (i->value);
697 } else
698 {}
699 }
702 goto fin;
703 }
704 ast_ari_bridges_remove_channel(headers, &args, response);
705#if defined(AST_DEVMODE)
706 code = response->response_code;
707
708 switch (code) {
709 case 0: /* Implementation is still a stub, or the code wasn't set */
710 is_valid = response->message == NULL;
711 break;
712 case 500: /* Internal Server Error */
713 case 501: /* Not Implemented */
714 case 400: /* Channel not found */
715 case 404: /* Bridge not found */
716 case 409: /* Bridge not in Stasis application */
717 case 422: /* Channel not in this bridge */
718 is_valid = 1;
719 break;
720 default:
721 if (200 <= code && code <= 299) {
722 is_valid = ast_ari_validate_void(
723 response->message);
724 } else {
725 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/removeChannel\n", code);
726 is_valid = 0;
727 }
728 }
729
730 if (!is_valid) {
731 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/removeChannel\n");
732 ast_ari_response_error(response, 500,
733 "Internal Server Error", "Response validation failed");
734 }
735#endif /* AST_DEVMODE */
736
737fin: __attribute__((unused))
738 ast_free(args.channel_parse);
739 ast_free(args.channel);
740 return;
741}
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.
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.

References args, ARRAY_LEN, ast_app_separate_args, ast_ari_bridges_remove_channel(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_void(), ast_free, ast_log, ast_malloc, ast_strdup, LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_remove_channel_parse_body()

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.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 589 of file res_ari_bridges.c.

592{
593 struct ast_json *field;
594 /* Parse query parameters out of it */
595 field = ast_json_object_get(body, "channel");
596 if (field) {
597 /* If they were silly enough to both pass in a query param and a
598 * JSON body, free up the query value.
599 */
600 ast_free(args->channel);
601 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
602 /* Multiple param passed as array */
603 size_t i;
604 args->channel_count = ast_json_array_size(field);
605 args->channel = ast_malloc(sizeof(*args->channel) * args->channel_count);
606
607 if (!args->channel) {
608 return -1;
609 }
610
611 for (i = 0; i < args->channel_count; ++i) {
612 args->channel[i] = ast_json_string_get(ast_json_array_get(field, i));
613 }
614 } else {
615 /* Multiple param passed as single value */
616 args->channel_count = 1;
617 args->channel = ast_malloc(sizeof(*args->channel) * args->channel_count);
618 if (!args->channel) {
619 return -1;
620 }
621 args->channel[0] = ast_json_string_get(field);
622 }
623 }
624 return 0;
625}

References args, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.

Referenced by ast_ari_bridges_remove_channel_cb().

◆ ast_ari_bridges_set_video_source_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/videoSource/{channelId}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 751 of file res_ari_bridges.c.

755{
757 struct ast_variable *i;
758#if defined(AST_DEVMODE)
759 int is_valid;
760 int code;
761#endif /* AST_DEVMODE */
762
763 for (i = path_vars; i; i = i->next) {
764 if (strcmp(i->name, "bridgeId") == 0) {
765 args.bridge_id = (i->value);
766 } else
767 if (strcmp(i->name, "channelId") == 0) {
768 args.channel_id = (i->value);
769 } else
770 {}
771 }
772 ast_ari_bridges_set_video_source(headers, &args, response);
773#if defined(AST_DEVMODE)
774 code = response->response_code;
775
776 switch (code) {
777 case 0: /* Implementation is still a stub, or the code wasn't set */
778 is_valid = response->message == NULL;
779 break;
780 case 500: /* Internal Server Error */
781 case 501: /* Not Implemented */
782 case 404: /* Bridge or Channel not found */
783 case 409: /* Channel not in Stasis application */
784 case 422: /* Channel not in this Bridge */
785 is_valid = 1;
786 break;
787 default:
788 if (200 <= code && code <= 299) {
789 is_valid = ast_ari_validate_void(
790 response->message);
791 } else {
792 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/videoSource/{channelId}\n", code);
793 is_valid = 0;
794 }
795 }
796
797 if (!is_valid) {
798 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/videoSource/{channelId}\n");
799 ast_ari_response_error(response, 500,
800 "Internal Server Error", "Response validation failed");
801 }
802#endif /* AST_DEVMODE */
803
804fin: __attribute__((unused))
805 return;
806}
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...

References args, ast_ari_bridges_set_video_source(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_start_moh_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/moh.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 889 of file res_ari_bridges.c.

893{
895 struct ast_variable *i;
896#if defined(AST_DEVMODE)
897 int is_valid;
898 int code;
899#endif /* AST_DEVMODE */
900
901 for (i = get_params; i; i = i->next) {
902 if (strcmp(i->name, "mohClass") == 0) {
903 args.moh_class = (i->value);
904 } else
905 {}
906 }
907 for (i = path_vars; i; i = i->next) {
908 if (strcmp(i->name, "bridgeId") == 0) {
909 args.bridge_id = (i->value);
910 } else
911 {}
912 }
915 goto fin;
916 }
917 ast_ari_bridges_start_moh(headers, &args, response);
918#if defined(AST_DEVMODE)
919 code = response->response_code;
920
921 switch (code) {
922 case 0: /* Implementation is still a stub, or the code wasn't set */
923 is_valid = response->message == NULL;
924 break;
925 case 500: /* Internal Server Error */
926 case 501: /* Not Implemented */
927 case 404: /* Bridge not found */
928 case 409: /* Bridge not in Stasis application */
929 is_valid = 1;
930 break;
931 default:
932 if (200 <= code && code <= 299) {
933 is_valid = ast_ari_validate_void(
934 response->message);
935 } else {
936 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
937 is_valid = 0;
938 }
939 }
940
941 if (!is_valid) {
942 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/moh\n");
943 ast_ari_response_error(response, 500,
944 "Internal Server Error", "Response validation failed");
945 }
946#endif /* AST_DEVMODE */
947
948fin: __attribute__((unused))
949 return;
950}
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.

References args, ast_ari_bridges_start_moh(), ast_ari_bridges_start_moh_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_bridges_start_moh_parse_body()

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.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 867 of file res_ari_bridges.c.

870{
871 struct ast_json *field;
872 /* Parse query parameters out of it */
873 field = ast_json_object_get(body, "mohClass");
874 if (field) {
875 args->moh_class = ast_json_string_get(field);
876 }
877 return 0;
878}

References args, ast_json_object_get(), and ast_json_string_get().

Referenced by ast_ari_bridges_start_moh_cb().

◆ ast_ari_bridges_stop_moh_cb()

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 
)
static

Parameter parsing callback for /bridges/{bridgeId}/moh.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 960 of file res_ari_bridges.c.

964{
966 struct ast_variable *i;
967#if defined(AST_DEVMODE)
968 int is_valid;
969 int code;
970#endif /* AST_DEVMODE */
971
972 for (i = path_vars; i; i = i->next) {
973 if (strcmp(i->name, "bridgeId") == 0) {
974 args.bridge_id = (i->value);
975 } else
976 {}
977 }
978 ast_ari_bridges_stop_moh(headers, &args, response);
979#if defined(AST_DEVMODE)
980 code = response->response_code;
981
982 switch (code) {
983 case 0: /* Implementation is still a stub, or the code wasn't set */
984 is_valid = response->message == NULL;
985 break;
986 case 500: /* Internal Server Error */
987 case 501: /* Not Implemented */
988 case 404: /* Bridge not found */
989 case 409: /* Bridge not in Stasis application */
990 is_valid = 1;
991 break;
992 default:
993 if (200 <= code && code <= 299) {
994 is_valid = ast_ari_validate_void(
995 response->message);
996 } else {
997 ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
998 is_valid = 0;
999 }
1000 }
1001
1002 if (!is_valid) {
1003 ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/moh\n");
1004 ast_ari_response_error(response, 500,
1005 "Internal Server Error", "Response validation failed");
1006 }
1007#endif /* AST_DEVMODE */
1008
1009fin: __attribute__((unused))
1010 return;
1011}
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.

References args, ast_ari_bridges_stop_moh(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 1641 of file res_ari_bridges.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 1622 of file res_ari_bridges.c.

1623{
1624 int res = 0;
1625
1626
1628 if (res) {
1629 unload_module();
1631 }
1632
1634}
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition res_ari.c:132
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
static int unload_module(void)
static struct stasis_rest_handlers bridges
REST handler for /api-docs/bridges.json.

References ast_ari_add_handler(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, bridges, and unload_module().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 1616 of file res_ari_bridges.c.

1617{
1619 return 0;
1620}
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
Definition res_ari.c:155

References ast_ari_remove_handler(), and bridges.

Referenced by load_module().

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Bridge resources" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_recording,res_stasis_playback", }
static

Definition at line 1641 of file res_ari_bridges.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 1641 of file res_ari_bridges.c.

◆ bridges

struct stasis_rest_handlers bridges
static

REST handler for /api-docs/bridges.json.

Definition at line 1606 of file res_ari_bridges.c.

1606 {
1607 .path_segment = "bridges",
1608 .callbacks = {
1611 },
1612 .num_children = 1,
1613 .children = { &bridges_bridgeId, }
1614};
@ AST_HTTP_POST
Definition http.h:61
@ AST_HTTP_GET
Definition http.h:60
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.
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.
static struct stasis_rest_handlers bridges_bridgeId
REST handler for /api-docs/bridges.json.

Referenced by load_module(), and unload_module().

◆ bridges_bridgeId

struct stasis_rest_handlers bridges_bridgeId
static

REST handler for /api-docs/bridges.json.

Definition at line 1594 of file res_ari_bridges.c.

1594 {
1595 .path_segment = "bridgeId",
1596 .is_wildcard = 1,
1597 .callbacks = {
1601 },
1602 .num_children = 6,
1604};
@ AST_HTTP_DELETE
Definition http.h:64
static struct stasis_rest_handlers bridges_bridgeId_play
REST handler for /api-docs/bridges.json.
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}.
static struct stasis_rest_handlers bridges_bridgeId_record
REST handler for /api-docs/bridges.json.
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}.
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}.
static struct stasis_rest_handlers bridges_bridgeId_addChannel
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_moh
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_removeChannel
REST handler for /api-docs/bridges.json.
static struct stasis_rest_handlers bridges_bridgeId_videoSource
REST handler for /api-docs/bridges.json.

◆ bridges_bridgeId_addChannel

struct stasis_rest_handlers bridges_bridgeId_addChannel
static

REST handler for /api-docs/bridges.json.

Definition at line 1519 of file res_ari_bridges.c.

1519 {
1520 .path_segment = "addChannel",
1521 .callbacks = {
1523 },
1524 .num_children = 0,
1525 .children = { }
1526};
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.

◆ bridges_bridgeId_moh

struct stasis_rest_handlers bridges_bridgeId_moh
static

REST handler for /api-docs/bridges.json.

Definition at line 1556 of file res_ari_bridges.c.

1556 {
1557 .path_segment = "moh",
1558 .callbacks = {
1561 },
1562 .num_children = 0,
1563 .children = { }
1564};
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.
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.

◆ bridges_bridgeId_play

struct stasis_rest_handlers bridges_bridgeId_play
static

REST handler for /api-docs/bridges.json.

Definition at line 1576 of file res_ari_bridges.c.

1576 {
1577 .path_segment = "play",
1578 .callbacks = {
1580 },
1581 .num_children = 1,
1582 .children = { &bridges_bridgeId_play_playbackId, }
1583};
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.
static struct stasis_rest_handlers bridges_bridgeId_play_playbackId
REST handler for /api-docs/bridges.json.

◆ bridges_bridgeId_play_playbackId

struct stasis_rest_handlers bridges_bridgeId_play_playbackId
static

REST handler for /api-docs/bridges.json.

Definition at line 1566 of file res_ari_bridges.c.

1566 {
1567 .path_segment = "playbackId",
1568 .is_wildcard = 1,
1569 .callbacks = {
1571 },
1572 .num_children = 0,
1573 .children = { }
1574};
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}.

◆ bridges_bridgeId_record

struct stasis_rest_handlers bridges_bridgeId_record
static

REST handler for /api-docs/bridges.json.

Definition at line 1585 of file res_ari_bridges.c.

1585 {
1586 .path_segment = "record",
1587 .callbacks = {
1589 },
1590 .num_children = 0,
1591 .children = { }
1592};
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.

◆ bridges_bridgeId_removeChannel

struct stasis_rest_handlers bridges_bridgeId_removeChannel
static

REST handler for /api-docs/bridges.json.

Definition at line 1528 of file res_ari_bridges.c.

1528 {
1529 .path_segment = "removeChannel",
1530 .callbacks = {
1532 },
1533 .num_children = 0,
1534 .children = { }
1535};
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.

◆ bridges_bridgeId_videoSource

struct stasis_rest_handlers bridges_bridgeId_videoSource
static

REST handler for /api-docs/bridges.json.

Definition at line 1547 of file res_ari_bridges.c.

1547 {
1548 .path_segment = "videoSource",
1549 .callbacks = {
1551 },
1552 .num_children = 1,
1554};
static struct stasis_rest_handlers bridges_bridgeId_videoSource_channelId
REST handler for /api-docs/bridges.json.
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.

◆ bridges_bridgeId_videoSource_channelId

struct stasis_rest_handlers bridges_bridgeId_videoSource_channelId
static

REST handler for /api-docs/bridges.json.

Definition at line 1537 of file res_ari_bridges.c.

1537 {
1538 .path_segment = "channelId",
1539 .is_wildcard = 1,
1540 .callbacks = {
1542 },
1543 .num_children = 0,
1544 .children = { }
1545};
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}.