Asterisk - The Open Source Telephony Project GIT-master-f36a736
Macros | Functions | Variables
res_ari_channels.c File Reference

Channel resources. More...

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

Go to the source code of this file.

Macros

#define MAX_VALS   128
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
static void ast_ari_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. More...
 
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. More...
 
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. More...
 
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. More...
 
int ast_ari_channels_create_parse_body (struct ast_json *body, struct ast_ari_channels_create_args *args)
 Body parsing function for /channels/create. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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}. More...
 
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. More...
 
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. More...
 
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}. More...
 
int ast_ari_channels_hangup_parse_body (struct ast_json *body, struct ast_ari_channels_hangup_args *args)
 Body parsing function for /channels/{channelId}. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int ast_ari_channels_originate_parse_body (struct ast_json *body, struct ast_ari_channels_originate_args *args)
 Body parsing function for /channels. More...
 
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}. More...
 
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}. More...
 
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. More...
 
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. More...
 
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}. More...
 
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}. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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}. More...
 
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}. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Channel resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_answer,res_stasis_playback,res_stasis_recording,res_stasis_snoop", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct stasis_rest_handlers channels
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_answer
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_continue
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_dial
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_dtmf
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_hold
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_moh
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_move
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_mute
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_play
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_play_playbackId
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_record
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_redirect
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_ring
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_rtp_statistics
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_silence
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_snoop
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_snoop_snoopId
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_channelId_variable
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_create
 REST handler for /api-docs/channels.json. More...
 
static struct stasis_rest_handlers channels_externalMedia
 REST handler for /api-docs/channels.json. More...
 

Detailed Description

Channel resources.

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

Definition in file res_ari_channels.c.

Macro Definition Documentation

◆ MAX_VALS

#define MAX_VALS   128

Definition at line 55 of file res_ari_channels.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 3242 of file res_ari_channels.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 3242 of file res_ari_channels.c.

◆ ast_ari_channels_answer_cb()

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

Parameter parsing callback for /channels/{channelId}/answer.

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

Definition at line 986 of file res_ari_channels.c.

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}
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_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
#define NULL
Definition: resample.c:96
void ast_ari_channels_answer(struct ast_variable *headers, struct ast_ari_channels_answer_args *args, struct ast_ari_response *response)
Answer a channel.
struct ast_json * message
Definition: ari.h:94
int response_code
Definition: ari.h:99
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
const char * args

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

◆ ast_ari_channels_continue_in_dialplan_cb()

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

Parameter parsing callback for /channels/{channelId}/continue.

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

Definition at line 727 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_continue_in_dialplan_parse_body()

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.

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

Definition at line 693 of file res_ari_channels.c.

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}
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
Abstract JSON element (object, array, string, int, ...).

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

Referenced by ast_ari_channels_continue_in_dialplan_cb().

◆ ast_ari_channels_create_cb()

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

Parameter parsing callback for /channels/create.

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

Definition at line 314 of file res_ari_channels.c.

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}
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
void ast_ari_channels_create(struct ast_variable *headers, struct ast_ari_channels_create_args *args, struct ast_ari_response *response)
Create channel.

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

◆ ast_ari_channels_create_parse_body()

int ast_ari_channels_create_parse_body ( struct ast_json body,
struct ast_ari_channels_create_args args 
)

Body parsing function for /channels/create.

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

Definition at line 268 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_create().

◆ ast_ari_channels_dial_cb()

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

Parameter parsing callback for /channels/{channelId}/dial.

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

Definition at line 2749 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_dial_parse_body()

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.

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

Definition at line 2723 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_dial_cb().

◆ ast_ari_channels_external_media_cb()

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

Parameter parsing callback for /channels/externalMedia.

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

Definition at line 2928 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_external_media_parse_body()

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.

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

Definition at line 2874 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_external_media().

◆ ast_ari_channels_get_cb()

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

Parameter parsing callback for /channels/{channelId}.

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

Definition at line 393 of file res_ari_channels.c.

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}
void ast_ari_channels_get(struct ast_variable *headers, struct ast_ari_channels_get_args *args, struct ast_ari_response *response)
Channel details.

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

