Asterisk - The Open Source Telephony Project GIT-master-650240a
res_ari_endpoints.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 Endpoint 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 <support_level>core</support_level>
39 ***/
40
41#include "asterisk.h"
42
43#include "asterisk/app.h"
44#include "asterisk/module.h"
45#include "asterisk/stasis_app.h"
47#if defined(AST_DEVMODE)
49#endif
50
51#define MAX_VALS 128
52
53/*!
54 * \brief Parameter parsing callback for /endpoints.
55 * \param ser TCP/TLS session object
56 * \param get_params GET parameters in the HTTP request.
57 * \param path_vars Path variables extracted from the request.
58 * \param headers HTTP headers.
59 * \param body
60 * \param[out] response Response to the HTTP request.
61 */
64 struct ast_variable *get_params, struct ast_variable *path_vars,
65 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
66{
68#if defined(AST_DEVMODE)
69 int is_valid;
70 int code;
71#endif /* AST_DEVMODE */
72
73 ast_ari_endpoints_list(headers, &args, response);
74#if defined(AST_DEVMODE)
75 code = response->response_code;
76
77 switch (code) {
78 case 0: /* Implementation is still a stub, or the code wasn't set */
79 is_valid = response->message == NULL;
80 break;
81 case 500: /* Internal Server Error */
82 case 501: /* Not Implemented */
83 is_valid = 1;
84 break;
85 default:
86 if (200 <= code && code <= 299) {
87 is_valid = ast_ari_validate_list(response->message,
89 } else {
90 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints\n", code);
91 is_valid = 0;
92 }
93 }
94
95 if (!is_valid) {
96 ast_log(LOG_ERROR, "Response validation failed for /endpoints\n");
97 ast_ari_response_error(response, 500,
98 "Internal Server Error", "Response validation failed");
99 }
100#endif /* AST_DEVMODE */
101
102fin: __attribute__((unused))
103 return;
104}
106 struct ast_json *body,
108{
109 struct ast_json *field;
110 /* Parse query parameters out of it */
111 field = ast_json_object_get(body, "to");
112 if (field) {
113 args->to = ast_json_string_get(field);
114 }
115 field = ast_json_object_get(body, "from");
116 if (field) {
117 args->from = ast_json_string_get(field);
118 }
119 field = ast_json_object_get(body, "body");
120 if (field) {
121 args->body = ast_json_string_get(field);
122 }
123 return 0;
124}
125
126/*!
127 * \brief Parameter parsing callback for /endpoints/sendMessage.
128 * \param ser TCP/TLS session object
129 * \param get_params GET parameters in the HTTP request.
130 * \param path_vars Path variables extracted from the request.
131 * \param headers HTTP headers.
132 * \param body
133 * \param[out] response Response to the HTTP request.
134 */
136 struct ast_tcptls_session_instance *ser,
137 struct ast_variable *get_params, struct ast_variable *path_vars,
138 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
139{
141 struct ast_variable *i;
142#if defined(AST_DEVMODE)
143 int is_valid;
144 int code;
145#endif /* AST_DEVMODE */
146
147 for (i = get_params; i; i = i->next) {
148 if (strcmp(i->name, "to") == 0) {
149 args.to = (i->value);
150 } else
151 if (strcmp(i->name, "from") == 0) {
152 args.from = (i->value);
153 } else
154 if (strcmp(i->name, "body") == 0) {
155 args.body = (i->value);
156 } else
157 {}
158 }
159 args.variables = body;
160 ast_ari_endpoints_send_message(headers, &args, response);
161#if defined(AST_DEVMODE)
162 code = response->response_code;
163
164 switch (code) {
165 case 0: /* Implementation is still a stub, or the code wasn't set */
166 is_valid = response->message == NULL;
167 break;
168 case 500: /* Internal Server Error */
169 case 501: /* Not Implemented */
170 case 400: /* Invalid parameters for sending a message. */
171 case 404: /* Endpoint not found */
172 is_valid = 1;
173 break;
174 default:
175 if (200 <= code && code <= 299) {
176 is_valid = ast_ari_validate_void(
177 response->message);
178 } else {
179 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/sendMessage\n", code);
180 is_valid = 0;
181 }
182 }
183
184 if (!is_valid) {
185 ast_log(LOG_ERROR, "Response validation failed for /endpoints/sendMessage\n");
186 ast_ari_response_error(response, 500,
187 "Internal Server Error", "Response validation failed");
188 }
189#endif /* AST_DEVMODE */
190
191fin: __attribute__((unused))
192 return;
193}
195 struct ast_json *body,
197{
198 struct ast_json *field;
199 /* Parse query parameters out of it */
200 field = ast_json_object_get(body, "to");
201 if (field) {
202 args->to = ast_json_string_get(field);
203 }
204 field = ast_json_object_get(body, "from");
205 if (field) {
206 args->from = ast_json_string_get(field);
207 }
208 field = ast_json_object_get(body, "refer_to");
209 if (field) {
210 args->refer_to = ast_json_string_get(field);
211 }
212 field = ast_json_object_get(body, "to_self");
213 if (field) {
214 args->to_self = ast_json_is_true(field);
215 }
216 return 0;
217}
218
219/*!
220 * \brief Parameter parsing callback for /endpoints/refer.
221 * \param ser TCP/TLS session object
222 * \param get_params GET parameters in the HTTP request.
223 * \param path_vars Path variables extracted from the request.
224 * \param headers HTTP headers.
225 * \param body
226 * \param[out] response Response to the HTTP request.
227 */
229 struct ast_tcptls_session_instance *ser,
230 struct ast_variable *get_params, struct ast_variable *path_vars,
231 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
232{
234 struct ast_variable *i;
235#if defined(AST_DEVMODE)
236 int is_valid;
237 int code;
238#endif /* AST_DEVMODE */
239
240 for (i = get_params; i; i = i->next) {
241 if (strcmp(i->name, "to") == 0) {
242 args.to = (i->value);
243 } else
244 if (strcmp(i->name, "from") == 0) {
245 args.from = (i->value);
246 } else
247 if (strcmp(i->name, "refer_to") == 0) {
248 args.refer_to = (i->value);
249 } else
250 if (strcmp(i->name, "to_self") == 0) {
251 args.to_self = ast_true(i->value);
252 } else
253 {}
254 }
255 args.variables = body;
256 ast_ari_endpoints_refer(headers, &args, response);
257#if defined(AST_DEVMODE)
258 code = response->response_code;
259
260 switch (code) {
261 case 0: /* Implementation is still a stub, or the code wasn't set */
262 is_valid = response->message == NULL;
263 break;
264 case 500: /* Internal Server Error */
265 case 501: /* Not Implemented */
266 case 400: /* Invalid parameters for referring. */
267 case 404: /* Endpoint not found */
268 is_valid = 1;
269 break;
270 default:
271 if (200 <= code && code <= 299) {
272 is_valid = ast_ari_validate_void(
273 response->message);
274 } else {
275 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/refer\n", code);
276 is_valid = 0;
277 }
278 }
279
280 if (!is_valid) {
281 ast_log(LOG_ERROR, "Response validation failed for /endpoints/refer\n");
282 ast_ari_response_error(response, 500,
283 "Internal Server Error", "Response validation failed");
284 }
285#endif /* AST_DEVMODE */
286
287fin: __attribute__((unused))
288 return;
289}
290/*!
291 * \brief Parameter parsing callback for /endpoints/{tech}.
292 * \param ser TCP/TLS session object
293 * \param get_params GET parameters in the HTTP request.
294 * \param path_vars Path variables extracted from the request.
295 * \param headers HTTP headers.
296 * \param body
297 * \param[out] response Response to the HTTP request.
298 */
300 struct ast_tcptls_session_instance *ser,
301 struct ast_variable *get_params, struct ast_variable *path_vars,
302 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
303{
305 struct ast_variable *i;
306#if defined(AST_DEVMODE)
307 int is_valid;
308 int code;
309#endif /* AST_DEVMODE */
310
311 for (i = path_vars; i; i = i->next) {
312 if (strcmp(i->name, "tech") == 0) {
313 args.tech = (i->value);
314 } else
315 {}
316 }
317 ast_ari_endpoints_list_by_tech(headers, &args, response);
318#if defined(AST_DEVMODE)
319 code = response->response_code;
320
321 switch (code) {
322 case 0: /* Implementation is still a stub, or the code wasn't set */
323 is_valid = response->message == NULL;
324 break;
325 case 500: /* Internal Server Error */
326 case 501: /* Not Implemented */
327 case 404: /* Endpoints not found */
328 is_valid = 1;
329 break;
330 default:
331 if (200 <= code && code <= 299) {
332 is_valid = ast_ari_validate_list(response->message,
334 } else {
335 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}\n", code);
336 is_valid = 0;
337 }
338 }
339
340 if (!is_valid) {
341 ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}\n");
342 ast_ari_response_error(response, 500,
343 "Internal Server Error", "Response validation failed");
344 }
345#endif /* AST_DEVMODE */
346
347fin: __attribute__((unused))
348 return;
349}
350/*!
351 * \brief Parameter parsing callback for /endpoints/{tech}/{resource}.
352 * \param ser TCP/TLS session object
353 * \param get_params GET parameters in the HTTP request.
354 * \param path_vars Path variables extracted from the request.
355 * \param headers HTTP headers.
356 * \param body
357 * \param[out] response Response to the HTTP request.
358 */
360 struct ast_tcptls_session_instance *ser,
361 struct ast_variable *get_params, struct ast_variable *path_vars,
362 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
363{
365 struct ast_variable *i;
366#if defined(AST_DEVMODE)
367 int is_valid;
368 int code;
369#endif /* AST_DEVMODE */
370
371 for (i = path_vars; i; i = i->next) {
372 if (strcmp(i->name, "tech") == 0) {
373 args.tech = (i->value);
374 } else
375 if (strcmp(i->name, "resource") == 0) {
376 args.resource = (i->value);
377 } else
378 {}
379 }
380 ast_ari_endpoints_get(headers, &args, response);
381#if defined(AST_DEVMODE)
382 code = response->response_code;
383
384 switch (code) {
385 case 0: /* Implementation is still a stub, or the code wasn't set */
386 is_valid = response->message == NULL;
387 break;
388 case 500: /* Internal Server Error */
389 case 501: /* Not Implemented */
390 case 400: /* Invalid parameters for sending a message. */
391 case 404: /* Endpoints not found */
392 is_valid = 1;
393 break;
394 default:
395 if (200 <= code && code <= 299) {
396 is_valid = ast_ari_validate_endpoint(
397 response->message);
398 } else {
399 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}/{resource}\n", code);
400 is_valid = 0;
401 }
402 }
403
404 if (!is_valid) {
405 ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}/{resource}\n");
406 ast_ari_response_error(response, 500,
407 "Internal Server Error", "Response validation failed");
408 }
409#endif /* AST_DEVMODE */
410
411fin: __attribute__((unused))
412 return;
413}
415 struct ast_json *body,
417{
418 struct ast_json *field;
419 /* Parse query parameters out of it */
420 field = ast_json_object_get(body, "from");
421 if (field) {
422 args->from = ast_json_string_get(field);
423 }
424 field = ast_json_object_get(body, "body");
425 if (field) {
426 args->body = ast_json_string_get(field);
427 }
428 return 0;
429}
430
431/*!
432 * \brief Parameter parsing callback for /endpoints/{tech}/{resource}/sendMessage.
433 * \param ser TCP/TLS session object
434 * \param get_params GET parameters in the HTTP request.
435 * \param path_vars Path variables extracted from the request.
436 * \param headers HTTP headers.
437 * \param body
438 * \param[out] response Response to the HTTP request.
439 */
441 struct ast_tcptls_session_instance *ser,
442 struct ast_variable *get_params, struct ast_variable *path_vars,
443 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
444{
446 struct ast_variable *i;
447#if defined(AST_DEVMODE)
448 int is_valid;
449 int code;
450#endif /* AST_DEVMODE */
451
452 for (i = get_params; i; i = i->next) {
453 if (strcmp(i->name, "from") == 0) {
454 args.from = (i->value);
455 } else
456 if (strcmp(i->name, "body") == 0) {
457 args.body = (i->value);
458 } else
459 {}
460 }
461 for (i = path_vars; i; i = i->next) {
462 if (strcmp(i->name, "tech") == 0) {
463 args.tech = (i->value);
464 } else
465 if (strcmp(i->name, "resource") == 0) {
466 args.resource = (i->value);
467 } else
468 {}
469 }
470 args.variables = body;
472#if defined(AST_DEVMODE)
473 code = response->response_code;
474
475 switch (code) {
476 case 0: /* Implementation is still a stub, or the code wasn't set */
477 is_valid = response->message == NULL;
478 break;
479 case 500: /* Internal Server Error */
480 case 501: /* Not Implemented */
481 case 400: /* Invalid parameters for sending a message. */
482 case 404: /* Endpoint not found */
483 is_valid = 1;
484 break;
485 default:
486 if (200 <= code && code <= 299) {
487 is_valid = ast_ari_validate_void(
488 response->message);
489 } else {
490 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}/{resource}/sendMessage\n", code);
491 is_valid = 0;
492 }
493 }
494
495 if (!is_valid) {
496 ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}/{resource}/sendMessage\n");
497 ast_ari_response_error(response, 500,
498 "Internal Server Error", "Response validation failed");
499 }
500#endif /* AST_DEVMODE */
501
502fin: __attribute__((unused))
503 return;
504}
506 struct ast_json *body,
508{
509 struct ast_json *field;
510 /* Parse query parameters out of it */
511 field = ast_json_object_get(body, "from");
512 if (field) {
513 args->from = ast_json_string_get(field);
514 }
515 field = ast_json_object_get(body, "refer_to");
516 if (field) {
517 args->refer_to = ast_json_string_get(field);
518 }
519 field = ast_json_object_get(body, "to_self");
520 if (field) {
521 args->to_self = ast_json_is_true(field);
522 }
523 return 0;
524}
525
526/*!
527 * \brief Parameter parsing callback for /endpoints/{tech}/{resource}/refer.
528 * \param ser TCP/TLS session object
529 * \param get_params GET parameters in the HTTP request.
530 * \param path_vars Path variables extracted from the request.
531 * \param headers HTTP headers.
532 * \param body
533 * \param[out] response Response to the HTTP request.
534 */
536 struct ast_tcptls_session_instance *ser,
537 struct ast_variable *get_params, struct ast_variable *path_vars,
538 struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
539{
541 struct ast_variable *i;
542#if defined(AST_DEVMODE)
543 int is_valid;
544 int code;
545#endif /* AST_DEVMODE */
546
547 for (i = get_params; i; i = i->next) {
548 if (strcmp(i->name, "from") == 0) {
549 args.from = (i->value);
550 } else
551 if (strcmp(i->name, "refer_to") == 0) {
552 args.refer_to = (i->value);
553 } else
554 if (strcmp(i->name, "to_self") == 0) {
555 args.to_self = ast_true(i->value);
556 } else
557 {}
558 }
559 for (i = path_vars; i; i = i->next) {
560 if (strcmp(i->name, "tech") == 0) {
561 args.tech = (i->value);
562 } else
563 if (strcmp(i->name, "resource") == 0) {
564 args.resource = (i->value);
565 } else
566 {}
567 }
568 args.variables = body;
569 ast_ari_endpoints_refer_to_endpoint(headers, &args, response);
570#if defined(AST_DEVMODE)
571 code = response->response_code;
572
573 switch (code) {
574 case 0: /* Implementation is still a stub, or the code wasn't set */
575 is_valid = response->message == NULL;
576 break;
577 case 500: /* Internal Server Error */
578 case 501: /* Not Implemented */
579 case 400: /* Invalid parameters for referring. */
580 case 404: /* Endpoint not found */
581 is_valid = 1;
582 break;
583 default:
584 if (200 <= code && code <= 299) {
585 is_valid = ast_ari_validate_void(
586 response->message);
587 } else {
588 ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}/{resource}/refer\n", code);
589 is_valid = 0;
590 }
591 }
592
593 if (!is_valid) {
594 ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}/{resource}/refer\n");
595 ast_ari_response_error(response, 500,
596 "Internal Server Error", "Response validation failed");
597 }
598#endif /* AST_DEVMODE */
599
600fin: __attribute__((unused))
601 return;
602}
603
604/*! \brief REST handler for /api-docs/endpoints.json */
606 .path_segment = "sendMessage",
607 .callbacks = {
609 },
610 .num_children = 0,
611 .children = { }
612};
613/*! \brief REST handler for /api-docs/endpoints.json */
615 .path_segment = "refer",
616 .callbacks = {
618 },
619 .num_children = 0,
620 .children = { }
621};
622/*! \brief REST handler for /api-docs/endpoints.json */
624 .path_segment = "sendMessage",
625 .callbacks = {
627 },
628 .num_children = 0,
629 .children = { }
630};
631/*! \brief REST handler for /api-docs/endpoints.json */
633 .path_segment = "refer",
634 .callbacks = {
636 },
637 .num_children = 0,
638 .children = { }
639};
640/*! \brief REST handler for /api-docs/endpoints.json */
642 .path_segment = "resource",
643 .is_wildcard = 1,
644 .callbacks = {
646 },
647 .num_children = 2,
649};
650/*! \brief REST handler for /api-docs/endpoints.json */
652 .path_segment = "tech",
653 .is_wildcard = 1,
654 .callbacks = {
656 },
657 .num_children = 1,
658 .children = { &endpoints_tech_resource, }
659};
660/*! \brief REST handler for /api-docs/endpoints.json */
662 .path_segment = "endpoints",
663 .callbacks = {
665 },
666 .num_children = 3,
668};
669
670static int unload_module(void)
671{
673 return 0;
674}
675
676static int load_module(void)
677{
678 int res = 0;
679
680
682 if (res) {
685 }
686
688}
689
690AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Endpoint resources",
691 .support_level = AST_MODULE_SUPPORT_CORE,
692 .load = load_module,
693 .unload = unload_module,
694 .requires = "res_ari,res_ari_model,res_stasis",
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
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:179
int ast_ari_validate_endpoint(struct ast_json *json)
Validator for Endpoint.
ari_validator ast_ari_validate_endpoint_fn(void)
Function pointer to ast_ari_validate_endpoint().
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_log
Definition: astobj2.c:42
@ AST_HTTP_PUT
Definition: http.h:63
@ 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 LOG_ERROR
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:283
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:407
int ast_json_is_true(const struct ast_json *value)
Check if value is JSON true.
Definition: json.c:263
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
int ast_ari_endpoints_send_message_parse_body(struct ast_json *body, struct ast_ari_endpoints_send_message_args *args)
Body parsing function for /endpoints/sendMessage.
static struct stasis_rest_handlers endpoints_tech_resource_refer
REST handler for /api-docs/endpoints.json.
int ast_ari_endpoints_refer_to_endpoint_parse_body(struct ast_json *body, struct ast_ari_endpoints_refer_to_endpoint_args *args)
Body parsing function for /endpoints/{tech}/{resource}/refer.
static void ast_ari_endpoints_list_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints.
static struct stasis_rest_handlers endpoints_tech_resource_sendMessage
REST handler for /api-docs/endpoints.json.
static void ast_ari_endpoints_refer_to_endpoint_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/{tech}/{resource}/refer.
static void ast_ari_endpoints_refer_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/refer.
int ast_ari_endpoints_send_message_to_endpoint_parse_body(struct ast_json *body, struct ast_ari_endpoints_send_message_to_endpoint_args *args)
Body parsing function for /endpoints/{tech}/{resource}/sendMessage.
static void ast_ari_endpoints_list_by_tech_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/{tech}.
static struct stasis_rest_handlers endpoints_sendMessage
REST handler for /api-docs/endpoints.json.
static struct stasis_rest_handlers endpoints
REST handler for /api-docs/endpoints.json.
static void ast_ari_endpoints_get_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/{tech}/{resource}.
static void ast_ari_endpoints_send_message_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/sendMessage.
int ast_ari_endpoints_refer_parse_body(struct ast_json *body, struct ast_ari_endpoints_refer_args *args)
Body parsing function for /endpoints/refer.
static struct stasis_rest_handlers endpoints_refer
REST handler for /api-docs/endpoints.json.
static struct stasis_rest_handlers endpoints_tech
REST handler for /api-docs/endpoints.json.
static int load_module(void)
static int unload_module(void)
static void ast_ari_endpoints_send_message_to_endpoint_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /endpoints/{tech}/{resource}/sendMessage.
static struct stasis_rest_handlers endpoints_tech_resource
REST handler for /api-docs/endpoints.json.
#define NULL
Definition: resample.c:96
void ast_ari_endpoints_refer(struct ast_variable *headers, struct ast_ari_endpoints_refer_args *args, struct ast_ari_response *response)
Refer an endpoint or technology URI to some technology URI or endpoint.
void ast_ari_endpoints_send_message(struct ast_variable *headers, struct ast_ari_endpoints_send_message_args *args, struct ast_ari_response *response)
Send a message to some technology URI or endpoint.
void ast_ari_endpoints_list_by_tech(struct ast_variable *headers, struct ast_ari_endpoints_list_by_tech_args *args, struct ast_ari_response *response)
List available endoints for a given endpoint technology.
void ast_ari_endpoints_send_message_to_endpoint(struct ast_variable *headers, struct ast_ari_endpoints_send_message_to_endpoint_args *args, struct ast_ari_response *response)
Send a message to some endpoint in a technology.
void ast_ari_endpoints_refer_to_endpoint(struct ast_variable *headers, struct ast_ari_endpoints_refer_to_endpoint_args *args, struct ast_ari_response *response)
Refer an endpoint or technology URI to some technology URI or endpoint.
void ast_ari_endpoints_get(struct ast_variable *headers, struct ast_ari_endpoints_get_args *args, struct ast_ari_response *response)
Details for an endpoint.
void ast_ari_endpoints_list(struct ast_variable *headers, struct ast_ari_endpoints_list_args *args, struct ast_ari_response *response)
List all endpoints.
Generated file - declares stubs to be implemented in res/ari/resource_endpoints.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