Asterisk - The Open Source Telephony Project GIT-master-7e7a603
res_ari_channels.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2012 - 2013, Digium, Inc.
5 *
6 * David M. Lee, II <dlee@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*
20 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21 * !!!!! DO NOT EDIT !!!!!
22 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23 * This file is generated by a mustache template. Please see the original
24 * template in rest-api-templates/res_ari_resource.c.mustache
25 */
26
27/*! \file
28 *
29 * \brief Channel resources
30 *
31 * \author David M. Lee, II <dlee@digium.com>
32 */
33
34/*** MODULEINFO
35 <depend type="module">res_ari</depend>
36 <depend type="module">res_ari_model</depend>
37 <depend type="module">res_stasis</depend>
38 <depend type="module">res_stasis_answer</depend>
39 <depend type="module">res_stasis_playback</depend>
40 <depend type="module">res_stasis_recording</depend>
41 <depend type="module">res_stasis_snoop</depend>
42 <support_level>core</support_level>
43 ***/
44
45#include "asterisk.h"
46
47#include "asterisk/app.h"
48#include "asterisk/module.h"
49#include "asterisk/stasis_app.h"
51#if defined(AST_DEVMODE)
53#endif
54
55#define MAX_VALS 128
56
57/*!
58 * \brief Parameter parsing callback for /channels.
59 * \param ser TCP/TLS session object
60 * \param get_params GET parameters in the HTTP request.
61 * \param path_vars Path variables extracted from the request.
62 * \param headers HTTP headers.
63 * \param body
64 * \param[out] response Response to the HTTP request.
65 */
68 struct ast_variable *get_params, struct ast_variable *path_vars,
69 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
70{
72#if defined(AST_DEVMODE)
73 int is_valid;
74 int code;
75#endif /* AST_DEVMODE */
76
77 ast_ari_channels_list(headers, &args, response);
78#if defined(AST_DEVMODE)
79 code = response->response_code;
80
81 switch (code) {
82 case 0: /* Implementation is still a stub, or the code wasn't set */
83 is_valid = response->message == NULL;
84 break;
85 case 500: /* Internal Server Error */
86 case 501: /* Not Implemented */
87 is_valid = 1;
88 break;
89 default:
90 if (200 <= code && code <= 299) {
91 is_valid = ast_ari_validate_list(response->message,
93 } else {
94 ast_log(LOG_ERROR, "Invalid error response %d for /channels\n", code);
95 is_valid = 0;
96 }
97 }
98
99 if (!is_valid) {
100 ast_log(LOG_ERROR, "Response validation failed for /channels\n");
101 ast_ari_response_error(response, 500,
102 "Internal Server Error", "Response validation failed");
103 }
104#endif /* AST_DEVMODE */
105
106fin: __attribute__((unused))
107 return;
108}
110 struct ast_json *body,
112{
113 struct ast_json *field;
114 /* Parse query parameters out of it */
115 field = ast_json_object_get(body, "endpoint");
116 if (field) {
117 args->endpoint = ast_json_string_get(field);
118 }
119 field = ast_json_object_get(body, "extension");
120 if (field) {
121 args->extension = ast_json_string_get(field);
122 }
123 field = ast_json_object_get(body, "context");
124 if (field) {
125 args->context = ast_json_string_get(field);
126 }
127 field = ast_json_object_get(body, "priority");
128 if (field) {
129 args->priority = ast_json_integer_get(field);
130 }
131 field = ast_json_object_get(body, "label");
132 if (field) {
133 args->label = ast_json_string_get(field);
134 }
135 field = ast_json_object_get(body, "app");
136 if (field) {
137 args->app = ast_json_string_get(field);
138 }
139 field = ast_json_object_get(body, "appArgs");
140 if (field) {
141 args->app_args = ast_json_string_get(field);
142 }
143 field = ast_json_object_get(body, "callerId");
144 if (field) {
145 args->caller_id = ast_json_string_get(field);
146 }
147 field = ast_json_object_get(body, "timeout");
148 if (field) {
149 args->timeout = ast_json_integer_get(field);
150 }
151 field = ast_json_object_get(body, "channelId");
152 if (field) {
153 args->channel_id = ast_json_string_get(field);
154 }
155 field = ast_json_object_get(body, "otherChannelId");
156 if (field) {
157 args->other_channel_id = ast_json_string_get(field);
158 }
159 field = ast_json_object_get(body, "originator");
160 if (field) {
161 args->originator = ast_json_string_get(field);
162 }
163 field = ast_json_object_get(body, "formats");
164 if (field) {
165 args->formats = ast_json_string_get(field);
166 }
167 return 0;
168}
169
170/*!
171 * \brief Parameter parsing callback for /channels.
172 * \param ser TCP/TLS session object
173 * \param get_params GET parameters in the HTTP request.
174 * \param path_vars Path variables extracted from the request.
175 * \param headers HTTP headers.
176 * \param body
177 * \param[out] response Response to the HTTP request.
178 */
180 struct ast_tcptls_session_instance *ser,
181 struct ast_variable *get_params, struct ast_variable *path_vars,
182 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
183{
185 struct ast_variable *i;
186#if defined(AST_DEVMODE)
187 int is_valid;
188 int code;
189#endif /* AST_DEVMODE */
190
191 for (i = get_params; i; i = i->next) {
192 if (strcmp(i->name, "endpoint") == 0) {
193 args.endpoint = (i->value);
194 } else
195 if (strcmp(i->name, "extension") == 0) {
196 args.extension = (i->value);
197 } else
198 if (strcmp(i->name, "context") == 0) {
199 args.context = (i->value);
200 } else
201 if (strcmp(i->name, "priority") == 0) {
202 args.priority = atol(i->value);
203 } else
204 if (strcmp(i->name, "label") == 0) {
205 args.label = (i->value);
206 } else
207 if (strcmp(i->name, "app") == 0) {
208 args.app = (i->value);
209 } else
210 if (strcmp(i->name, "appArgs") == 0) {
211 args.app_args = (i->value);
212 } else
213 if (strcmp(i->name, "callerId") == 0) {
214 args.caller_id = (i->value);
215 } else
216 if (strcmp(i->name, "timeout") == 0) {
217 args.timeout = atoi(i->value);
218 } else
219 if (strcmp(i->name, "channelId") == 0) {
220 args.channel_id = (i->value);
221 } else
222 if (strcmp(i->name, "otherChannelId") == 0) {
223 args.other_channel_id = (i->value);
224 } else
225 if (strcmp(i->name, "originator") == 0) {
226 args.originator = (i->value);
227 } else
228 if (strcmp(i->name, "formats") == 0) {
229 args.formats = (i->value);
230 } else
231 {}
232 }
233 args.variables = body;
234 ast_ari_channels_originate(headers, &args, response);
235#if defined(AST_DEVMODE)
236 code = response->response_code;
237
238 switch (code) {
239 case 0: /* Implementation is still a stub, or the code wasn't set */
240 is_valid = response->message == NULL;
241 break;
242 case 500: /* Internal Server Error */
243 case 501: /* Not Implemented */
244 case 400: /* Invalid parameters for originating a channel. */
245 case 409: /* Channel with given unique ID already exists. */
246 is_valid = 1;
247 break;
248 default:
249 if (200 <= code && code <= 299) {
250 is_valid = ast_ari_validate_channel(
251 response->message);
252 } else {
253 ast_log(LOG_ERROR, "Invalid error response %d for /channels\n", code);
254 is_valid = 0;
255 }
256 }
257
258 if (!is_valid) {
259 ast_log(LOG_ERROR, "Response validation failed for /channels\n");
260 ast_ari_response_error(response, 500,
261 "Internal Server Error", "Response validation failed");
262 }
263#endif /* AST_DEVMODE */
264
265fin: __attribute__((unused))
266 return;
267}
269 struct ast_json *body,
271{
272 struct ast_json *field;
273 /* Parse query parameters out of it */
274 field = ast_json_object_get(body, "endpoint");
275 if (field) {
276 args->endpoint = ast_json_string_get(field);
277 }
278 field = ast_json_object_get(body, "app");
279 if (field) {
280 args->app = ast_json_string_get(field);
281 }
282 field = ast_json_object_get(body, "appArgs");
283 if (field) {
284 args->app_args = ast_json_string_get(field);
285 }
286 field = ast_json_object_get(body, "channelId");
287 if (field) {
288 args->channel_id = ast_json_string_get(field);
289 }
290 field = ast_json_object_get(body, "otherChannelId");
291 if (field) {
292 args->other_channel_id = ast_json_string_get(field);
293 }
294 field = ast_json_object_get(body, "originator");
295 if (field) {
296 args->originator = ast_json_string_get(field);
297 }
298 field = ast_json_object_get(body, "formats");
299 if (field) {
300 args->formats = ast_json_string_get(field);
301 }
302 return 0;
303}
304
305/*!
306 * \brief Parameter parsing callback for /channels/create.
307 * \param ser TCP/TLS session object
308 * \param get_params GET parameters in the HTTP request.
309 * \param path_vars Path variables extracted from the request.
310 * \param headers HTTP headers.
311 * \param body
312 * \param[out] response Response to the HTTP request.
313 */
315 struct ast_tcptls_session_instance *ser,
316 struct ast_variable *get_params, struct ast_variable *path_vars,
317 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
318{
320 struct ast_variable *i;
321#if defined(AST_DEVMODE)
322 int is_valid;
323 int code;
324#endif /* AST_DEVMODE */
325
326 for (i = get_params; i; i = i->next) {
327 if (strcmp(i->name, "endpoint") == 0) {
328 args.endpoint = (i->value);
329 } else
330 if (strcmp(i->name, "app") == 0) {
331 args.app = (i->value);
332 } else
333 if (strcmp(i->name, "appArgs") == 0) {
334 args.app_args = (i->value);
335 } else
336 if (strcmp(i->name, "channelId") == 0) {
337 args.channel_id = (i->value);
338 } else
339 if (strcmp(i->name, "otherChannelId") == 0) {
340 args.other_channel_id = (i->value);
341 } else
342 if (strcmp(i->name, "originator") == 0) {
343 args.originator = (i->value);
344 } else
345 if (strcmp(i->name, "formats") == 0) {
346 args.formats = (i->value);
347 } else
348 {}
349 }
350 args.variables = body;
351 ast_ari_channels_create(headers, &args, response);
352#if defined(AST_DEVMODE)
353 code = response->response_code;
354
355 switch (code) {
356 case 0: /* Implementation is still a stub, or the code wasn't set */
357 is_valid = response->message == NULL;
358 break;
359 case 500: /* Internal Server Error */
360 case 501: /* Not Implemented */
361 case 409: /* Channel with given unique ID already exists. */
362 is_valid = 1;
363 break;
364 default:
365 if (200 <= code && code <= 299) {
366 is_valid = ast_ari_validate_channel(
367 response->message);
368 } else {
369 ast_log(LOG_ERROR, "Invalid error response %d for /channels/create\n", code);
370 is_valid = 0;
371 }
372 }
373
374 if (!is_valid) {
375 ast_log(LOG_ERROR, "Response validation failed for /channels/create\n");
376 ast_ari_response_error(response, 500,
377 "Internal Server Error", "Response validation failed");
378 }
379#endif /* AST_DEVMODE */
380
381fin: __attribute__((unused))
382 return;
383}
384/*!
385 * \brief Parameter parsing callback for /channels/{channelId}.
386 * \param ser TCP/TLS session object
387 * \param get_params GET parameters in the HTTP request.
388 * \param path_vars Path variables extracted from the request.
389 * \param headers HTTP headers.
390 * \param body
391 * \param[out] response Response to the HTTP request.
392 */
394 struct ast_tcptls_session_instance *ser,
395 struct ast_variable *get_params, struct ast_variable *path_vars,
396 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
397{
399 struct ast_variable *i;
400#if defined(AST_DEVMODE)
401 int is_valid;
402 int code;
403#endif /* AST_DEVMODE */
404
405 for (i = path_vars; i; i = i->next) {
406 if (strcmp(i->name, "channelId") == 0) {
407 args.channel_id = (i->value);
408 } else
409 {}
410 }
411 ast_ari_channels_get(headers, &args, response);
412#if defined(AST_DEVMODE)
413 code = response->response_code;
414
415 switch (code) {
416 case 0: /* Implementation is still a stub, or the code wasn't set */
417 is_valid = response->message == NULL;
418 break;
419 case 500: /* Internal Server Error */
420 case 501: /* Not Implemented */
421 case 404: /* Channel not found */
422 is_valid = 1;
423 break;
424 default:
425 if (200 <= code && code <= 299) {
426 is_valid = ast_ari_validate_channel(
427 response->message);
428 } else {
429 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}\n", code);
430 is_valid = 0;
431 }
432 }
433
434 if (!is_valid) {
435 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}\n");
436 ast_ari_response_error(response, 500,
437 "Internal Server Error", "Response validation failed");
438 }
439#endif /* AST_DEVMODE */
440
441fin: __attribute__((unused))
442 return;
443}
445 struct ast_json *body,
447{
448 struct ast_json *field;
449 /* Parse query parameters out of it */
450 field = ast_json_object_get(body, "endpoint");
451 if (field) {
452 args->endpoint = ast_json_string_get(field);
453 }
454 field = ast_json_object_get(body, "extension");
455 if (field) {
456 args->extension = ast_json_string_get(field);
457 }
458 field = ast_json_object_get(body, "context");
459 if (field) {
460 args->context = ast_json_string_get(field);
461 }
462 field = ast_json_object_get(body, "priority");
463 if (field) {
464 args->priority = ast_json_integer_get(field);
465 }
466 field = ast_json_object_get(body, "label");
467 if (field) {
468 args->label = ast_json_string_get(field);
469 }
470 field = ast_json_object_get(body, "app");
471 if (field) {
472 args->app = ast_json_string_get(field);
473 }
474 field = ast_json_object_get(body, "appArgs");
475 if (field) {
476 args->app_args = ast_json_string_get(field);
477 }
478 field = ast_json_object_get(body, "callerId");
479 if (field) {
480 args->caller_id = ast_json_string_get(field);
481 }
482 field = ast_json_object_get(body, "timeout");
483 if (field) {
484 args->timeout = ast_json_integer_get(field);
485 }
486 field = ast_json_object_get(body, "otherChannelId");
487 if (field) {
488 args->other_channel_id = ast_json_string_get(field);
489 }
490 field = ast_json_object_get(body, "originator");
491 if (field) {
492 args->originator = ast_json_string_get(field);
493 }
494 field = ast_json_object_get(body, "formats");
495 if (field) {
496 args->formats = ast_json_string_get(field);
497 }
498 return 0;
499}
500
501/*!
502 * \brief Parameter parsing callback for /channels/{channelId}.
503 * \param ser TCP/TLS session object
504 * \param get_params GET parameters in the HTTP request.
505 * \param path_vars Path variables extracted from the request.
506 * \param headers HTTP headers.
507 * \param body
508 * \param[out] response Response to the HTTP request.
509 */
511 struct ast_tcptls_session_instance *ser,
512 struct ast_variable *get_params, struct ast_variable *path_vars,
513 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
514{
516 struct ast_variable *i;
517#if defined(AST_DEVMODE)
518 int is_valid;
519 int code;
520#endif /* AST_DEVMODE */
521
522 for (i = get_params; i; i = i->next) {
523 if (strcmp(i->name, "endpoint") == 0) {
524 args.endpoint = (i->value);
525 } else
526 if (strcmp(i->name, "extension") == 0) {
527 args.extension = (i->value);
528 } else
529 if (strcmp(i->name, "context") == 0) {
530 args.context = (i->value);
531 } else
532 if (strcmp(i->name, "priority") == 0) {
533 args.priority = atol(i->value);
534 } else
535 if (strcmp(i->name, "label") == 0) {
536 args.label = (i->value);
537 } else
538 if (strcmp(i->name, "app") == 0) {
539 args.app = (i->value);
540 } else
541 if (strcmp(i->name, "appArgs") == 0) {
542 args.app_args = (i->value);
543 } else
544 if (strcmp(i->name, "callerId") == 0) {
545 args.caller_id = (i->value);
546 } else
547 if (strcmp(i->name, "timeout") == 0) {
548 args.timeout = atoi(i->value);
549 } else
550 if (strcmp(i->name, "otherChannelId") == 0) {
551 args.other_channel_id = (i->value);
552 } else
553 if (strcmp(i->name, "originator") == 0) {
554 args.originator = (i->value);
555 } else
556 if (strcmp(i->name, "formats") == 0) {
557 args.formats = (i->value);
558 } else
559 {}
560 }
561 for (i = path_vars; i; i = i->next) {
562 if (strcmp(i->name, "channelId") == 0) {
563 args.channel_id = (i->value);
564 } else
565 {}
566 }
567 args.variables = body;
568 ast_ari_channels_originate_with_id(headers, &args, response);
569#if defined(AST_DEVMODE)
570 code = response->response_code;
571
572 switch (code) {
573 case 0: /* Implementation is still a stub, or the code wasn't set */
574 is_valid = response->message == NULL;
575 break;
576 case 500: /* Internal Server Error */
577 case 501: /* Not Implemented */
578 case 400: /* Invalid parameters for originating a channel. */
579 case 409: /* Channel with given unique ID already exists. */
580 is_valid = 1;
581 break;
582 default:
583 if (200 <= code && code <= 299) {
584 is_valid = ast_ari_validate_channel(
585 response->message);
586 } else {
587 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}\n", code);
588 is_valid = 0;
589 }
590 }
591
592 if (!is_valid) {
593 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}\n");
594 ast_ari_response_error(response, 500,
595 "Internal Server Error", "Response validation failed");
596 }
597#endif /* AST_DEVMODE */
598
599fin: __attribute__((unused))
600 return;
601}
603 struct ast_json *body,
605{
606 struct ast_json *field;
607 /* Parse query parameters out of it */
608 field = ast_json_object_get(body, "reason_code");
609 if (field) {
610 args->reason_code = ast_json_string_get(field);
611 }
612 field = ast_json_object_get(body, "reason");
613 if (field) {
614 args->reason = ast_json_string_get(field);
615 }
616 return 0;
617}
618
619/*!
620 * \brief Parameter parsing callback for /channels/{channelId}.
621 * \param ser TCP/TLS session object
622 * \param get_params GET parameters in the HTTP request.
623 * \param path_vars Path variables extracted from the request.
624 * \param headers HTTP headers.
625 * \param body
626 * \param[out] response Response to the HTTP request.
627 */
629 struct ast_tcptls_session_instance *ser,
630 struct ast_variable *get_params, struct ast_variable *path_vars,
631 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
632{
634 struct ast_variable *i;
635#if defined(AST_DEVMODE)
636 int is_valid;
637 int code;
638#endif /* AST_DEVMODE */
639
640 for (i = get_params; i; i = i->next) {
641 if (strcmp(i->name, "reason_code") == 0) {
642 args.reason_code = (i->value);
643 } else
644 if (strcmp(i->name, "reason") == 0) {
645 args.reason = (i->value);
646 } else
647 {}
648 }
649 for (i = path_vars; i; i = i->next) {
650 if (strcmp(i->name, "channelId") == 0) {
651 args.channel_id = (i->value);
652 } else
653 {}
654 }
657 goto fin;
658 }
659 ast_ari_channels_hangup(headers, &args, response);
660#if defined(AST_DEVMODE)
661 code = response->response_code;
662
663 switch (code) {
664 case 0: /* Implementation is still a stub, or the code wasn't set */
665 is_valid = response->message == NULL;
666 break;
667 case 500: /* Internal Server Error */
668 case 501: /* Not Implemented */
669 case 400: /* Invalid reason for hangup provided */
670 case 404: /* Channel not found */
671 is_valid = 1;
672 break;
673 default:
674 if (200 <= code && code <= 299) {
675 is_valid = ast_ari_validate_void(
676 response->message);
677 } else {
678 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}\n", code);
679 is_valid = 0;
680 }
681 }
682
683 if (!is_valid) {
684 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}\n");
685 ast_ari_response_error(response, 500,
686 "Internal Server Error", "Response validation failed");
687 }
688#endif /* AST_DEVMODE */
689
690fin: __attribute__((unused))
691 return;
692}
694 struct ast_json *body,
696{
697 struct ast_json *field;
698 /* Parse query parameters out of it */
699 field = ast_json_object_get(body, "context");
700 if (field) {
701 args->context = ast_json_string_get(field);
702 }
703 field = ast_json_object_get(body, "extension");
704 if (field) {
705 args->extension = ast_json_string_get(field);
706 }
707 field = ast_json_object_get(body, "priority");
708 if (field) {
709 args->priority = ast_json_integer_get(field);
710 }
711 field = ast_json_object_get(body, "label");
712 if (field) {
713 args->label = ast_json_string_get(field);
714 }
715 return 0;
716}
717
718/*!
719 * \brief Parameter parsing callback for /channels/{channelId}/continue.
720 * \param ser TCP/TLS session object
721 * \param get_params GET parameters in the HTTP request.
722 * \param path_vars Path variables extracted from the request.
723 * \param headers HTTP headers.
724 * \param body
725 * \param[out] response Response to the HTTP request.
726 */
728 struct ast_tcptls_session_instance *ser,
729 struct ast_variable *get_params, struct ast_variable *path_vars,
730 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
731{
733 struct ast_variable *i;
734#if defined(AST_DEVMODE)
735 int is_valid;
736 int code;
737#endif /* AST_DEVMODE */
738
739 for (i = get_params; i; i = i->next) {
740 if (strcmp(i->name, "context") == 0) {
741 args.context = (i->value);
742 } else
743 if (strcmp(i->name, "extension") == 0) {
744 args.extension = (i->value);
745 } else
746 if (strcmp(i->name, "priority") == 0) {
747 args.priority = atoi(i->value);
748 } else
749 if (strcmp(i->name, "label") == 0) {
750 args.label = (i->value);
751 } else
752 {}
753 }
754 for (i = path_vars; i; i = i->next) {
755 if (strcmp(i->name, "channelId") == 0) {
756 args.channel_id = (i->value);
757 } else
758 {}
759 }
762 goto fin;
763 }
764 ast_ari_channels_continue_in_dialplan(headers, &args, response);
765#if defined(AST_DEVMODE)
766 code = response->response_code;
767
768 switch (code) {
769 case 0: /* Implementation is still a stub, or the code wasn't set */
770 is_valid = response->message == NULL;
771 break;
772 case 500: /* Internal Server Error */
773 case 501: /* Not Implemented */
774 case 404: /* Channel not found */
775 case 409: /* Channel not in a Stasis application */
776 case 412: /* Channel in invalid state */
777 is_valid = 1;
778 break;
779 default:
780 if (200 <= code && code <= 299) {
781 is_valid = ast_ari_validate_void(
782 response->message);
783 } else {
784 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/continue\n", code);
785 is_valid = 0;
786 }
787 }
788
789 if (!is_valid) {
790 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/continue\n");
791 ast_ari_response_error(response, 500,
792 "Internal Server Error", "Response validation failed");
793 }
794#endif /* AST_DEVMODE */
795
796fin: __attribute__((unused))
797 return;
798}
800 struct ast_json *body,
802{
803 struct ast_json *field;
804 /* Parse query parameters out of it */
805 field = ast_json_object_get(body, "app");
806 if (field) {
807 args->app = ast_json_string_get(field);
808 }
809 field = ast_json_object_get(body, "appArgs");
810 if (field) {
811 args->app_args = ast_json_string_get(field);
812 }
813 return 0;
814}
815
816/*!
817 * \brief Parameter parsing callback for /channels/{channelId}/move.
818 * \param ser TCP/TLS session object
819 * \param get_params GET parameters in the HTTP request.
820 * \param path_vars Path variables extracted from the request.
821 * \param headers HTTP headers.
822 * \param body
823 * \param[out] response Response to the HTTP request.
824 */
826 struct ast_tcptls_session_instance *ser,
827 struct ast_variable *get_params, struct ast_variable *path_vars,
828 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
829{
831 struct ast_variable *i;
832#if defined(AST_DEVMODE)
833 int is_valid;
834 int code;
835#endif /* AST_DEVMODE */
836
837 for (i = get_params; i; i = i->next) {
838 if (strcmp(i->name, "app") == 0) {
839 args.app = (i->value);
840 } else
841 if (strcmp(i->name, "appArgs") == 0) {
842 args.app_args = (i->value);
843 } else
844 {}
845 }
846 for (i = path_vars; i; i = i->next) {
847 if (strcmp(i->name, "channelId") == 0) {
848 args.channel_id = (i->value);
849 } else
850 {}
851 }
854 goto fin;
855 }
856 ast_ari_channels_move(headers, &args, response);
857#if defined(AST_DEVMODE)
858 code = response->response_code;
859
860 switch (code) {
861 case 0: /* Implementation is still a stub, or the code wasn't set */
862 is_valid = response->message == NULL;
863 break;
864 case 500: /* Internal Server Error */
865 case 501: /* Not Implemented */
866 case 404: /* Channel not found */
867 case 409: /* Channel not in a Stasis application */
868 is_valid = 1;
869 break;
870 default:
871 if (200 <= code && code <= 299) {
872 is_valid = ast_ari_validate_void(
873 response->message);
874 } else {
875 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/move\n", code);
876 is_valid = 0;
877 }
878 }
879
880 if (!is_valid) {
881 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/move\n");
882 ast_ari_response_error(response, 500,
883 "Internal Server Error", "Response validation failed");
884 }
885#endif /* AST_DEVMODE */
886
887fin: __attribute__((unused))
888 return;
889}
891 struct ast_json *body,
893{
894 struct ast_json *field;
895 /* Parse query parameters out of it */
896 field = ast_json_object_get(body, "endpoint");
897 if (field) {
898 args->endpoint = ast_json_string_get(field);
899 }
900 return 0;
901}
902
903/*!
904 * \brief Parameter parsing callback for /channels/{channelId}/redirect.
905 * \param ser TCP/TLS session object
906 * \param get_params GET parameters in the HTTP request.
907 * \param path_vars Path variables extracted from the request.
908 * \param headers HTTP headers.
909 * \param body
910 * \param[out] response Response to the HTTP request.
911 */
913 struct ast_tcptls_session_instance *ser,
914 struct ast_variable *get_params, struct ast_variable *path_vars,
915 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
916{
918 struct ast_variable *i;
919#if defined(AST_DEVMODE)
920 int is_valid;
921 int code;
922#endif /* AST_DEVMODE */
923
924 for (i = get_params; i; i = i->next) {
925 if (strcmp(i->name, "endpoint") == 0) {
926 args.endpoint = (i->value);
927 } else
928 {}
929 }
930 for (i = path_vars; i; i = i->next) {
931 if (strcmp(i->name, "channelId") == 0) {
932 args.channel_id = (i->value);
933 } else
934 {}
935 }
938 goto fin;
939 }
940 ast_ari_channels_redirect(headers, &args, response);
941#if defined(AST_DEVMODE)
942 code = response->response_code;
943
944 switch (code) {
945 case 0: /* Implementation is still a stub, or the code wasn't set */
946 is_valid = response->message == NULL;
947 break;
948 case 500: /* Internal Server Error */
949 case 501: /* Not Implemented */
950 case 400: /* Endpoint parameter not provided */
951 case 404: /* Channel or endpoint not found */
952 case 409: /* Channel not in a Stasis application */
953 case 422: /* Endpoint is not the same type as the channel */
954 case 412: /* Channel in invalid state */
955 is_valid = 1;
956 break;
957 default:
958 if (200 <= code && code <= 299) {
959 is_valid = ast_ari_validate_void(
960 response->message);
961 } else {
962 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/redirect\n", code);
963 is_valid = 0;
964 }
965 }
966
967 if (!is_valid) {
968 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/redirect\n");
969 ast_ari_response_error(response, 500,
970 "Internal Server Error", "Response validation failed");
971 }
972#endif /* AST_DEVMODE */
973
974fin: __attribute__((unused))
975 return;
976}
977/*!
978 * \brief Parameter parsing callback for /channels/{channelId}/answer.
979 * \param ser TCP/TLS session object
980 * \param get_params GET parameters in the HTTP request.
981 * \param path_vars Path variables extracted from the request.
982 * \param headers HTTP headers.
983 * \param body
984 * \param[out] response Response to the HTTP request.
985 */
987 struct ast_tcptls_session_instance *ser,
988 struct ast_variable *get_params, struct ast_variable *path_vars,
989 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
990{
992 struct ast_variable *i;
993#if defined(AST_DEVMODE)
994 int is_valid;
995 int code;
996#endif /* AST_DEVMODE */
997
998 for (i = path_vars; i; i = i->next) {
999 if (strcmp(i->name, "channelId") == 0) {
1000 args.channel_id = (i->value);
1001 } else
1002 {}
1003 }
1004 ast_ari_channels_answer(headers, &args, response);
1005#if defined(AST_DEVMODE)
1006 code = response->response_code;
1007
1008 switch (code) {
1009 case 0: /* Implementation is still a stub, or the code wasn't set */
1010 is_valid = response->message == NULL;
1011 break;
1012 case 500: /* Internal Server Error */
1013 case 501: /* Not Implemented */
1014 case 404: /* Channel not found */
1015 case 409: /* Channel not in a Stasis application */
1016 case 412: /* Channel in invalid state */
1017 is_valid = 1;
1018 break;
1019 default:
1020 if (200 <= code && code <= 299) {
1021 is_valid = ast_ari_validate_void(
1022 response->message);
1023 } else {
1024 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/answer\n", code);
1025 is_valid = 0;
1026 }
1027 }
1028
1029 if (!is_valid) {
1030 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/answer\n");
1031 ast_ari_response_error(response, 500,
1032 "Internal Server Error", "Response validation failed");
1033 }
1034#endif /* AST_DEVMODE */
1035
1036fin: __attribute__((unused))
1037 return;
1038}
1039/*!
1040 * \brief Parameter parsing callback for /channels/{channelId}/ring.
1041 * \param ser TCP/TLS session object
1042 * \param get_params GET parameters in the HTTP request.
1043 * \param path_vars Path variables extracted from the request.
1044 * \param headers HTTP headers.
1045 * \param body
1046 * \param[out] response Response to the HTTP request.
1047 */
1049 struct ast_tcptls_session_instance *ser,
1050 struct ast_variable *get_params, struct ast_variable *path_vars,
1051 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1052{
1053 struct ast_ari_channels_ring_args args = {};
1054 struct ast_variable *i;
1055#if defined(AST_DEVMODE)
1056 int is_valid;
1057 int code;
1058#endif /* AST_DEVMODE */
1059
1060 for (i = path_vars; i; i = i->next) {
1061 if (strcmp(i->name, "channelId") == 0) {
1062 args.channel_id = (i->value);
1063 } else
1064 {}
1065 }
1066 ast_ari_channels_ring(headers, &args, response);
1067#if defined(AST_DEVMODE)
1068 code = response->response_code;
1069
1070 switch (code) {
1071 case 0: /* Implementation is still a stub, or the code wasn't set */
1072 is_valid = response->message == NULL;
1073 break;
1074 case 500: /* Internal Server Error */
1075 case 501: /* Not Implemented */
1076 case 404: /* Channel not found */
1077 case 409: /* Channel not in a Stasis application */
1078 case 412: /* Channel in invalid state */
1079 is_valid = 1;
1080 break;
1081 default:
1082 if (200 <= code && code <= 299) {
1083 is_valid = ast_ari_validate_void(
1084 response->message);
1085 } else {
1086 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/ring\n", code);
1087 is_valid = 0;
1088 }
1089 }
1090
1091 if (!is_valid) {
1092 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/ring\n");
1093 ast_ari_response_error(response, 500,
1094 "Internal Server Error", "Response validation failed");
1095 }
1096#endif /* AST_DEVMODE */
1097
1098fin: __attribute__((unused))
1099 return;
1100}
1101/*!
1102 * \brief Parameter parsing callback for /channels/{channelId}/ring.
1103 * \param ser TCP/TLS session object
1104 * \param get_params GET parameters in the HTTP request.
1105 * \param path_vars Path variables extracted from the request.
1106 * \param headers HTTP headers.
1107 * \param body
1108 * \param[out] response Response to the HTTP request.
1109 */
1111 struct ast_tcptls_session_instance *ser,
1112 struct ast_variable *get_params, struct ast_variable *path_vars,
1113 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1114{
1116 struct ast_variable *i;
1117#if defined(AST_DEVMODE)
1118 int is_valid;
1119 int code;
1120#endif /* AST_DEVMODE */
1121
1122 for (i = path_vars; i; i = i->next) {
1123 if (strcmp(i->name, "channelId") == 0) {
1124 args.channel_id = (i->value);
1125 } else
1126 {}
1127 }
1128 ast_ari_channels_ring_stop(headers, &args, response);
1129#if defined(AST_DEVMODE)
1130 code = response->response_code;
1131
1132 switch (code) {
1133 case 0: /* Implementation is still a stub, or the code wasn't set */
1134 is_valid = response->message == NULL;
1135 break;
1136 case 500: /* Internal Server Error */
1137 case 501: /* Not Implemented */
1138 case 404: /* Channel not found */
1139 case 409: /* Channel not in a Stasis application */
1140 case 412: /* Channel in invalid state */
1141 is_valid = 1;
1142 break;
1143 default:
1144 if (200 <= code && code <= 299) {
1145 is_valid = ast_ari_validate_void(
1146 response->message);
1147 } else {
1148 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/ring\n", code);
1149 is_valid = 0;
1150 }
1151 }
1152
1153 if (!is_valid) {
1154 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/ring\n");
1155 ast_ari_response_error(response, 500,
1156 "Internal Server Error", "Response validation failed");
1157 }
1158#endif /* AST_DEVMODE */
1159
1160fin: __attribute__((unused))
1161 return;
1162}
1164 struct ast_json *body,
1166{
1167 struct ast_json *field;
1168 /* Parse query parameters out of it */
1169 field = ast_json_object_get(body, "dtmf");
1170 if (field) {
1171 args->dtmf = ast_json_string_get(field);
1172 }
1173 field = ast_json_object_get(body, "before");
1174 if (field) {
1175 args->before = ast_json_integer_get(field);
1176 }
1177 field = ast_json_object_get(body, "between");
1178 if (field) {
1179 args->between = ast_json_integer_get(field);
1180 }
1181 field = ast_json_object_get(body, "duration");
1182 if (field) {
1183 args->duration = ast_json_integer_get(field);
1184 }
1185 field = ast_json_object_get(body, "after");
1186 if (field) {
1187 args->after = ast_json_integer_get(field);
1188 }
1189 return 0;
1190}
1191
1192/*!
1193 * \brief Parameter parsing callback for /channels/{channelId}/dtmf.
1194 * \param ser TCP/TLS session object
1195 * \param get_params GET parameters in the HTTP request.
1196 * \param path_vars Path variables extracted from the request.
1197 * \param headers HTTP headers.
1198 * \param body
1199 * \param[out] response Response to the HTTP request.
1200 */
1202 struct ast_tcptls_session_instance *ser,
1203 struct ast_variable *get_params, struct ast_variable *path_vars,
1204 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1205{
1207 struct ast_variable *i;
1208#if defined(AST_DEVMODE)
1209 int is_valid;
1210 int code;
1211#endif /* AST_DEVMODE */
1212
1213 for (i = get_params; i; i = i->next) {
1214 if (strcmp(i->name, "dtmf") == 0) {
1215 args.dtmf = (i->value);
1216 } else
1217 if (strcmp(i->name, "before") == 0) {
1218 args.before = atoi(i->value);
1219 } else
1220 if (strcmp(i->name, "between") == 0) {
1221 args.between = atoi(i->value);
1222 } else
1223 if (strcmp(i->name, "duration") == 0) {
1224 args.duration = atoi(i->value);
1225 } else
1226 if (strcmp(i->name, "after") == 0) {
1227 args.after = atoi(i->value);
1228 } else
1229 {}
1230 }
1231 for (i = path_vars; i; i = i->next) {
1232 if (strcmp(i->name, "channelId") == 0) {
1233 args.channel_id = (i->value);
1234 } else
1235 {}
1236 }
1239 goto fin;
1240 }
1241 ast_ari_channels_send_dtmf(headers, &args, response);
1242#if defined(AST_DEVMODE)
1243 code = response->response_code;
1244
1245 switch (code) {
1246 case 0: /* Implementation is still a stub, or the code wasn't set */
1247 is_valid = response->message == NULL;
1248 break;
1249 case 500: /* Internal Server Error */
1250 case 501: /* Not Implemented */
1251 case 400: /* DTMF is required */
1252 case 404: /* Channel not found */
1253 case 409: /* Channel not in a Stasis application */
1254 case 412: /* Channel in invalid state */
1255 is_valid = 1;
1256 break;
1257 default:
1258 if (200 <= code && code <= 299) {
1259 is_valid = ast_ari_validate_void(
1260 response->message);
1261 } else {
1262 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/dtmf\n", code);
1263 is_valid = 0;
1264 }
1265 }
1266
1267 if (!is_valid) {
1268 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/dtmf\n");
1269 ast_ari_response_error(response, 500,
1270 "Internal Server Error", "Response validation failed");
1271 }
1272#endif /* AST_DEVMODE */
1273
1274fin: __attribute__((unused))
1275 return;
1276}
1278 struct ast_json *body,
1280{
1281 struct ast_json *field;
1282 /* Parse query parameters out of it */
1283 field = ast_json_object_get(body, "direction");
1284 if (field) {
1285 args->direction = ast_json_string_get(field);
1286 }
1287 return 0;
1288}
1289
1290/*!
1291 * \brief Parameter parsing callback for /channels/{channelId}/mute.
1292 * \param ser TCP/TLS session object
1293 * \param get_params GET parameters in the HTTP request.
1294 * \param path_vars Path variables extracted from the request.
1295 * \param headers HTTP headers.
1296 * \param body
1297 * \param[out] response Response to the HTTP request.
1298 */
1300 struct ast_tcptls_session_instance *ser,
1301 struct ast_variable *get_params, struct ast_variable *path_vars,
1302 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1303{
1304 struct ast_ari_channels_mute_args args = {};
1305 struct ast_variable *i;
1306#if defined(AST_DEVMODE)
1307 int is_valid;
1308 int code;
1309#endif /* AST_DEVMODE */
1310
1311 for (i = get_params; i; i = i->next) {
1312 if (strcmp(i->name, "direction") == 0) {
1313 args.direction = (i->value);
1314 } else
1315 {}
1316 }
1317 for (i = path_vars; i; i = i->next) {
1318 if (strcmp(i->name, "channelId") == 0) {
1319 args.channel_id = (i->value);
1320 } else
1321 {}
1322 }
1325 goto fin;
1326 }
1327 ast_ari_channels_mute(headers, &args, response);
1328#if defined(AST_DEVMODE)
1329 code = response->response_code;
1330
1331 switch (code) {
1332 case 0: /* Implementation is still a stub, or the code wasn't set */
1333 is_valid = response->message == NULL;
1334 break;
1335 case 500: /* Internal Server Error */
1336 case 501: /* Not Implemented */
1337 case 404: /* Channel not found */
1338 case 409: /* Channel not in a Stasis application */
1339 case 412: /* Channel in invalid state */
1340 is_valid = 1;
1341 break;
1342 default:
1343 if (200 <= code && code <= 299) {
1344 is_valid = ast_ari_validate_void(
1345 response->message);
1346 } else {
1347 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mute\n", code);
1348 is_valid = 0;
1349 }
1350 }
1351
1352 if (!is_valid) {
1353 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mute\n");
1354 ast_ari_response_error(response, 500,
1355 "Internal Server Error", "Response validation failed");
1356 }
1357#endif /* AST_DEVMODE */
1358
1359fin: __attribute__((unused))
1360 return;
1361}
1363 struct ast_json *body,
1365{
1366 struct ast_json *field;
1367 /* Parse query parameters out of it */
1368 field = ast_json_object_get(body, "direction");
1369 if (field) {
1370 args->direction = ast_json_string_get(field);
1371 }
1372 return 0;
1373}
1374
1375/*!
1376 * \brief Parameter parsing callback for /channels/{channelId}/mute.
1377 * \param ser TCP/TLS session object
1378 * \param get_params GET parameters in the HTTP request.
1379 * \param path_vars Path variables extracted from the request.
1380 * \param headers HTTP headers.
1381 * \param body
1382 * \param[out] response Response to the HTTP request.
1383 */
1385 struct ast_tcptls_session_instance *ser,
1386 struct ast_variable *get_params, struct ast_variable *path_vars,
1387 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1388{
1390 struct ast_variable *i;
1391#if defined(AST_DEVMODE)
1392 int is_valid;
1393 int code;
1394#endif /* AST_DEVMODE */
1395
1396 for (i = get_params; i; i = i->next) {
1397 if (strcmp(i->name, "direction") == 0) {
1398 args.direction = (i->value);
1399 } else
1400 {}
1401 }
1402 for (i = path_vars; i; i = i->next) {
1403 if (strcmp(i->name, "channelId") == 0) {
1404 args.channel_id = (i->value);
1405 } else
1406 {}
1407 }
1410 goto fin;
1411 }
1412 ast_ari_channels_unmute(headers, &args, response);
1413#if defined(AST_DEVMODE)
1414 code = response->response_code;
1415
1416 switch (code) {
1417 case 0: /* Implementation is still a stub, or the code wasn't set */
1418 is_valid = response->message == NULL;
1419 break;
1420 case 500: /* Internal Server Error */
1421 case 501: /* Not Implemented */
1422 case 404: /* Channel not found */
1423 case 409: /* Channel not in a Stasis application */
1424 case 412: /* Channel in invalid state */
1425 is_valid = 1;
1426 break;
1427 default:
1428 if (200 <= code && code <= 299) {
1429 is_valid = ast_ari_validate_void(
1430 response->message);
1431 } else {
1432 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mute\n", code);
1433 is_valid = 0;
1434 }
1435 }
1436
1437 if (!is_valid) {
1438 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mute\n");
1439 ast_ari_response_error(response, 500,
1440 "Internal Server Error", "Response validation failed");
1441 }
1442#endif /* AST_DEVMODE */
1443
1444fin: __attribute__((unused))
1445 return;
1446}
1447/*!
1448 * \brief Parameter parsing callback for /channels/{channelId}/hold.
1449 * \param ser TCP/TLS session object
1450 * \param get_params GET parameters in the HTTP request.
1451 * \param path_vars Path variables extracted from the request.
1452 * \param headers HTTP headers.
1453 * \param body
1454 * \param[out] response Response to the HTTP request.
1455 */
1457 struct ast_tcptls_session_instance *ser,
1458 struct ast_variable *get_params, struct ast_variable *path_vars,
1459 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1460{
1461 struct ast_ari_channels_hold_args args = {};
1462 struct ast_variable *i;
1463#if defined(AST_DEVMODE)
1464 int is_valid;
1465 int code;
1466#endif /* AST_DEVMODE */
1467
1468 for (i = path_vars; i; i = i->next) {
1469 if (strcmp(i->name, "channelId") == 0) {
1470 args.channel_id = (i->value);
1471 } else
1472 {}
1473 }
1474 ast_ari_channels_hold(headers, &args, response);
1475#if defined(AST_DEVMODE)
1476 code = response->response_code;
1477
1478 switch (code) {
1479 case 0: /* Implementation is still a stub, or the code wasn't set */
1480 is_valid = response->message == NULL;
1481 break;
1482 case 500: /* Internal Server Error */
1483 case 501: /* Not Implemented */
1484 case 404: /* Channel not found */
1485 case 409: /* Channel not in a Stasis application */
1486 case 412: /* Channel in invalid state */
1487 is_valid = 1;
1488 break;
1489 default:
1490 if (200 <= code && code <= 299) {
1491 is_valid = ast_ari_validate_void(
1492 response->message);
1493 } else {
1494 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/hold\n", code);
1495 is_valid = 0;
1496 }
1497 }
1498
1499 if (!is_valid) {
1500 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/hold\n");
1501 ast_ari_response_error(response, 500,
1502 "Internal Server Error", "Response validation failed");
1503 }
1504#endif /* AST_DEVMODE */
1505
1506fin: __attribute__((unused))
1507 return;
1508}
1509/*!
1510 * \brief Parameter parsing callback for /channels/{channelId}/hold.
1511 * \param ser TCP/TLS session object
1512 * \param get_params GET parameters in the HTTP request.
1513 * \param path_vars Path variables extracted from the request.
1514 * \param headers HTTP headers.
1515 * \param body
1516 * \param[out] response Response to the HTTP request.
1517 */
1519 struct ast_tcptls_session_instance *ser,
1520 struct ast_variable *get_params, struct ast_variable *path_vars,
1521 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1522{
1524 struct ast_variable *i;
1525#if defined(AST_DEVMODE)
1526 int is_valid;
1527 int code;
1528#endif /* AST_DEVMODE */
1529
1530 for (i = path_vars; i; i = i->next) {
1531 if (strcmp(i->name, "channelId") == 0) {
1532 args.channel_id = (i->value);
1533 } else
1534 {}
1535 }
1536 ast_ari_channels_unhold(headers, &args, response);
1537#if defined(AST_DEVMODE)
1538 code = response->response_code;
1539
1540 switch (code) {
1541 case 0: /* Implementation is still a stub, or the code wasn't set */
1542 is_valid = response->message == NULL;
1543 break;
1544 case 500: /* Internal Server Error */
1545 case 501: /* Not Implemented */
1546 case 404: /* Channel not found */
1547 case 409: /* Channel not in a Stasis application */
1548 case 412: /* Channel in invalid state */
1549 is_valid = 1;
1550 break;
1551 default:
1552 if (200 <= code && code <= 299) {
1553 is_valid = ast_ari_validate_void(
1554 response->message);
1555 } else {
1556 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/hold\n", code);
1557 is_valid = 0;
1558 }
1559 }
1560
1561 if (!is_valid) {
1562 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/hold\n");
1563 ast_ari_response_error(response, 500,
1564 "Internal Server Error", "Response validation failed");
1565 }
1566#endif /* AST_DEVMODE */
1567
1568fin: __attribute__((unused))
1569 return;
1570}
1572 struct ast_json *body,
1574{
1575 struct ast_json *field;
1576 /* Parse query parameters out of it */
1577 field = ast_json_object_get(body, "mohClass");
1578 if (field) {
1579 args->moh_class = ast_json_string_get(field);
1580 }
1581 return 0;
1582}
1583
1584/*!
1585 * \brief Parameter parsing callback for /channels/{channelId}/moh.
1586 * \param ser TCP/TLS session object
1587 * \param get_params GET parameters in the HTTP request.
1588 * \param path_vars Path variables extracted from the request.
1589 * \param headers HTTP headers.
1590 * \param body
1591 * \param[out] response Response to the HTTP request.
1592 */
1594 struct ast_tcptls_session_instance *ser,
1595 struct ast_variable *get_params, struct ast_variable *path_vars,
1596 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1597{
1599 struct ast_variable *i;
1600#if defined(AST_DEVMODE)
1601 int is_valid;
1602 int code;
1603#endif /* AST_DEVMODE */
1604
1605 for (i = get_params; i; i = i->next) {
1606 if (strcmp(i->name, "mohClass") == 0) {
1607 args.moh_class = (i->value);
1608 } else
1609 {}
1610 }
1611 for (i = path_vars; i; i = i->next) {
1612 if (strcmp(i->name, "channelId") == 0) {
1613 args.channel_id = (i->value);
1614 } else
1615 {}
1616 }
1619 goto fin;
1620 }
1621 ast_ari_channels_start_moh(headers, &args, response);
1622#if defined(AST_DEVMODE)
1623 code = response->response_code;
1624
1625 switch (code) {
1626 case 0: /* Implementation is still a stub, or the code wasn't set */
1627 is_valid = response->message == NULL;
1628 break;
1629 case 500: /* Internal Server Error */
1630 case 501: /* Not Implemented */
1631 case 404: /* Channel not found */
1632 case 409: /* Channel not in a Stasis application */
1633 case 412: /* Channel in invalid state */
1634 is_valid = 1;
1635 break;
1636 default:
1637 if (200 <= code && code <= 299) {
1638 is_valid = ast_ari_validate_void(
1639 response->message);
1640 } else {
1641 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/moh\n", code);
1642 is_valid = 0;
1643 }
1644 }
1645
1646 if (!is_valid) {
1647 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/moh\n");
1648 ast_ari_response_error(response, 500,
1649 "Internal Server Error", "Response validation failed");
1650 }
1651#endif /* AST_DEVMODE */
1652
1653fin: __attribute__((unused))
1654 return;
1655}
1656/*!
1657 * \brief Parameter parsing callback for /channels/{channelId}/moh.
1658 * \param ser TCP/TLS session object
1659 * \param get_params GET parameters in the HTTP request.
1660 * \param path_vars Path variables extracted from the request.
1661 * \param headers HTTP headers.
1662 * \param body
1663 * \param[out] response Response to the HTTP request.
1664 */
1666 struct ast_tcptls_session_instance *ser,
1667 struct ast_variable *get_params, struct ast_variable *path_vars,
1668 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1669{
1671 struct ast_variable *i;
1672#if defined(AST_DEVMODE)
1673 int is_valid;
1674 int code;
1675#endif /* AST_DEVMODE */
1676
1677 for (i = path_vars; i; i = i->next) {
1678 if (strcmp(i->name, "channelId") == 0) {
1679 args.channel_id = (i->value);
1680 } else
1681 {}
1682 }
1683 ast_ari_channels_stop_moh(headers, &args, response);
1684#if defined(AST_DEVMODE)
1685 code = response->response_code;
1686
1687 switch (code) {
1688 case 0: /* Implementation is still a stub, or the code wasn't set */
1689 is_valid = response->message == NULL;
1690 break;
1691 case 500: /* Internal Server Error */
1692 case 501: /* Not Implemented */
1693 case 404: /* Channel not found */
1694 case 409: /* Channel not in a Stasis application */
1695 case 412: /* Channel in invalid state */
1696 is_valid = 1;
1697 break;
1698 default:
1699 if (200 <= code && code <= 299) {
1700 is_valid = ast_ari_validate_void(
1701 response->message);
1702 } else {
1703 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/moh\n", code);
1704 is_valid = 0;
1705 }
1706 }
1707
1708 if (!is_valid) {
1709 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/moh\n");
1710 ast_ari_response_error(response, 500,
1711 "Internal Server Error", "Response validation failed");
1712 }
1713#endif /* AST_DEVMODE */
1714
1715fin: __attribute__((unused))
1716 return;
1717}
1718/*!
1719 * \brief Parameter parsing callback for /channels/{channelId}/silence.
1720 * \param ser TCP/TLS session object
1721 * \param get_params GET parameters in the HTTP request.
1722 * \param path_vars Path variables extracted from the request.
1723 * \param headers HTTP headers.
1724 * \param body
1725 * \param[out] response Response to the HTTP request.
1726 */
1728 struct ast_tcptls_session_instance *ser,
1729 struct ast_variable *get_params, struct ast_variable *path_vars,
1730 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1731{
1733 struct ast_variable *i;
1734#if defined(AST_DEVMODE)
1735 int is_valid;
1736 int code;
1737#endif /* AST_DEVMODE */
1738
1739 for (i = path_vars; i; i = i->next) {
1740 if (strcmp(i->name, "channelId") == 0) {
1741 args.channel_id = (i->value);
1742 } else
1743 {}
1744 }
1745 ast_ari_channels_start_silence(headers, &args, response);
1746#if defined(AST_DEVMODE)
1747 code = response->response_code;
1748
1749 switch (code) {
1750 case 0: /* Implementation is still a stub, or the code wasn't set */
1751 is_valid = response->message == NULL;
1752 break;
1753 case 500: /* Internal Server Error */
1754 case 501: /* Not Implemented */
1755 case 404: /* Channel not found */
1756 case 409: /* Channel not in a Stasis application */
1757 case 412: /* Channel in invalid state */
1758 is_valid = 1;
1759 break;
1760 default:
1761 if (200 <= code && code <= 299) {
1762 is_valid = ast_ari_validate_void(
1763 response->message);
1764 } else {
1765 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/silence\n", code);
1766 is_valid = 0;
1767 }
1768 }
1769
1770 if (!is_valid) {
1771 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/silence\n");
1772 ast_ari_response_error(response, 500,
1773 "Internal Server Error", "Response validation failed");
1774 }
1775#endif /* AST_DEVMODE */
1776
1777fin: __attribute__((unused))
1778 return;
1779}
1780/*!
1781 * \brief Parameter parsing callback for /channels/{channelId}/silence.
1782 * \param ser TCP/TLS session object
1783 * \param get_params GET parameters in the HTTP request.
1784 * \param path_vars Path variables extracted from the request.
1785 * \param headers HTTP headers.
1786 * \param body
1787 * \param[out] response Response to the HTTP request.
1788 */
1790 struct ast_tcptls_session_instance *ser,
1791 struct ast_variable *get_params, struct ast_variable *path_vars,
1792 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1793{
1795 struct ast_variable *i;
1796#if defined(AST_DEVMODE)
1797 int is_valid;
1798 int code;
1799#endif /* AST_DEVMODE */
1800
1801 for (i = path_vars; i; i = i->next) {
1802 if (strcmp(i->name, "channelId") == 0) {
1803 args.channel_id = (i->value);
1804 } else
1805 {}
1806 }
1807 ast_ari_channels_stop_silence(headers, &args, response);
1808#if defined(AST_DEVMODE)
1809 code = response->response_code;
1810
1811 switch (code) {
1812 case 0: /* Implementation is still a stub, or the code wasn't set */
1813 is_valid = response->message == NULL;
1814 break;
1815 case 500: /* Internal Server Error */
1816 case 501: /* Not Implemented */
1817 case 404: /* Channel not found */
1818 case 409: /* Channel not in a Stasis application */
1819 case 412: /* Channel in invalid state */
1820 is_valid = 1;
1821 break;
1822 default:
1823 if (200 <= code && code <= 299) {
1824 is_valid = ast_ari_validate_void(
1825 response->message);
1826 } else {
1827 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/silence\n", code);
1828 is_valid = 0;
1829 }
1830 }
1831
1832 if (!is_valid) {
1833 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/silence\n");
1834 ast_ari_response_error(response, 500,
1835 "Internal Server Error", "Response validation failed");
1836 }
1837#endif /* AST_DEVMODE */
1838
1839fin: __attribute__((unused))
1840 return;
1841}
1843 struct ast_json *body,
1845{
1846 struct ast_json *field;
1847 /* Parse query parameters out of it */
1848 field = ast_json_object_get(body, "media");
1849 if (field) {
1850 /* If they were silly enough to both pass in a query param and a
1851 * JSON body, free up the query value.
1852 */
1853 ast_free(args->media);
1854 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
1855 /* Multiple param passed as array */
1856 size_t i;
1857 args->media_count = ast_json_array_size(field);
1858 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1859
1860 if (!args->media) {
1861 return -1;
1862 }
1863
1864 for (i = 0; i < args->media_count; ++i) {
1865 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
1866 }
1867 } else {
1868 /* Multiple param passed as single value */
1869 args->media_count = 1;
1870 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1871 if (!args->media) {
1872 return -1;
1873 }
1874 args->media[0] = ast_json_string_get(field);
1875 }
1876 }
1877 field = ast_json_object_get(body, "lang");
1878 if (field) {
1879 args->lang = ast_json_string_get(field);
1880 }
1881 field = ast_json_object_get(body, "offsetms");
1882 if (field) {
1883 args->offsetms = ast_json_integer_get(field);
1884 }
1885 field = ast_json_object_get(body, "skipms");
1886 if (field) {
1887 args->skipms = ast_json_integer_get(field);
1888 }
1889 field = ast_json_object_get(body, "playbackId");
1890 if (field) {
1891 args->playback_id = ast_json_string_get(field);
1892 }
1893 return 0;
1894}
1895
1896/*!
1897 * \brief Parameter parsing callback for /channels/{channelId}/play.
1898 * \param ser TCP/TLS session object
1899 * \param get_params GET parameters in the HTTP request.
1900 * \param path_vars Path variables extracted from the request.
1901 * \param headers HTTP headers.
1902 * \param body
1903 * \param[out] response Response to the HTTP request.
1904 */
1906 struct ast_tcptls_session_instance *ser,
1907 struct ast_variable *get_params, struct ast_variable *path_vars,
1908 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
1909{
1910 struct ast_ari_channels_play_args args = {};
1911 struct ast_variable *i;
1912#if defined(AST_DEVMODE)
1913 int is_valid;
1914 int code;
1915#endif /* AST_DEVMODE */
1916
1917 for (i = get_params; i; i = i->next) {
1918 if (strcmp(i->name, "media") == 0) {
1919 /* Parse comma separated list */
1920 char *vals[MAX_VALS];
1921 size_t j;
1922
1923 args.media_parse = ast_strdup(i->value);
1924 if (!args.media_parse) {
1926 goto fin;
1927 }
1928
1929 if (strlen(args.media_parse) == 0) {
1930 /* ast_app_separate_args can't handle "" */
1931 args.media_count = 1;
1932 vals[0] = args.media_parse;
1933 } else {
1934 args.media_count = ast_app_separate_args(
1935 args.media_parse, ',', vals,
1936 ARRAY_LEN(vals));
1937 }
1938
1939 if (args.media_count == 0) {
1941 goto fin;
1942 }
1943
1944 if (args.media_count >= MAX_VALS) {
1945 ast_ari_response_error(response, 400,
1946 "Bad Request",
1947 "Too many values for media");
1948 goto fin;
1949 }
1950
1951 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
1952 if (!args.media) {
1954 goto fin;
1955 }
1956
1957 for (j = 0; j < args.media_count; ++j) {
1958 args.media[j] = (vals[j]);
1959 }
1960 } else
1961 if (strcmp(i->name, "lang") == 0) {
1962 args.lang = (i->value);
1963 } else
1964 if (strcmp(i->name, "offsetms") == 0) {
1965 args.offsetms = atoi(i->value);
1966 } else
1967 if (strcmp(i->name, "skipms") == 0) {
1968 args.skipms = atoi(i->value);
1969 } else
1970 if (strcmp(i->name, "playbackId") == 0) {
1971 args.playback_id = (i->value);
1972 } else
1973 {}
1974 }
1975 for (i = path_vars; i; i = i->next) {
1976 if (strcmp(i->name, "channelId") == 0) {
1977 args.channel_id = (i->value);
1978 } else
1979 {}
1980 }
1983 goto fin;
1984 }
1985 ast_ari_channels_play(headers, &args, response);
1986#if defined(AST_DEVMODE)
1987 code = response->response_code;
1988
1989 switch (code) {
1990 case 0: /* Implementation is still a stub, or the code wasn't set */
1991 is_valid = response->message == NULL;
1992 break;
1993 case 500: /* Internal Server Error */
1994 case 501: /* Not Implemented */
1995 case 404: /* Channel not found */
1996 case 409: /* Channel not in a Stasis application */
1997 case 412: /* Channel in invalid state */
1998 is_valid = 1;
1999 break;
2000 default:
2001 if (200 <= code && code <= 299) {
2002 is_valid = ast_ari_validate_playback(
2003 response->message);
2004 } else {
2005 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/play\n", code);
2006 is_valid = 0;
2007 }
2008 }
2009
2010 if (!is_valid) {
2011 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/play\n");
2012 ast_ari_response_error(response, 500,
2013 "Internal Server Error", "Response validation failed");
2014 }
2015#endif /* AST_DEVMODE */
2016
2017fin: __attribute__((unused))
2018 ast_free(args.media_parse);
2019 ast_free(args.media);
2020 return;
2021}
2023 struct ast_json *body,
2025{
2026 struct ast_json *field;
2027 /* Parse query parameters out of it */
2028 field = ast_json_object_get(body, "media");
2029 if (field) {
2030 /* If they were silly enough to both pass in a query param and a
2031 * JSON body, free up the query value.
2032 */
2033 ast_free(args->media);
2034 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
2035 /* Multiple param passed as array */
2036 size_t i;
2037 args->media_count = ast_json_array_size(field);
2038 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
2039
2040 if (!args->media) {
2041 return -1;
2042 }
2043
2044 for (i = 0; i < args->media_count; ++i) {
2045 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
2046 }
2047 } else {
2048 /* Multiple param passed as single value */
2049 args->media_count = 1;
2050 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
2051 if (!args->media) {
2052 return -1;
2053 }
2054 args->media[0] = ast_json_string_get(field);
2055 }
2056 }
2057 field = ast_json_object_get(body, "lang");
2058 if (field) {
2059 args->lang = ast_json_string_get(field);
2060 }
2061 field = ast_json_object_get(body, "offsetms");
2062 if (field) {
2063 args->offsetms = ast_json_integer_get(field);
2064 }
2065 field = ast_json_object_get(body, "skipms");
2066 if (field) {
2067 args->skipms = ast_json_integer_get(field);
2068 }
2069 return 0;
2070}
2071
2072/*!
2073 * \brief Parameter parsing callback for /channels/{channelId}/play/{playbackId}.
2074 * \param ser TCP/TLS session object
2075 * \param get_params GET parameters in the HTTP request.
2076 * \param path_vars Path variables extracted from the request.
2077 * \param headers HTTP headers.
2078 * \param body
2079 * \param[out] response Response to the HTTP request.
2080 */
2082 struct ast_tcptls_session_instance *ser,
2083 struct ast_variable *get_params, struct ast_variable *path_vars,
2084 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2085{
2087 struct ast_variable *i;
2088#if defined(AST_DEVMODE)
2089 int is_valid;
2090 int code;
2091#endif /* AST_DEVMODE */
2092
2093 for (i = get_params; i; i = i->next) {
2094 if (strcmp(i->name, "media") == 0) {
2095 /* Parse comma separated list */
2096 char *vals[MAX_VALS];
2097 size_t j;
2098
2099 args.media_parse = ast_strdup(i->value);
2100 if (!args.media_parse) {
2102 goto fin;
2103 }
2104
2105 if (strlen(args.media_parse) == 0) {
2106 /* ast_app_separate_args can't handle "" */
2107 args.media_count = 1;
2108 vals[0] = args.media_parse;
2109 } else {
2110 args.media_count = ast_app_separate_args(
2111 args.media_parse, ',', vals,
2112 ARRAY_LEN(vals));
2113 }
2114
2115 if (args.media_count == 0) {
2117 goto fin;
2118 }
2119
2120 if (args.media_count >= MAX_VALS) {
2121 ast_ari_response_error(response, 400,
2122 "Bad Request",
2123 "Too many values for media");
2124 goto fin;
2125 }
2126
2127 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
2128 if (!args.media) {
2130 goto fin;
2131 }
2132
2133 for (j = 0; j < args.media_count; ++j) {
2134 args.media[j] = (vals[j]);
2135 }
2136 } else
2137 if (strcmp(i->name, "lang") == 0) {
2138 args.lang = (i->value);
2139 } else
2140 if (strcmp(i->name, "offsetms") == 0) {
2141 args.offsetms = atoi(i->value);
2142 } else
2143 if (strcmp(i->name, "skipms") == 0) {
2144 args.skipms = atoi(i->value);
2145 } else
2146 {}
2147 }
2148 for (i = path_vars; i; i = i->next) {
2149 if (strcmp(i->name, "channelId") == 0) {
2150 args.channel_id = (i->value);
2151 } else
2152 if (strcmp(i->name, "playbackId") == 0) {
2153 args.playback_id = (i->value);
2154 } else
2155 {}
2156 }
2159 goto fin;
2160 }
2161 ast_ari_channels_play_with_id(headers, &args, response);
2162#if defined(AST_DEVMODE)
2163 code = response->response_code;
2164
2165 switch (code) {
2166 case 0: /* Implementation is still a stub, or the code wasn't set */
2167 is_valid = response->message == NULL;
2168 break;
2169 case 500: /* Internal Server Error */
2170 case 501: /* Not Implemented */
2171 case 404: /* Channel not found */
2172 case 409: /* Channel not in a Stasis application */
2173 case 412: /* Channel in invalid state */
2174 is_valid = 1;
2175 break;
2176 default:
2177 if (200 <= code && code <= 299) {
2178 is_valid = ast_ari_validate_playback(
2179 response->message);
2180 } else {
2181 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/play/{playbackId}\n", code);
2182 is_valid = 0;
2183 }
2184 }
2185
2186 if (!is_valid) {
2187 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/play/{playbackId}\n");
2188 ast_ari_response_error(response, 500,
2189 "Internal Server Error", "Response validation failed");
2190 }
2191#endif /* AST_DEVMODE */
2192
2193fin: __attribute__((unused))
2194 ast_free(args.media_parse);
2195 ast_free(args.media);
2196 return;
2197}
2199 struct ast_json *body,
2201{
2202 struct ast_json *field;
2203 /* Parse query parameters out of it */
2204 field = ast_json_object_get(body, "name");
2205 if (field) {
2206 args->name = ast_json_string_get(field);
2207 }
2208 field = ast_json_object_get(body, "format");
2209 if (field) {
2210 args->format = ast_json_string_get(field);
2211 }
2212 field = ast_json_object_get(body, "maxDurationSeconds");
2213 if (field) {
2214 args->max_duration_seconds = ast_json_integer_get(field);
2215 }
2216 field = ast_json_object_get(body, "maxSilenceSeconds");
2217 if (field) {
2218 args->max_silence_seconds = ast_json_integer_get(field);
2219 }
2220 field = ast_json_object_get(body, "ifExists");
2221 if (field) {
2222 args->if_exists = ast_json_string_get(field);
2223 }
2224 field = ast_json_object_get(body, "beep");
2225 if (field) {
2226 args->beep = ast_json_is_true(field);
2227 }
2228 field = ast_json_object_get(body, "terminateOn");
2229 if (field) {
2230 args->terminate_on = ast_json_string_get(field);
2231 }
2232 return 0;
2233}
2234
2235/*!
2236 * \brief Parameter parsing callback for /channels/{channelId}/record.
2237 * \param ser TCP/TLS session object
2238 * \param get_params GET parameters in the HTTP request.
2239 * \param path_vars Path variables extracted from the request.
2240 * \param headers HTTP headers.
2241 * \param body
2242 * \param[out] response Response to the HTTP request.
2243 */
2245 struct ast_tcptls_session_instance *ser,
2246 struct ast_variable *get_params, struct ast_variable *path_vars,
2247 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2248{
2250 struct ast_variable *i;
2251#if defined(AST_DEVMODE)
2252 int is_valid;
2253 int code;
2254#endif /* AST_DEVMODE */
2255
2256 for (i = get_params; i; i = i->next) {
2257 if (strcmp(i->name, "name") == 0) {
2258 args.name = (i->value);
2259 } else
2260 if (strcmp(i->name, "format") == 0) {
2261 args.format = (i->value);
2262 } else
2263 if (strcmp(i->name, "maxDurationSeconds") == 0) {
2264 args.max_duration_seconds = atoi(i->value);
2265 } else
2266 if (strcmp(i->name, "maxSilenceSeconds") == 0) {
2267 args.max_silence_seconds = atoi(i->value);
2268 } else
2269 if (strcmp(i->name, "ifExists") == 0) {
2270 args.if_exists = (i->value);
2271 } else
2272 if (strcmp(i->name, "beep") == 0) {
2273 args.beep = ast_true(i->value);
2274 } else
2275 if (strcmp(i->name, "terminateOn") == 0) {
2276 args.terminate_on = (i->value);
2277 } else
2278 {}
2279 }
2280 for (i = path_vars; i; i = i->next) {
2281 if (strcmp(i->name, "channelId") == 0) {
2282 args.channel_id = (i->value);
2283 } else
2284 {}
2285 }
2288 goto fin;
2289 }
2290 ast_ari_channels_record(headers, &args, response);
2291#if defined(AST_DEVMODE)
2292 code = response->response_code;
2293
2294 switch (code) {
2295 case 0: /* Implementation is still a stub, or the code wasn't set */
2296 is_valid = response->message == NULL;
2297 break;
2298 case 500: /* Internal Server Error */
2299 case 501: /* Not Implemented */
2300 case 400: /* Invalid parameters */
2301 case 404: /* Channel not found */
2302 case 409: /* Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
2303 case 422: /* The format specified is unknown on this system */
2304 is_valid = 1;
2305 break;
2306 default:
2307 if (200 <= code && code <= 299) {
2309 response->message);
2310 } else {
2311 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/record\n", code);
2312 is_valid = 0;
2313 }
2314 }
2315
2316 if (!is_valid) {
2317 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/record\n");
2318 ast_ari_response_error(response, 500,
2319 "Internal Server Error", "Response validation failed");
2320 }
2321#endif /* AST_DEVMODE */
2322
2323fin: __attribute__((unused))
2324 return;
2325}
2327 struct ast_json *body,
2329{
2330 struct ast_json *field;
2331 /* Parse query parameters out of it */
2332 field = ast_json_object_get(body, "variable");
2333 if (field) {
2334 args->variable = ast_json_string_get(field);
2335 }
2336 return 0;
2337}
2338
2339/*!
2340 * \brief Parameter parsing callback for /channels/{channelId}/variable.
2341 * \param ser TCP/TLS session object
2342 * \param get_params GET parameters in the HTTP request.
2343 * \param path_vars Path variables extracted from the request.
2344 * \param headers HTTP headers.
2345 * \param body
2346 * \param[out] response Response to the HTTP request.
2347 */
2349 struct ast_tcptls_session_instance *ser,
2350 struct ast_variable *get_params, struct ast_variable *path_vars,
2351 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2352{
2354 struct ast_variable *i;
2355#if defined(AST_DEVMODE)
2356 int is_valid;
2357 int code;
2358#endif /* AST_DEVMODE */
2359
2360 for (i = get_params; i; i = i->next) {
2361 if (strcmp(i->name, "variable") == 0) {
2362 args.variable = (i->value);
2363 } else
2364 {}
2365 }
2366 for (i = path_vars; i; i = i->next) {
2367 if (strcmp(i->name, "channelId") == 0) {
2368 args.channel_id = (i->value);
2369 } else
2370 {}
2371 }
2374 goto fin;
2375 }
2376 ast_ari_channels_get_channel_var(headers, &args, response);
2377#if defined(AST_DEVMODE)
2378 code = response->response_code;
2379
2380 switch (code) {
2381 case 0: /* Implementation is still a stub, or the code wasn't set */
2382 is_valid = response->message == NULL;
2383 break;
2384 case 500: /* Internal Server Error */
2385 case 501: /* Not Implemented */
2386 case 400: /* Missing variable parameter. */
2387 case 404: /* Channel or variable not found */
2388 case 409: /* Channel not in a Stasis application */
2389 is_valid = 1;
2390 break;
2391 default:
2392 if (200 <= code && code <= 299) {
2393 is_valid = ast_ari_validate_variable(
2394 response->message);
2395 } else {
2396 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
2397 is_valid = 0;
2398 }
2399 }
2400
2401 if (!is_valid) {
2402 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
2403 ast_ari_response_error(response, 500,
2404 "Internal Server Error", "Response validation failed");
2405 }
2406#endif /* AST_DEVMODE */
2407
2408fin: __attribute__((unused))
2409 return;
2410}
2412 struct ast_json *body,
2414{
2415 struct ast_json *field;
2416 /* Parse query parameters out of it */
2417 field = ast_json_object_get(body, "variable");
2418 if (field) {
2419 args->variable = ast_json_string_get(field);
2420 }
2421 field = ast_json_object_get(body, "value");
2422 if (field) {
2423 args->value = ast_json_string_get(field);
2424 }
2425 return 0;
2426}
2427
2428/*!
2429 * \brief Parameter parsing callback for /channels/{channelId}/variable.
2430 * \param ser TCP/TLS session object
2431 * \param get_params GET parameters in the HTTP request.
2432 * \param path_vars Path variables extracted from the request.
2433 * \param headers HTTP headers.
2434 * \param body
2435 * \param[out] response Response to the HTTP request.
2436 */
2438 struct ast_tcptls_session_instance *ser,
2439 struct ast_variable *get_params, struct ast_variable *path_vars,
2440 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2441{
2443 struct ast_variable *i;
2444#if defined(AST_DEVMODE)
2445 int is_valid;
2446 int code;
2447#endif /* AST_DEVMODE */
2448
2449 for (i = get_params; i; i = i->next) {
2450 if (strcmp(i->name, "variable") == 0) {
2451 args.variable = (i->value);
2452 } else
2453 if (strcmp(i->name, "value") == 0) {
2454 args.value = (i->value);
2455 } else
2456 {}
2457 }
2458 for (i = path_vars; i; i = i->next) {
2459 if (strcmp(i->name, "channelId") == 0) {
2460 args.channel_id = (i->value);
2461 } else
2462 {}
2463 }
2466 goto fin;
2467 }
2468 ast_ari_channels_set_channel_var(headers, &args, response);
2469#if defined(AST_DEVMODE)
2470 code = response->response_code;
2471
2472 switch (code) {
2473 case 0: /* Implementation is still a stub, or the code wasn't set */
2474 is_valid = response->message == NULL;
2475 break;
2476 case 500: /* Internal Server Error */
2477 case 501: /* Not Implemented */
2478 case 400: /* Missing variable parameter. */
2479 case 404: /* Channel not found */
2480 case 409: /* Channel not in a Stasis application */
2481 is_valid = 1;
2482 break;
2483 default:
2484 if (200 <= code && code <= 299) {
2485 is_valid = ast_ari_validate_void(
2486 response->message);
2487 } else {
2488 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
2489 is_valid = 0;
2490 }
2491 }
2492
2493 if (!is_valid) {
2494 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
2495 ast_ari_response_error(response, 500,
2496 "Internal Server Error", "Response validation failed");
2497 }
2498#endif /* AST_DEVMODE */
2499
2500fin: __attribute__((unused))
2501 return;
2502}
2504 struct ast_json *body,
2506{
2507 struct ast_json *field;
2508 /* Parse query parameters out of it */
2509 field = ast_json_object_get(body, "spy");
2510 if (field) {
2511 args->spy = ast_json_string_get(field);
2512 }
2513 field = ast_json_object_get(body, "whisper");
2514 if (field) {
2515 args->whisper = ast_json_string_get(field);
2516 }
2517 field = ast_json_object_get(body, "app");
2518 if (field) {
2519 args->app = ast_json_string_get(field);
2520 }
2521 field = ast_json_object_get(body, "appArgs");
2522 if (field) {
2523 args->app_args = ast_json_string_get(field);
2524 }
2525 field = ast_json_object_get(body, "snoopId");
2526 if (field) {
2527 args->snoop_id = ast_json_string_get(field);
2528 }
2529 return 0;
2530}
2531
2532/*!
2533 * \brief Parameter parsing callback for /channels/{channelId}/snoop.
2534 * \param ser TCP/TLS session object
2535 * \param get_params GET parameters in the HTTP request.
2536 * \param path_vars Path variables extracted from the request.
2537 * \param headers HTTP headers.
2538 * \param body
2539 * \param[out] response Response to the HTTP request.
2540 */
2542 struct ast_tcptls_session_instance *ser,
2543 struct ast_variable *get_params, struct ast_variable *path_vars,
2544 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2545{
2547 struct ast_variable *i;
2548#if defined(AST_DEVMODE)
2549 int is_valid;
2550 int code;
2551#endif /* AST_DEVMODE */
2552
2553 for (i = get_params; i; i = i->next) {
2554 if (strcmp(i->name, "spy") == 0) {
2555 args.spy = (i->value);
2556 } else
2557 if (strcmp(i->name, "whisper") == 0) {
2558 args.whisper = (i->value);
2559 } else
2560 if (strcmp(i->name, "app") == 0) {
2561 args.app = (i->value);
2562 } else
2563 if (strcmp(i->name, "appArgs") == 0) {
2564 args.app_args = (i->value);
2565 } else
2566 if (strcmp(i->name, "snoopId") == 0) {
2567 args.snoop_id = (i->value);
2568 } else
2569 {}
2570 }
2571 for (i = path_vars; i; i = i->next) {
2572 if (strcmp(i->name, "channelId") == 0) {
2573 args.channel_id = (i->value);
2574 } else
2575 {}
2576 }
2579 goto fin;
2580 }
2581 ast_ari_channels_snoop_channel(headers, &args, response);
2582#if defined(AST_DEVMODE)
2583 code = response->response_code;
2584
2585 switch (code) {
2586 case 0: /* Implementation is still a stub, or the code wasn't set */
2587 is_valid = response->message == NULL;
2588 break;
2589 case 500: /* Internal Server Error */
2590 case 501: /* Not Implemented */
2591 case 400: /* Invalid parameters */
2592 case 404: /* Channel not found */
2593 is_valid = 1;
2594 break;
2595 default:
2596 if (200 <= code && code <= 299) {
2597 is_valid = ast_ari_validate_channel(
2598 response->message);
2599 } else {
2600 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/snoop\n", code);
2601 is_valid = 0;
2602 }
2603 }
2604
2605 if (!is_valid) {
2606 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/snoop\n");
2607 ast_ari_response_error(response, 500,
2608 "Internal Server Error", "Response validation failed");
2609 }
2610#endif /* AST_DEVMODE */
2611
2612fin: __attribute__((unused))
2613 return;
2614}
2616 struct ast_json *body,
2618{
2619 struct ast_json *field;
2620 /* Parse query parameters out of it */
2621 field = ast_json_object_get(body, "spy");
2622 if (field) {
2623 args->spy = ast_json_string_get(field);
2624 }
2625 field = ast_json_object_get(body, "whisper");
2626 if (field) {
2627 args->whisper = ast_json_string_get(field);
2628 }
2629 field = ast_json_object_get(body, "app");
2630 if (field) {
2631 args->app = ast_json_string_get(field);
2632 }
2633 field = ast_json_object_get(body, "appArgs");
2634 if (field) {
2635 args->app_args = ast_json_string_get(field);
2636 }
2637 return 0;
2638}
2639
2640/*!
2641 * \brief Parameter parsing callback for /channels/{channelId}/snoop/{snoopId}.
2642 * \param ser TCP/TLS session object
2643 * \param get_params GET parameters in the HTTP request.
2644 * \param path_vars Path variables extracted from the request.
2645 * \param headers HTTP headers.
2646 * \param body
2647 * \param[out] response Response to the HTTP request.
2648 */
2650 struct ast_tcptls_session_instance *ser,
2651 struct ast_variable *get_params, struct ast_variable *path_vars,
2652 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2653{
2655 struct ast_variable *i;
2656#if defined(AST_DEVMODE)
2657 int is_valid;
2658 int code;
2659#endif /* AST_DEVMODE */
2660
2661 for (i = get_params; i; i = i->next) {
2662 if (strcmp(i->name, "spy") == 0) {
2663 args.spy = (i->value);
2664 } else
2665 if (strcmp(i->name, "whisper") == 0) {
2666 args.whisper = (i->value);
2667 } else
2668 if (strcmp(i->name, "app") == 0) {
2669 args.app = (i->value);
2670 } else
2671 if (strcmp(i->name, "appArgs") == 0) {
2672 args.app_args = (i->value);
2673 } else
2674 {}
2675 }
2676 for (i = path_vars; i; i = i->next) {
2677 if (strcmp(i->name, "channelId") == 0) {
2678 args.channel_id = (i->value);
2679 } else
2680 if (strcmp(i->name, "snoopId") == 0) {
2681 args.snoop_id = (i->value);
2682 } else
2683 {}
2684 }
2687 goto fin;
2688 }
2689 ast_ari_channels_snoop_channel_with_id(headers, &args, response);
2690#if defined(AST_DEVMODE)
2691 code = response->response_code;
2692
2693 switch (code) {
2694 case 0: /* Implementation is still a stub, or the code wasn't set */
2695 is_valid = response->message == NULL;
2696 break;
2697 case 500: /* Internal Server Error */
2698 case 501: /* Not Implemented */
2699 case 400: /* Invalid parameters */
2700 case 404: /* Channel not found */
2701 is_valid = 1;
2702 break;
2703 default:
2704 if (200 <= code && code <= 299) {
2705 is_valid = ast_ari_validate_channel(
2706 response->message);
2707 } else {
2708 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/snoop/{snoopId}\n", code);
2709 is_valid = 0;
2710 }
2711 }
2712
2713 if (!is_valid) {
2714 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/snoop/{snoopId}\n");
2715 ast_ari_response_error(response, 500,
2716 "Internal Server Error", "Response validation failed");
2717 }
2718#endif /* AST_DEVMODE */
2719
2720fin: __attribute__((unused))
2721 return;
2722}
2724 struct ast_json *body,
2726{
2727 struct ast_json *field;
2728 /* Parse query parameters out of it */
2729 field = ast_json_object_get(body, "caller");
2730 if (field) {
2731 args->caller = ast_json_string_get(field);
2732 }
2733 field = ast_json_object_get(body, "timeout");
2734 if (field) {
2735 args->timeout = ast_json_integer_get(field);
2736 }
2737 return 0;
2738}
2739
2740/*!
2741 * \brief Parameter parsing callback for /channels/{channelId}/dial.
2742 * \param ser TCP/TLS session object
2743 * \param get_params GET parameters in the HTTP request.
2744 * \param path_vars Path variables extracted from the request.
2745 * \param headers HTTP headers.
2746 * \param body
2747 * \param[out] response Response to the HTTP request.
2748 */
2750 struct ast_tcptls_session_instance *ser,
2751 struct ast_variable *get_params, struct ast_variable *path_vars,
2752 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2753{
2754 struct ast_ari_channels_dial_args args = {};
2755 struct ast_variable *i;
2756#if defined(AST_DEVMODE)
2757 int is_valid;
2758 int code;
2759#endif /* AST_DEVMODE */
2760
2761 for (i = get_params; i; i = i->next) {
2762 if (strcmp(i->name, "caller") == 0) {
2763 args.caller = (i->value);
2764 } else
2765 if (strcmp(i->name, "timeout") == 0) {
2766 args.timeout = atoi(i->value);
2767 } else
2768 {}
2769 }
2770 for (i = path_vars; i; i = i->next) {
2771 if (strcmp(i->name, "channelId") == 0) {
2772 args.channel_id = (i->value);
2773 } else
2774 {}
2775 }
2778 goto fin;
2779 }
2780 ast_ari_channels_dial(headers, &args, response);
2781#if defined(AST_DEVMODE)
2782 code = response->response_code;
2783
2784 switch (code) {
2785 case 0: /* Implementation is still a stub, or the code wasn't set */
2786 is_valid = response->message == NULL;
2787 break;
2788 case 500: /* Internal Server Error */
2789 case 501: /* Not Implemented */
2790 case 404: /* Channel cannot be found. */
2791 case 409: /* Channel cannot be dialed. */
2792 is_valid = 1;
2793 break;
2794 default:
2795 if (200 <= code && code <= 299) {
2796 is_valid = ast_ari_validate_void(
2797 response->message);
2798 } else {
2799 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/dial\n", code);
2800 is_valid = 0;
2801 }
2802 }
2803
2804 if (!is_valid) {
2805 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/dial\n");
2806 ast_ari_response_error(response, 500,
2807 "Internal Server Error", "Response validation failed");
2808 }
2809#endif /* AST_DEVMODE */
2810
2811fin: __attribute__((unused))
2812 return;
2813}
2814/*!
2815 * \brief Parameter parsing callback for /channels/{channelId}/rtp_statistics.
2816 * \param ser TCP/TLS session object
2817 * \param get_params GET parameters in the HTTP request.
2818 * \param path_vars Path variables extracted from the request.
2819 * \param headers HTTP headers.
2820 * \param body
2821 * \param[out] response Response to the HTTP request.
2822 */
2824 struct ast_tcptls_session_instance *ser,
2825 struct ast_variable *get_params, struct ast_variable *path_vars,
2826 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2827{
2829 struct ast_variable *i;
2830#if defined(AST_DEVMODE)
2831 int is_valid;
2832 int code;
2833#endif /* AST_DEVMODE */
2834
2835 for (i = path_vars; i; i = i->next) {
2836 if (strcmp(i->name, "channelId") == 0) {
2837 args.channel_id = (i->value);
2838 } else
2839 {}
2840 }
2841 ast_ari_channels_rtpstatistics(headers, &args, response);
2842#if defined(AST_DEVMODE)
2843 code = response->response_code;
2844
2845 switch (code) {
2846 case 0: /* Implementation is still a stub, or the code wasn't set */
2847 is_valid = response->message == NULL;
2848 break;
2849 case 500: /* Internal Server Error */
2850 case 501: /* Not Implemented */
2851 case 404: /* Channel cannot be found. */
2852 is_valid = 1;
2853 break;
2854 default:
2855 if (200 <= code && code <= 299) {
2856 is_valid = ast_ari_validate_rtpstat(
2857 response->message);
2858 } else {
2859 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/rtp_statistics\n", code);
2860 is_valid = 0;
2861 }
2862 }
2863
2864 if (!is_valid) {
2865 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/rtp_statistics\n");
2866 ast_ari_response_error(response, 500,
2867 "Internal Server Error", "Response validation failed");
2868 }
2869#endif /* AST_DEVMODE */
2870
2871fin: __attribute__((unused))
2872 return;
2873}
2875 struct ast_json *body,
2877{
2878 struct ast_json *field;
2879 /* Parse query parameters out of it */
2880 field = ast_json_object_get(body, "channelId");
2881 if (field) {
2882 args->channel_id = ast_json_string_get(field);
2883 }
2884 field = ast_json_object_get(body, "app");
2885 if (field) {
2886 args->app = ast_json_string_get(field);
2887 }
2888 field = ast_json_object_get(body, "external_host");
2889 if (field) {
2890 args->external_host = ast_json_string_get(field);
2891 }
2892 field = ast_json_object_get(body, "encapsulation");
2893 if (field) {
2894 args->encapsulation = ast_json_string_get(field);
2895 }
2896 field = ast_json_object_get(body, "transport");
2897 if (field) {
2898 args->transport = ast_json_string_get(field);
2899 }
2900 field = ast_json_object_get(body, "connection_type");
2901 if (field) {
2902 args->connection_type = ast_json_string_get(field);
2903 }
2904 field = ast_json_object_get(body, "format");
2905 if (field) {
2906 args->format = ast_json_string_get(field);
2907 }
2908 field = ast_json_object_get(body, "direction");
2909 if (field) {
2910 args->direction = ast_json_string_get(field);
2911 }
2912 field = ast_json_object_get(body, "data");
2913 if (field) {
2914 args->data = ast_json_string_get(field);
2915 }
2916 return 0;
2917}
2918
2919/*!
2920 * \brief Parameter parsing callback for /channels/externalMedia.
2921 * \param ser TCP/TLS session object
2922 * \param get_params GET parameters in the HTTP request.
2923 * \param path_vars Path variables extracted from the request.
2924 * \param headers HTTP headers.
2925 * \param body
2926 * \param[out] response Response to the HTTP request.
2927 */
2929 struct ast_tcptls_session_instance *ser,
2930 struct ast_variable *get_params, struct ast_variable *path_vars,
2931 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
2932{
2934 struct ast_variable *i;
2935#if defined(AST_DEVMODE)
2936 int is_valid;
2937 int code;
2938#endif /* AST_DEVMODE */
2939
2940 for (i = get_params; i; i = i->next) {
2941 if (strcmp(i->name, "channelId") == 0) {
2942 args.channel_id = (i->value);
2943 } else
2944 if (strcmp(i->name, "app") == 0) {
2945 args.app = (i->value);
2946 } else
2947 if (strcmp(i->name, "external_host") == 0) {
2948 args.external_host = (i->value);
2949 } else
2950 if (strcmp(i->name, "encapsulation") == 0) {
2951 args.encapsulation = (i->value);
2952 } else
2953 if (strcmp(i->name, "transport") == 0) {
2954 args.transport = (i->value);
2955 } else
2956 if (strcmp(i->name, "connection_type") == 0) {
2957 args.connection_type = (i->value);
2958 } else
2959 if (strcmp(i->name, "format") == 0) {
2960 args.format = (i->value);
2961 } else
2962 if (strcmp(i->name, "direction") == 0) {
2963 args.direction = (i->value);
2964 } else
2965 if (strcmp(i->name, "data") == 0) {
2966 args.data = (i->value);
2967 } else
2968 {}
2969 }
2970 args.variables = body;
2971 ast_ari_channels_external_media(headers, &args, response);
2972#if defined(AST_DEVMODE)
2973 code = response->response_code;
2974
2975 switch (code) {
2976 case 0: /* Implementation is still a stub, or the code wasn't set */
2977 is_valid = response->message == NULL;
2978 break;
2979 case 500: /* Internal Server Error */
2980 case 501: /* Not Implemented */
2981 case 400: /* Invalid parameters */
2982 case 409: /* Channel is not in a Stasis application; Channel is already bridged */
2983 is_valid = 1;
2984 break;
2985 default:
2986 if (200 <= code && code <= 299) {
2987 is_valid = ast_ari_validate_channel(
2988 response->message);
2989 } else {
2990 ast_log(LOG_ERROR, "Invalid error response %d for /channels/externalMedia\n", code);
2991 is_valid = 0;
2992 }
2993 }
2994
2995 if (!is_valid) {
2996 ast_log(LOG_ERROR, "Response validation failed for /channels/externalMedia\n");
2997 ast_ari_response_error(response, 500,
2998 "Internal Server Error", "Response validation failed");
2999 }
3000#endif /* AST_DEVMODE */
3001
3002fin: __attribute__((unused))
3003 return;
3004}
3005
3006/*! \brief REST handler for /api-docs/channels.json */
3008 .path_segment = "create",
3009 .callbacks = {
3011 },
3012 .num_children = 0,
3013 .children = { }
3014};
3015/*! \brief REST handler for /api-docs/channels.json */
3017 .path_segment = "continue",
3018 .callbacks = {
3020 },
3021 .num_children = 0,
3022 .children = { }
3023};
3024/*! \brief REST handler for /api-docs/channels.json */
3026 .path_segment = "move",
3027 .callbacks = {
3029 },
3030 .num_children = 0,
3031 .children = { }
3032};
3033/*! \brief REST handler for /api-docs/channels.json */
3035 .path_segment = "redirect",
3036 .callbacks = {
3038 },
3039 .num_children = 0,
3040 .children = { }
3041};
3042/*! \brief REST handler for /api-docs/channels.json */
3044 .path_segment = "answer",
3045 .callbacks = {
3047 },
3048 .num_children = 0,
3049 .children = { }
3050};
3051/*! \brief REST handler for /api-docs/channels.json */
3053 .path_segment = "ring",
3054 .callbacks = {
3057 },
3058 .num_children = 0,
3059 .children = { }
3060};
3061/*! \brief REST handler for /api-docs/channels.json */
3063 .path_segment = "dtmf",
3064 .callbacks = {
3066 },
3067 .num_children = 0,
3068 .children = { }
3069};
3070/*! \brief REST handler for /api-docs/channels.json */
3072 .path_segment = "mute",
3073 .callbacks = {
3076 },
3077 .num_children = 0,
3078 .children = { }
3079};
3080/*! \brief REST handler for /api-docs/channels.json */
3082 .path_segment = "hold",
3083 .callbacks = {
3086 },
3087 .num_children = 0,
3088 .children = { }
3089};
3090/*! \brief REST handler for /api-docs/channels.json */
3092 .path_segment = "moh",
3093 .callbacks = {
3096 },
3097 .num_children = 0,
3098 .children = { }
3099};
3100/*! \brief REST handler for /api-docs/channels.json */
3102 .path_segment = "silence",
3103 .callbacks = {
3106 },
3107 .num_children = 0,
3108 .children = { }
3109};
3110/*! \brief REST handler for /api-docs/channels.json */
3112 .path_segment = "playbackId",
3113 .is_wildcard = 1,
3114 .callbacks = {
3116 },
3117 .num_children = 0,
3118 .children = { }
3119};
3120/*! \brief REST handler for /api-docs/channels.json */
3122 .path_segment = "play",
3123 .callbacks = {
3125 },
3126 .num_children = 1,
3127 .children = { &channels_channelId_play_playbackId, }
3128};
3129/*! \brief REST handler for /api-docs/channels.json */
3131 .path_segment = "record",
3132 .callbacks = {
3134 },
3135 .num_children = 0,
3136 .children = { }
3137};
3138/*! \brief REST handler for /api-docs/channels.json */
3140 .path_segment = "variable",
3141 .callbacks = {
3144 },
3145 .num_children = 0,
3146 .children = { }
3147};
3148/*! \brief REST handler for /api-docs/channels.json */
3150 .path_segment = "snoopId",
3151 .is_wildcard = 1,
3152 .callbacks = {
3154 },
3155 .num_children = 0,
3156 .children = { }
3157};
3158/*! \brief REST handler for /api-docs/channels.json */
3160 .path_segment = "snoop",
3161 .callbacks = {
3163 },
3164 .num_children = 1,
3165 .children = { &channels_channelId_snoop_snoopId, }
3166};
3167/*! \brief REST handler for /api-docs/channels.json */
3169 .path_segment = "dial",
3170 .callbacks = {
3172 },
3173 .num_children = 0,
3174 .children = { }
3175};
3176/*! \brief REST handler for /api-docs/channels.json */
3178 .path_segment = "rtp_statistics",
3179 .callbacks = {
3181 },
3182 .num_children = 0,
3183 .children = { }
3184};
3185/*! \brief REST handler for /api-docs/channels.json */
3187 .path_segment = "channelId",
3188 .is_wildcard = 1,
3189 .callbacks = {
3193 },
3194 .num_children = 16,
3196};
3197/*! \brief REST handler for /api-docs/channels.json */
3199 .path_segment = "externalMedia",
3200 .callbacks = {
3202 },
3203 .num_children = 0,
3204 .children = { }
3205};
3206/*! \brief REST handler for /api-docs/channels.json */
3208 .path_segment = "channels",
3209 .callbacks = {
3212 },
3213 .num_children = 3,
3215};
3216
3217static int unload_module(void)
3218{
3220 return 0;
3221}
3222
3223static int load_module(void)
3224{
3225 int res = 0;
3226
3227
3229 if (res) {
3230 unload_module();
3232 }
3233
3235}
3236
3237AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Channel resources",
3238 .support_level = AST_MODULE_SUPPORT_CORE,
3239 .load = load_module,
3240 .unload = unload_module,
3241 .requires = "res_ari,res_ari_model,res_stasis,res_stasis_answer,res_stasis_playback,res_stasis_recording,res_stasis_snoop",
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:202
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:259
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:298
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:179
int ast_ari_validate_variable(struct ast_json *json)
Validator for Variable.
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
int ast_ari_validate_rtpstat(struct ast_json *json)
Validator for RTPstat.
ari_validator ast_ari_validate_channel_fn(void)
Function pointer to ast_ari_validate_channel().
Generated file - Build validators for ARI model objects.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
Asterisk main include file. File version handling, generic pbx functions.
#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
@ AST_HTTP_DELETE
Definition: http.h:64
@ AST_HTTP_POST
Definition: http.h:61
@ AST_HTTP_GET
Definition: http.h:60
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define ast_app_separate_args(a, b, c, d)
#define LOG_ERROR
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
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
Definition: json.c:332
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
Asterisk module definitions.
@ AST_MODFLAG_DEFAULT
Definition: module.h:315
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Definition: module.h:543
@ AST_MODULE_SUPPORT_CORE
Definition: module.h:121
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
@ 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 struct stasis_rest_handlers channels_channelId_hold
REST handler for /api-docs/channels.json.
int ast_ari_channels_move_parse_body(struct ast_json *body, struct ast_ari_channels_move_args *args)
Body parsing function for /channels/{channelId}/move.
int ast_ari_channels_send_dtmf_parse_body(struct ast_json *body, struct ast_ari_channels_send_dtmf_args *args)
Body parsing function for /channels/{channelId}/dtmf.
static void ast_ari_channels_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 /channels/{channelId}/moh.
static struct stasis_rest_handlers channels_channelId_snoop
REST handler for /api-docs/channels.json.
static void ast_ari_channels_start_silence_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 /channels/{channelId}/silence.
int ast_ari_channels_dial_parse_body(struct ast_json *body, struct ast_ari_channels_dial_args *args)
Body parsing function for /channels/{channelId}/dial.
static void ast_ari_channels_mute_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 /channels/{channelId}/mute.
static struct stasis_rest_handlers channels_channelId_silence
REST handler for /api-docs/channels.json.
int ast_ari_channels_unmute_parse_body(struct ast_json *body, struct ast_ari_channels_unmute_args *args)
Body parsing function for /channels/{channelId}/mute.
int ast_ari_channels_get_channel_var_parse_body(struct ast_json *body, struct ast_ari_channels_get_channel_var_args *args)
Body parsing function for /channels/{channelId}/variable.
static void ast_ari_channels_hangup_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 /channels/{channelId}.
static struct stasis_rest_handlers channels_channelId_mute
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_create
REST handler for /api-docs/channels.json.
static void ast_ari_channels_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 /channels/{channelId}/moh.
int ast_ari_channels_snoop_channel_with_id_parse_body(struct ast_json *body, struct ast_ari_channels_snoop_channel_with_id_args *args)
Body parsing function for /channels/{channelId}/snoop/{snoopId}.
int ast_ari_channels_mute_parse_body(struct ast_json *body, struct ast_ari_channels_mute_args *args)
Body parsing function for /channels/{channelId}/mute.
static void ast_ari_channels_send_dtmf_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 /channels/{channelId}/dtmf.
static void ast_ari_channels_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 /channels/{channelId}/play.
#define MAX_VALS
int ast_ari_channels_redirect_parse_body(struct ast_json *body, struct ast_ari_channels_redirect_args *args)
Body parsing function for /channels/{channelId}/redirect.
static struct stasis_rest_handlers channels_channelId
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_variable
REST handler for /api-docs/channels.json.
int ast_ari_channels_record_parse_body(struct ast_json *body, struct ast_ari_channels_record_args *args)
Body parsing function for /channels/{channelId}/record.
static void ast_ari_channels_stop_silence_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 /channels/{channelId}/silence.
static void ast_ari_channels_unmute_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 /channels/{channelId}/mute.
static void ast_ari_channels_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 /channels.
int ast_ari_channels_snoop_channel_parse_body(struct ast_json *body, struct ast_ari_channels_snoop_channel_args *args)
Body parsing function for /channels/{channelId}/snoop.
static struct stasis_rest_handlers channels_channelId_answer
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_record
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_rtp_statistics
REST handler for /api-docs/channels.json.
static void ast_ari_channels_snoop_channel_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 /channels/{channelId}/snoop/{snoopId}.
static void ast_ari_channels_hold_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 /channels/{channelId}/hold.
static void ast_ari_channels_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 /channels/{channelId}/record.
static void ast_ari_channels_move_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 /channels/{channelId}/move.
static struct stasis_rest_handlers channels_channelId_moh
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_play
REST handler for /api-docs/channels.json.
static void ast_ari_channels_ring_stop_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 /channels/{channelId}/ring.
static struct stasis_rest_handlers channels_channelId_continue
REST handler for /api-docs/channels.json.
static void ast_ari_channels_dial_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 /channels/{channelId}/dial.
static void ast_ari_channels_ring_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 /channels/{channelId}/ring.
int ast_ari_channels_continue_in_dialplan_parse_body(struct ast_json *body, struct ast_ari_channels_continue_in_dialplan_args *args)
Body parsing function for /channels/{channelId}/continue.
static void ast_ari_channels_originate_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 /channels.
int ast_ari_channels_originate_with_id_parse_body(struct ast_json *body, struct ast_ari_channels_originate_with_id_args *args)
Body parsing function for /channels/{channelId}.
static void ast_ari_channels_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 /channels/{channelId}/play/{playbackId}.
static void ast_ari_channels_snoop_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 /channels/{channelId}/snoop.
static void ast_ari_channels_set_channel_var_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 /channels/{channelId}/variable.
static struct stasis_rest_handlers channels_channelId_snoop_snoopId
REST handler for /api-docs/channels.json.
int ast_ari_channels_play_with_id_parse_body(struct ast_json *body, struct ast_ari_channels_play_with_id_args *args)
Body parsing function for /channels/{channelId}/play/{playbackId}.
int ast_ari_channels_create_parse_body(struct ast_json *body, struct ast_ari_channels_create_args *args)
Body parsing function for /channels/create.
static void ast_ari_channels_rtpstatistics_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 /channels/{channelId}/rtp_statistics.
static struct stasis_rest_handlers channels_channelId_dtmf
REST handler for /api-docs/channels.json.
static void ast_ari_channels_external_media_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 /channels/externalMedia.
int ast_ari_channels_external_media_parse_body(struct ast_json *body, struct ast_ari_channels_external_media_args *args)
Body parsing function for /channels/externalMedia.
int ast_ari_channels_play_parse_body(struct ast_json *body, struct ast_ari_channels_play_args *args)
Body parsing function for /channels/{channelId}/play.
static struct stasis_rest_handlers channels_externalMedia
REST handler for /api-docs/channels.json.
int ast_ari_channels_set_channel_var_parse_body(struct ast_json *body, struct ast_ari_channels_set_channel_var_args *args)
Body parsing function for /channels/{channelId}/variable.
static void ast_ari_channels_get_channel_var_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 /channels/{channelId}/variable.
static int load_module(void)
static struct stasis_rest_handlers channels_channelId_move
REST handler for /api-docs/channels.json.
int ast_ari_channels_start_moh_parse_body(struct ast_json *body, struct ast_ari_channels_start_moh_args *args)
Body parsing function for /channels/{channelId}/moh.
static int unload_module(void)
static struct stasis_rest_handlers channels_channelId_ring
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_redirect
REST handler for /api-docs/channels.json.
static void ast_ari_channels_continue_in_dialplan_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 /channels/{channelId}/continue.
static struct stasis_rest_handlers channels_channelId_dial
REST handler for /api-docs/channels.json.
static void ast_ari_channels_originate_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 /channels/{channelId}.
static void ast_ari_channels_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 /channels/create.
static struct stasis_rest_handlers channels_channelId_play_playbackId
REST handler for /api-docs/channels.json.
int ast_ari_channels_originate_parse_body(struct ast_json *body, struct ast_ari_channels_originate_args *args)
Body parsing function for /channels.
static void ast_ari_channels_redirect_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 /channels/{channelId}/redirect.
static struct stasis_rest_handlers channels
REST handler for /api-docs/channels.json.
static void ast_ari_channels_unhold_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 /channels/{channelId}/hold.
static void ast_ari_channels_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 /channels/{channelId}.
static void ast_ari_channels_answer_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 /channels/{channelId}/answer.
int ast_ari_channels_hangup_parse_body(struct ast_json *body, struct ast_ari_channels_hangup_args *args)
Body parsing function for /channels/{channelId}.
#define NULL
Definition: resample.c:96
void ast_ari_channels_mute(struct ast_variable *headers, struct ast_ari_channels_mute_args *args, struct ast_ari_response *response)
Mute a channel.
void ast_ari_channels_snoop_channel_with_id(struct ast_variable *headers, struct ast_ari_channels_snoop_channel_with_id_args *args, struct ast_ari_response *response)
Start snooping.
void ast_ari_channels_continue_in_dialplan(struct ast_variable *headers, struct ast_ari_channels_continue_in_dialplan_args *args, struct ast_ari_response *response)
Exit application; continue execution in the dialplan.
void ast_ari_channels_start_moh(struct ast_variable *headers, struct ast_ari_channels_start_moh_args *args, struct ast_ari_response *response)
Play music on hold to a channel.
void ast_ari_channels_stop_moh(struct ast_variable *headers, struct ast_ari_channels_stop_moh_args *args, struct ast_ari_response *response)
Stop playing music on hold to a channel.
void ast_ari_channels_move(struct ast_variable *headers, struct ast_ari_channels_move_args *args, struct ast_ari_response *response)
Move the channel from one Stasis application to another.
void ast_ari_channels_send_dtmf(struct ast_variable *headers, struct ast_ari_channels_send_dtmf_args *args, struct ast_ari_response *response)
Send provided DTMF to a given channel.
void ast_ari_channels_unmute(struct ast_variable *headers, struct ast_ari_channels_unmute_args *args, struct ast_ari_response *response)
Unmute a channel.
void ast_ari_channels_dial(struct ast_variable *headers, struct ast_ari_channels_dial_args *args, struct ast_ari_response *response)
Dial a created channel.
void ast_ari_channels_create(struct ast_variable *headers, struct ast_ari_channels_create_args *args, struct ast_ari_response *response)
Create channel.
void ast_ari_channels_list(struct ast_variable *headers, struct ast_ari_channels_list_args *args, struct ast_ari_response *response)
List all active channels in Asterisk.
void ast_ari_channels_get(struct ast_variable *headers, struct ast_ari_channels_get_args *args, struct ast_ari_response *response)
Channel details.
void ast_ari_channels_snoop_channel(struct ast_variable *headers, struct ast_ari_channels_snoop_channel_args *args, struct ast_ari_response *response)
Start snooping.
void ast_ari_channels_ring(struct ast_variable *headers, struct ast_ari_channels_ring_args *args, struct ast_ari_response *response)
Indicate ringing to a channel.
void ast_ari_channels_play(struct ast_variable *headers, struct ast_ari_channels_play_args *args, struct ast_ari_response *response)
Start playback of media.
void ast_ari_channels_stop_silence(struct ast_variable *headers, struct ast_ari_channels_stop_silence_args *args, struct ast_ari_response *response)
Stop playing silence to a channel.
void ast_ari_channels_external_media(struct ast_variable *headers, struct ast_ari_channels_external_media_args *args, struct ast_ari_response *response)
Start an External Media session.
void ast_ari_channels_ring_stop(struct ast_variable *headers, struct ast_ari_channels_ring_stop_args *args, struct ast_ari_response *response)
Stop ringing indication on a channel if locally generated.
void ast_ari_channels_start_silence(struct ast_variable *headers, struct ast_ari_channels_start_silence_args *args, struct ast_ari_response *response)
Play silence to a channel.
void ast_ari_channels_unhold(struct ast_variable *headers, struct ast_ari_channels_unhold_args *args, struct ast_ari_response *response)
Remove a channel from hold.
void ast_ari_channels_originate(struct ast_variable *headers, struct ast_ari_channels_originate_args *args, struct ast_ari_response *response)
Create a new channel (originate).
void ast_ari_channels_redirect(struct ast_variable *headers, struct ast_ari_channels_redirect_args *args, struct ast_ari_response *response)
Redirect the channel to a different location.
void ast_ari_channels_record(struct ast_variable *headers, struct ast_ari_channels_record_args *args, struct ast_ari_response *response)
Start a recording.
void ast_ari_channels_set_channel_var(struct ast_variable *headers, struct ast_ari_channels_set_channel_var_args *args, struct ast_ari_response *response)
Set the value of a channel variable or function.
void ast_ari_channels_hold(struct ast_variable *headers, struct ast_ari_channels_hold_args *args, struct ast_ari_response *response)
Hold a channel.
void ast_ari_channels_answer(struct ast_variable *headers, struct ast_ari_channels_answer_args *args, struct ast_ari_response *response)
Answer a channel.
void ast_ari_channels_play_with_id(struct ast_variable *headers, struct ast_ari_channels_play_with_id_args *args, struct ast_ari_response *response)
Start playback of media and specify the playbackId.
void ast_ari_channels_rtpstatistics(struct ast_variable *headers, struct ast_ari_channels_rtpstatistics_args *args, struct ast_ari_response *response)
RTP stats on a channel.
void ast_ari_channels_get_channel_var(struct ast_variable *headers, struct ast_ari_channels_get_channel_var_args *args, struct ast_ari_response *response)
Get the value of a channel variable or function.
void ast_ari_channels_originate_with_id(struct ast_variable *headers, struct ast_ari_channels_originate_with_id_args *args, struct ast_ari_response *response)
Create a new channel (originate with id).
void ast_ari_channels_hangup(struct ast_variable *headers, struct ast_ari_channels_hangup_args *args, struct ast_ari_response *response)
Delete (i.e. hangup) a channel.
Generated file - declares stubs to be implemented in res/ari/resource_channels.c.
Stasis Application API. See Stasis Application API for detailed documentation.
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:2199
struct ast_json * message
Definition: ari.h:94
int response_code
Definition: ari.h:99
Abstract JSON element (object, array, string, int, ...).
describes a server instance
Definition: tcptls.h:150
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Handler for a single RESTful path segment.
Definition: ari.h:69
const char * path_segment
Definition: ari.h:71
const char * args
#define ARRAY_LEN(a)
Definition: utils.h:666