◆ ast_ari_channels_get_channel_var_cb()

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

Parameter parsing callback for /channels/{channelId}/variable.

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

Definition at line 2348 of file res_ari_channels.c.

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}
int ast_ari_validate_variable(struct ast_json *json)
Validator for Variable.
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.
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.

References args, ast_ari_channels_get_channel_var(), ast_ari_channels_get_channel_var_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_variable(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_channels_get_channel_var_parse_body()

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.

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

Definition at line 2326 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_get_channel_var_cb().

◆ ast_ari_channels_hangup_cb()

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

Parameter parsing callback for /channels/{channelId}.

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

Definition at line 628 of file res_ari_channels.c.

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}
int ast_ari_channels_hangup_parse_body(struct ast_json *body, struct ast_ari_channels_hangup_args *args)
Body parsing function for /channels/{channelId}.
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.

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

◆ ast_ari_channels_hangup_parse_body()

int ast_ari_channels_hangup_parse_body ( struct ast_json body,
struct ast_ari_channels_hangup_args args 
)

Body parsing function for /channels/{channelId}.

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

Definition at line 602 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_hangup_cb().

◆ ast_ari_channels_hold_cb()

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

Parameter parsing callback for /channels/{channelId}/hold.

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

Definition at line 1456 of file res_ari_channels.c.

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}
void ast_ari_channels_hold(struct ast_variable *headers, struct ast_ari_channels_hold_args *args, struct ast_ari_response *response)
Hold a channel.

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

◆ ast_ari_channels_list_cb()

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

Parameter parsing callback for /channels.

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

Definition at line 66 of file res_ari_channels.c.

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}
ari_validator ast_ari_validate_channel_fn(void)
Function pointer to ast_ari_validate_channel().
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
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.

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

◆ ast_ari_channels_move_cb()

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

Parameter parsing callback for /channels/{channelId}/move.

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

Definition at line 825 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_move_parse_body()

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.

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

Definition at line 799 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_move_cb().

◆ ast_ari_channels_mute_cb()

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

Parameter parsing callback for /channels/{channelId}/mute.

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

Definition at line 1299 of file res_ari_channels.c.

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}
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.
void ast_ari_channels_mute(struct ast_variable *headers, struct ast_ari_channels_mute_args *args, struct ast_ari_response *response)
Mute a channel.

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

◆ ast_ari_channels_mute_parse_body()

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.

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

Definition at line 1277 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_mute_cb().

◆ ast_ari_channels_originate_cb()

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

Parameter parsing callback for /channels.

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

Definition at line 179 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_originate_parse_body()

int ast_ari_channels_originate_parse_body ( struct ast_json body,
struct ast_ari_channels_originate_args args 
)

Body parsing function for /channels.

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

Definition at line 109 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_originate().

◆ ast_ari_channels_originate_with_id_cb()

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

Parameter parsing callback for /channels/{channelId}.

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

Definition at line 510 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_originate_with_id_parse_body()

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

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

Definition at line 444 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_originate_with_id().

◆ ast_ari_channels_play_cb()

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

Parameter parsing callback for /channels/{channelId}/play.

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

Definition at line 1905 of file res_ari_channels.c.

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}
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
#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_app_separate_args(a, b, c, d)
#define MAX_VALS
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.
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.
#define ARRAY_LEN(a)
Definition: utils.h:666

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

◆ ast_ari_channels_play_parse_body()

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.

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

Definition at line 1842 of file res_ari_channels.c.

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}
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
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Definition: json.c:366

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

Referenced by ast_ari_channels_play_cb().

◆ ast_ari_channels_play_with_id_cb()

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

Parameter parsing callback for /channels/{channelId}/play/{playbackId}.

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

Definition at line 2081 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_play_with_id_parse_body()

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

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

Definition at line 2022 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_play_with_id_cb().

◆ ast_ari_channels_record_cb()

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

Parameter parsing callback for /channels/{channelId}/record.

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

Definition at line 2244 of file res_ari_channels.c.

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}
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.
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.
void ast_ari_channels_record(struct ast_variable *headers, struct ast_ari_channels_record_args *args, struct ast_ari_response *response)
Start a recording.
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

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

◆ ast_ari_channels_record_parse_body()

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.

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

Definition at line 2198 of file res_ari_channels.c.

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}
int ast_json_is_true(const struct ast_json *value)
Check if value is JSON true.
Definition: json.c:263

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

Referenced by ast_ari_channels_record_cb().

◆ ast_ari_channels_redirect_cb()

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

Parameter parsing callback for /channels/{channelId}/redirect.

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

Definition at line 912 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_redirect_parse_body()

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.

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

Definition at line 890 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_redirect_cb().

◆ ast_ari_channels_ring_cb()

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

Parameter parsing callback for /channels/{channelId}/ring.

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

Definition at line 1048 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_ring_stop_cb()

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

Parameter parsing callback for /channels/{channelId}/ring.

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

Definition at line 1110 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_rtpstatistics_cb()

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

Parameter parsing callback for /channels/{channelId}/rtp_statistics.

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

Definition at line 2823 of file res_ari_channels.c.

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}
int ast_ari_validate_rtpstat(struct ast_json *json)
Validator for RTPstat.
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.

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

◆ ast_ari_channels_send_dtmf_cb()

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

Parameter parsing callback for /channels/{channelId}/dtmf.

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

Definition at line 1201 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_send_dtmf_parse_body()

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.

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

Definition at line 1163 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_send_dtmf_cb().

◆ ast_ari_channels_set_channel_var_cb()

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

Parameter parsing callback for /channels/{channelId}/variable.

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

Definition at line 2437 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_set_channel_var_parse_body()

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.

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

Definition at line 2411 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_set_channel_var_cb().

◆ ast_ari_channels_snoop_channel_cb()

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

Parameter parsing callback for /channels/{channelId}/snoop.

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

Definition at line 2541 of file res_ari_channels.c.

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

References args, ast_ari_channels_snoop_channel(), ast_ari_channels_snoop_channel_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_channel(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_channels_snoop_channel_parse_body()

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.

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

Definition at line 2503 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_snoop_channel_cb().

◆ ast_ari_channels_snoop_channel_with_id_cb()

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

Parameter parsing callback for /channels/{channelId}/snoop/{snoopId}.

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

Definition at line 2649 of file res_ari_channels.c.

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

References args, ast_ari_channels_snoop_channel_with_id(), ast_ari_channels_snoop_channel_with_id_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_channel(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_channels_snoop_channel_with_id_parse_body()

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

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

Definition at line 2615 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_snoop_channel_with_id_cb().

◆ ast_ari_channels_start_moh_cb()

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

Parameter parsing callback for /channels/{channelId}/moh.

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

Definition at line 1593 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_start_moh_parse_body()

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.

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

Definition at line 1571 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_start_moh_cb().

◆ ast_ari_channels_start_silence_cb()

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

Parameter parsing callback for /channels/{channelId}/silence.

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

Definition at line 1727 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_stop_moh_cb()

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

Parameter parsing callback for /channels/{channelId}/moh.

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

Definition at line 1665 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_stop_silence_cb()

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

Parameter parsing callback for /channels/{channelId}/silence.

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

Definition at line 1789 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_unhold_cb()

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

Parameter parsing callback for /channels/{channelId}/hold.

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

Definition at line 1518 of file res_ari_channels.c.

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

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

◆ ast_ari_channels_unmute_cb()

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

Parameter parsing callback for /channels/{channelId}/mute.

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

Definition at line 1384 of file res_ari_channels.c.

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}
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.
void ast_ari_channels_unmute(struct ast_variable *headers, struct ast_ari_channels_unmute_args *args, struct ast_ari_response *response)
Unmute a channel.

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

◆ ast_ari_channels_unmute_parse_body()

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.

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

Definition at line 1362 of file res_ari_channels.c.

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}

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

Referenced by ast_ari_channels_unmute_cb().

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 3242 of file res_ari_channels.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 3223 of file res_ari_channels.c.

3224{
3225 int res = 0;
3226
3227
3229 if (res) {
3230 unload_module();
3232 }
3233
3235}
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:179
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
static int unload_module(void)
static struct stasis_rest_handlers channels
REST handler for /api-docs/channels.json.

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

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 3217 of file res_ari_channels.c.

3218{
3220 return 0;
3221}
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:202

References ast_ari_remove_handler(), and channels.

Referenced by load_module().

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Channel resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_answer,res_stasis_playback,res_stasis_recording,res_stasis_snoop", }
static

Definition at line 3242 of file res_ari_channels.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 3242 of file res_ari_channels.c.

◆ channels

struct stasis_rest_handlers channels
static

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

Definition at line 3207 of file res_ari_channels.c.

Referenced by load_module(), and unload_module().

◆ channels_channelId

struct stasis_rest_handlers channels_channelId
static

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

Definition at line 3186 of file res_ari_channels.c.

◆ channels_channelId_answer

struct stasis_rest_handlers channels_channelId_answer
static

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

Definition at line 3043 of file res_ari_channels.c.

◆ channels_channelId_continue

struct stasis_rest_handlers channels_channelId_continue
static

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

Definition at line 3016 of file res_ari_channels.c.

◆ channels_channelId_dial

struct stasis_rest_handlers channels_channelId_dial
static

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

Definition at line 3168 of file res_ari_channels.c.

◆ channels_channelId_dtmf

struct stasis_rest_handlers channels_channelId_dtmf
static

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

Definition at line 3062 of file res_ari_channels.c.

◆ channels_channelId_hold

struct stasis_rest_handlers channels_channelId_hold
static

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

Definition at line 3081 of file res_ari_channels.c.

◆ channels_channelId_moh

struct stasis_rest_handlers channels_channelId_moh
static

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

Definition at line 3091 of file res_ari_channels.c.

◆ channels_channelId_move

struct stasis_rest_handlers channels_channelId_move
static

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

Definition at line 3025 of file res_ari_channels.c.

◆ channels_channelId_mute

struct stasis_rest_handlers channels_channelId_mute
static

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

Definition at line 3071 of file res_ari_channels.c.

◆ channels_channelId_play

struct stasis_rest_handlers channels_channelId_play
static

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

Definition at line 3121 of file res_ari_channels.c.

◆ channels_channelId_play_playbackId

struct stasis_rest_handlers channels_channelId_play_playbackId
static

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

Definition at line 3111 of file res_ari_channels.c.

◆ channels_channelId_record

struct stasis_rest_handlers channels_channelId_record
static

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

Definition at line 3130 of file res_ari_channels.c.

◆ channels_channelId_redirect

struct stasis_rest_handlers channels_channelId_redirect
static

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

Definition at line 3034 of file res_ari_channels.c.

◆ channels_channelId_ring

struct stasis_rest_handlers channels_channelId_ring
static

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

Definition at line 3052 of file res_ari_channels.c.

◆ channels_channelId_rtp_statistics

struct stasis_rest_handlers channels_channelId_rtp_statistics
static

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

Definition at line 3177 of file res_ari_channels.c.

◆ channels_channelId_silence

struct stasis_rest_handlers channels_channelId_silence
static

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

Definition at line 3101 of file res_ari_channels.c.

◆ channels_channelId_snoop

struct stasis_rest_handlers channels_channelId_snoop
static

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

Definition at line 3159 of file res_ari_channels.c.

◆ channels_channelId_snoop_snoopId

struct stasis_rest_handlers channels_channelId_snoop_snoopId
static

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

Definition at line 3149 of file res_ari_channels.c.

◆ channels_channelId_variable

struct stasis_rest_handlers channels_channelId_variable
static

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

Definition at line 3139 of file res_ari_channels.c.

◆ channels_create

struct stasis_rest_handlers channels_create
static

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

Definition at line 3007 of file res_ari_channels.c.

◆ channels_externalMedia

struct stasis_rest_handlers channels_externalMedia
static

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

Definition at line 3198 of file res_ari_channels.c.