Asterisk - The Open Source Telephony Project GIT-master-6144b6b
Loading...
Searching...
No Matches
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.
 
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.
 
int ast_ari_channels_continue_in_dialplan_parse_body (struct ast_json *body, struct ast_ari_channels_continue_in_dialplan_args *args)
 Body parsing function for /channels/{channelId}/continue.
 
static void ast_ari_channels_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.
 
int ast_ari_channels_create_parse_body (struct ast_json *body, struct ast_ari_channels_create_args *args)
 Body parsing function for /channels/create.
 
static void ast_ari_channels_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.
 
int ast_ari_channels_dial_parse_body (struct ast_json *body, struct ast_ari_channels_dial_args *args)
 Body parsing function for /channels/{channelId}/dial.
 
static void ast_ari_channels_external_media_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/externalMedia.
 
int ast_ari_channels_external_media_parse_body (struct ast_json *body, struct ast_ari_channels_external_media_args *args)
 Body parsing function for /channels/externalMedia.
 
static void ast_ari_channels_get_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}.
 
static void ast_ari_channels_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.
 
int ast_ari_channels_get_channel_var_parse_body (struct ast_json *body, struct ast_ari_channels_get_channel_var_args *args)
 Body parsing function for /channels/{channelId}/variable.
 
static void ast_ari_channels_get_channel_vars_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}/variables.
 
int ast_ari_channels_get_channel_vars_parse_body (struct ast_json *body, struct ast_ari_channels_get_channel_vars_args *args)
 Body parsing function for /channels/{channelId}/variables.
 
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}.
 
int ast_ari_channels_hangup_parse_body (struct ast_json *body, struct ast_ari_channels_hangup_args *args)
 Body parsing function for /channels/{channelId}.
 
static void ast_ari_channels_hold_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/hold.
 
static void ast_ari_channels_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.
 
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.
 
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.
 
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.
 
int ast_ari_channels_mute_parse_body (struct ast_json *body, struct ast_ari_channels_mute_args *args)
 Body parsing function for /channels/{channelId}/mute.
 
static void ast_ari_channels_originate_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels.
 
int ast_ari_channels_originate_parse_body (struct ast_json *body, struct ast_ari_channels_originate_args *args)
 Body parsing function for /channels.
 
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}.
 
int ast_ari_channels_originate_with_id_parse_body (struct ast_json *body, struct ast_ari_channels_originate_with_id_args *args)
 Body parsing function for /channels/{channelId}.
 
static void ast_ari_channels_play_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.
 
int ast_ari_channels_play_parse_body (struct ast_json *body, struct ast_ari_channels_play_args *args)
 Body parsing function for /channels/{channelId}/play.
 
static 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}.
 
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}.
 
static void ast_ari_channels_progress_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}/progress.
 
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.
 
int ast_ari_channels_record_parse_body (struct ast_json *body, struct ast_ari_channels_record_args *args)
 Body parsing function for /channels/{channelId}/record.
 
static void ast_ari_channels_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.
 
int ast_ari_channels_redirect_parse_body (struct ast_json *body, struct ast_ari_channels_redirect_args *args)
 Body parsing function for /channels/{channelId}/redirect.
 
static 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.
 
static void ast_ari_channels_ring_stop_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/ring.
 
static void ast_ari_channels_rtpstatistics_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/rtp_statistics.
 
static 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.
 
int ast_ari_channels_send_dtmf_parse_body (struct ast_json *body, struct ast_ari_channels_send_dtmf_args *args)
 Body parsing function for /channels/{channelId}/dtmf.
 
static void ast_ari_channels_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.
 
int ast_ari_channels_set_channel_var_parse_body (struct ast_json *body, struct ast_ari_channels_set_channel_var_args *args)
 Body parsing function for /channels/{channelId}/variable.
 
static void ast_ari_channels_set_channel_vars_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}/variables.
 
int ast_ari_channels_set_channel_vars_parse_body (struct ast_json *body, struct ast_ari_channels_set_channel_vars_args *args)
 Body parsing function for /channels/{channelId}/variables.
 
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.
 
int ast_ari_channels_snoop_channel_parse_body (struct ast_json *body, struct ast_ari_channels_snoop_channel_args *args)
 Body parsing function for /channels/{channelId}/snoop.
 
static 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}.
 
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}.
 
static void ast_ari_channels_start_moh_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/moh.
 
int ast_ari_channels_start_moh_parse_body (struct ast_json *body, struct ast_ari_channels_start_moh_args *args)
 Body parsing function for /channels/{channelId}/moh.
 
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.
 
static void ast_ari_channels_stop_moh_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/moh.
 
static void ast_ari_channels_stop_silence_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/silence.
 
static void ast_ari_channels_transfer_progress_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}/transfer_progress.
 
int ast_ari_channels_transfer_progress_parse_body (struct ast_json *body, struct ast_ari_channels_transfer_progress_args *args)
 Body parsing function for /channels/{channelId}/transfer_progress.
 
static void ast_ari_channels_unhold_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /channels/{channelId}/hold.
 
static void ast_ari_channels_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.
 
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.
 
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 = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_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.
 
static struct stasis_rest_handlers channels_channelId
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_answer
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_continue
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_dial
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_dtmf
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_hold
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_moh
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_move
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_mute
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_play
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_play_playbackId
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_progress
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_record
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_redirect
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_ring
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_rtp_statistics
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_silence
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_snoop
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_snoop_snoopId
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_transfer_progress
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_variable
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_channelId_variables
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_create
 REST handler for /api-docs/channels.json.
 
static struct stasis_rest_handlers channels_externalMedia
 REST handler for /api-docs/channels.json.
 

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 3655 of file res_ari_channels.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 3655 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:212
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
#define ast_log
Definition astobj2.c:42
#define LOG_ERROR
static struct @522 args
#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:103
int response_code
Definition ari.h:108
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next

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:251
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 3041 of file res_ari_channels.c.

3045{
3046 struct ast_ari_channels_dial_args args = {};
3047 struct ast_variable *i;
3048#if defined(AST_DEVMODE)
3049 int is_valid;
3050 int code;
3051#endif /* AST_DEVMODE */
3052
3053 for (i = get_params; i; i = i->next) {
3054 if (strcmp(i->name, "caller") == 0) {
3055 args.caller = (i->value);
3056 } else
3057 if (strcmp(i->name, "timeout") == 0) {
3058 args.timeout = atoi(i->value);
3059 } else
3060 {}
3061 }
3062 for (i = path_vars; i; i = i->next) {
3063 if (strcmp(i->name, "channelId") == 0) {
3064 args.channel_id = (i->value);
3065 } else
3066 {}
3067 }
3070 goto fin;
3071 }
3072 ast_ari_channels_dial(headers, &args, response);
3073#if defined(AST_DEVMODE)
3074 code = response->response_code;
3075
3076 switch (code) {
3077 case 0: /* Implementation is still a stub, or the code wasn't set */
3078 is_valid = response->message == NULL;
3079 break;
3080 case 500: /* Internal Server Error */
3081 case 501: /* Not Implemented */
3082 case 404: /* Channel cannot be found. */
3083 case 409: /* Channel cannot be dialed. */
3084 is_valid = 1;
3085 break;
3086 default:
3087 if (200 <= code && code <= 299) {
3088 is_valid = ast_ari_validate_void(
3089 response->message);
3090 } else {
3091 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/dial\n", code);
3092 is_valid = 0;
3093 }
3094 }
3095
3096 if (!is_valid) {
3097 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/dial\n");
3098 ast_ari_response_error(response, 500,
3099 "Internal Server Error", "Response validation failed");
3100 }
3101#endif /* AST_DEVMODE */
3102
3103fin: __attribute__((unused))
3104 return;
3105}
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 3015 of file res_ari_channels.c.

3018{
3019 struct ast_json *field;
3020 /* Parse query parameters out of it */
3021 field = ast_json_object_get(body, "caller");
3022 if (field) {
3023 args->caller = ast_json_string_get(field);
3024 }
3025 field = ast_json_object_get(body, "timeout");
3026 if (field) {
3027 args->timeout = ast_json_integer_get(field);
3028 }
3029 return 0;
3030}

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 3224 of file res_ari_channels.c.

3228{
3230 struct ast_variable *i;
3231#if defined(AST_DEVMODE)
3232 int is_valid;
3233 int code;
3234#endif /* AST_DEVMODE */
3235
3236 for (i = get_params; i; i = i->next) {
3237 if (strcmp(i->name, "channelId") == 0) {
3238 args.channel_id = (i->value);
3239 } else
3240 if (strcmp(i->name, "app") == 0) {
3241 args.app = (i->value);
3242 } else
3243 if (strcmp(i->name, "external_host") == 0) {
3244 args.external_host = (i->value);
3245 } else
3246 if (strcmp(i->name, "encapsulation") == 0) {
3247 args.encapsulation = (i->value);
3248 } else
3249 if (strcmp(i->name, "transport") == 0) {
3250 args.transport = (i->value);
3251 } else
3252 if (strcmp(i->name, "connection_type") == 0) {
3253 args.connection_type = (i->value);
3254 } else
3255 if (strcmp(i->name, "format") == 0) {
3256 args.format = (i->value);
3257 } else
3258 if (strcmp(i->name, "direction") == 0) {
3259 args.direction = (i->value);
3260 } else
3261 if (strcmp(i->name, "data") == 0) {
3262 args.data = (i->value);
3263 } else
3264 if (strcmp(i->name, "transport_data") == 0) {
3265 args.transport_data = (i->value);
3266 } else
3267 {}
3268 }
3269 args.variables = body;
3270 ast_ari_channels_external_media(headers, &args, response);
3271#if defined(AST_DEVMODE)
3272 code = response->response_code;
3273
3274 switch (code) {
3275 case 0: /* Implementation is still a stub, or the code wasn't set */
3276 is_valid = response->message == NULL;
3277 break;
3278 case 500: /* Internal Server Error */
3279 case 501: /* Not Implemented */
3280 case 400: /* Invalid parameters */
3281 case 409: /* Channel is not in a Stasis application; Channel is already bridged */
3282 is_valid = 1;
3283 break;
3284 default:
3285 if (200 <= code && code <= 299) {
3286 is_valid = ast_ari_validate_channel(
3287 response->message);
3288 } else {
3289 ast_log(LOG_ERROR, "Invalid error response %d for /channels/externalMedia\n", code);
3290 is_valid = 0;
3291 }
3292 }
3293
3294 if (!is_valid) {
3295 ast_log(LOG_ERROR, "Response validation failed for /channels/externalMedia\n");
3296 ast_ari_response_error(response, 500,
3297 "Internal Server Error", "Response validation failed");
3298 }
3299#endif /* AST_DEVMODE */
3300
3301fin: __attribute__((unused))
3302 return;
3303}
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 3166 of file res_ari_channels.c.

3169{
3170 struct ast_json *field;
3171 /* Parse query parameters out of it */
3172 field = ast_json_object_get(body, "channelId");
3173 if (field) {
3174 args->channel_id = ast_json_string_get(field);
3175 }
3176 field = ast_json_object_get(body, "app");
3177 if (field) {
3178 args->app = ast_json_string_get(field);
3179 }
3180 field = ast_json_object_get(body, "external_host");
3181 if (field) {
3182 args->external_host = ast_json_string_get(field);
3183 }
3184 field = ast_json_object_get(body, "encapsulation");
3185 if (field) {
3186 args->encapsulation = ast_json_string_get(field);
3187 }
3188 field = ast_json_object_get(body, "transport");
3189 if (field) {
3190 args->transport = ast_json_string_get(field);
3191 }
3192 field = ast_json_object_get(body, "connection_type");
3193 if (field) {
3194 args->connection_type = ast_json_string_get(field);
3195 }
3196 field = ast_json_object_get(body, "format");
3197 if (field) {
3198 args->format = ast_json_string_get(field);
3199 }
3200 field = ast_json_object_get(body, "direction");
3201 if (field) {
3202 args->direction = ast_json_string_get(field);
3203 }
3204 field = ast_json_object_get(body, "data");
3205 if (field) {
3206 args->data = ast_json_string_get(field);
3207 }
3208 field = ast_json_object_get(body, "transport_data");
3209 if (field) {
3210 args->transport_data = ast_json_string_get(field);
3211 }
3212 return 0;
3213}

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 2410 of file res_ari_channels.c.

2414{
2416 struct ast_variable *i;
2417#if defined(AST_DEVMODE)
2418 int is_valid;
2419 int code;
2420#endif /* AST_DEVMODE */
2421
2422 for (i = get_params; i; i = i->next) {
2423 if (strcmp(i->name, "variable") == 0) {
2424 args.variable = (i->value);
2425 } else
2426 {}
2427 }
2428 for (i = path_vars; i; i = i->next) {
2429 if (strcmp(i->name, "channelId") == 0) {
2430 args.channel_id = (i->value);
2431 } else
2432 {}
2433 }
2436 goto fin;
2437 }
2438 ast_ari_channels_get_channel_var(headers, &args, response);
2439#if defined(AST_DEVMODE)
2440 code = response->response_code;
2441
2442 switch (code) {
2443 case 0: /* Implementation is still a stub, or the code wasn't set */
2444 is_valid = response->message == NULL;
2445 break;
2446 case 500: /* Internal Server Error */
2447 case 501: /* Not Implemented */
2448 case 400: /* Missing variable parameter. */
2449 case 404: /* Channel or variable not found */
2450 case 409: /* Channel not in a Stasis application */
2451 is_valid = 1;
2452 break;
2453 default:
2454 if (200 <= code && code <= 299) {
2455 is_valid = ast_ari_validate_variable(
2456 response->message);
2457 } else {
2458 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
2459 is_valid = 0;
2460 }
2461 }
2462
2463 if (!is_valid) {
2464 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
2465 ast_ari_response_error(response, 500,
2466 "Internal Server Error", "Response validation failed");
2467 }
2468#endif /* AST_DEVMODE */
2469
2470fin: __attribute__((unused))
2471 return;
2472}
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 2388 of file res_ari_channels.c.

2391{
2392 struct ast_json *field;
2393 /* Parse query parameters out of it */
2394 field = ast_json_object_get(body, "variable");
2395 if (field) {
2396 args->variable = ast_json_string_get(field);
2397 }
2398 return 0;
2399}

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

Referenced by ast_ari_channels_get_channel_var_cb().

◆ ast_ari_channels_get_channel_vars_cb()

static void ast_ari_channels_get_channel_vars_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}/variables.

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 2619 of file res_ari_channels.c.

2623{
2625 struct ast_variable *i;
2626#if defined(AST_DEVMODE)
2627 int is_valid;
2628 int code;
2629#endif /* AST_DEVMODE */
2630
2631 for (i = get_params; i; i = i->next) {
2632 if (strcmp(i->name, "variables") == 0) {
2633 /* Parse comma separated list */
2634 char *vals[MAX_VALS];
2635 size_t j;
2636
2637 args.variables_parse = ast_strdup(i->value);
2638 if (!args.variables_parse) {
2640 goto fin;
2641 }
2642
2643 if (strlen(args.variables_parse) == 0) {
2644 /* ast_app_separate_args can't handle "" */
2645 args.variables_count = 1;
2646 vals[0] = args.variables_parse;
2647 } else {
2648 args.variables_count = ast_app_separate_args(
2649 args.variables_parse, ',', vals,
2650 ARRAY_LEN(vals));
2651 }
2652
2653 if (args.variables_count == 0) {
2655 goto fin;
2656 }
2657
2658 if (args.variables_count >= MAX_VALS) {
2659 ast_ari_response_error(response, 400,
2660 "Bad Request",
2661 "Too many values for variables");
2662 goto fin;
2663 }
2664
2665 args.variables = ast_malloc(sizeof(*args.variables) * args.variables_count);
2666 if (!args.variables) {
2668 goto fin;
2669 }
2670
2671 for (j = 0; j < args.variables_count; ++j) {
2672 args.variables[j] = (vals[j]);
2673 }
2674 } else
2675 {}
2676 }
2677 for (i = path_vars; i; i = i->next) {
2678 if (strcmp(i->name, "channelId") == 0) {
2679 args.channel_id = (i->value);
2680 } else
2681 {}
2682 }
2685 goto fin;
2686 }
2687 ast_ari_channels_get_channel_vars(headers, &args, response);
2688#if defined(AST_DEVMODE)
2689 code = response->response_code;
2690
2691 switch (code) {
2692 case 0: /* Implementation is still a stub, or the code wasn't set */
2693 is_valid = response->message == NULL;
2694 break;
2695 case 500: /* Internal Server Error */
2696 case 501: /* Not Implemented */
2697 case 400: /* Missing variables parameter. */
2698 case 404: /* Channel or variable not found */
2699 case 409: /* Channel not in a Stasis application */
2700 is_valid = 1;
2701 break;
2702 default:
2703 if (200 <= code && code <= 299) {
2704 is_valid = ast_ari_validate_variables(
2705 response->message);
2706 } else {
2707 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variables\n", code);
2708 is_valid = 0;
2709 }
2710 }
2711
2712 if (!is_valid) {
2713 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variables\n");
2714 ast_ari_response_error(response, 500,
2715 "Internal Server Error", "Response validation failed");
2716 }
2717#endif /* AST_DEVMODE */
2718
2719fin: __attribute__((unused))
2720 ast_free(args.variables_parse);
2721 ast_free(args.variables);
2722 return;
2723}
int ast_ari_validate_variables(struct ast_json *json)
Validator for Variables.
#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_get_channel_vars_parse_body(struct ast_json *body, struct ast_ari_channels_get_channel_vars_args *args)
Body parsing function for /channels/{channelId}/variables.
void ast_ari_channels_get_channel_vars(struct ast_variable *headers, struct ast_ari_channels_get_channel_vars_args *args, struct ast_ari_response *response)
Get the value of multiple channel variables or functions.
#define ARRAY_LEN(a)
Definition utils.h:706

References args, ARRAY_LEN, ast_app_separate_args, ast_ari_channels_get_channel_vars(), ast_ari_channels_get_channel_vars_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_variables(), 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_get_channel_vars_parse_body()

int ast_ari_channels_get_channel_vars_parse_body ( struct ast_json body,
struct ast_ari_channels_get_channel_vars_args args 
)

Body parsing function for /channels/{channelId}/variables.

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 2572 of file res_ari_channels.c.

2575{
2576 struct ast_json *field;
2577 /* Parse query parameters out of it */
2578 field = ast_json_object_get(body, "variables");
2579 if (field) {
2580 /* If they were silly enough to both pass in a query param and a
2581 * JSON body, free up the query value.
2582 */
2583 ast_free(args->variables);
2584 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
2585 /* Multiple param passed as array */
2586 size_t i;
2587 args->variables_count = ast_json_array_size(field);
2588 args->variables = ast_malloc(sizeof(*args->variables) * args->variables_count);
2589
2590 if (!args->variables) {
2591 return -1;
2592 }
2593
2594 for (i = 0; i < args->variables_count; ++i) {
2595 args->variables[i] = ast_json_string_get(ast_json_array_get(field, i));
2596 }
2597 } else {
2598 /* Multiple param passed as single value */
2599 args->variables_count = 1;
2600 args->variables = ast_malloc(sizeof(*args->variables) * args->variables_count);
2601 if (!args->variables) {
2602 return -1;
2603 }
2604 args->variables[0] = ast_json_string_get(field);
2605 }
2606 }
2607 return 0;
2608}
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_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.

Referenced by ast_ari_channels_get_channel_vars_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 1518 of file res_ari_channels.c.

1522{
1523 struct ast_ari_channels_hold_args args = {};
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_hold(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_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 1361 of file res_ari_channels.c.

1365{
1366 struct ast_ari_channels_mute_args args = {};
1367 struct ast_variable *i;
1368#if defined(AST_DEVMODE)
1369 int is_valid;
1370 int code;
1371#endif /* AST_DEVMODE */
1372
1373 for (i = get_params; i; i = i->next) {
1374 if (strcmp(i->name, "direction") == 0) {
1375 args.direction = (i->value);
1376 } else
1377 {}
1378 }
1379 for (i = path_vars; i; i = i->next) {
1380 if (strcmp(i->name, "channelId") == 0) {
1381 args.channel_id = (i->value);
1382 } else
1383 {}
1384 }
1387 goto fin;
1388 }
1389 ast_ari_channels_mute(headers, &args, response);
1390#if defined(AST_DEVMODE)
1391 code = response->response_code;
1392
1393 switch (code) {
1394 case 0: /* Implementation is still a stub, or the code wasn't set */
1395 is_valid = response->message == NULL;
1396 break;
1397 case 500: /* Internal Server Error */
1398 case 501: /* Not Implemented */
1399 case 404: /* Channel not found */
1400 case 409: /* Channel not in a Stasis application */
1401 case 412: /* Channel in invalid state */
1402 is_valid = 1;
1403 break;
1404 default:
1405 if (200 <= code && code <= 299) {
1406 is_valid = ast_ari_validate_void(
1407 response->message);
1408 } else {
1409 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mute\n", code);
1410 is_valid = 0;
1411 }
1412 }
1413
1414 if (!is_valid) {
1415 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mute\n");
1416 ast_ari_response_error(response, 500,
1417 "Internal Server Error", "Response validation failed");
1418 }
1419#endif /* AST_DEVMODE */
1420
1421fin: __attribute__((unused))
1422 return;
1423}
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 1339 of file res_ari_channels.c.

1342{
1343 struct ast_json *field;
1344 /* Parse query parameters out of it */
1345 field = ast_json_object_get(body, "direction");
1346 if (field) {
1347 args->direction = ast_json_string_get(field);
1348 }
1349 return 0;
1350}

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 1967 of file res_ari_channels.c.

1971{
1972 struct ast_ari_channels_play_args args = {};
1973 struct ast_variable *i;
1974#if defined(AST_DEVMODE)
1975 int is_valid;
1976 int code;
1977#endif /* AST_DEVMODE */
1978
1979 for (i = get_params; i; i = i->next) {
1980 if (strcmp(i->name, "media") == 0) {
1981 /* Parse comma separated list */
1982 char *vals[MAX_VALS];
1983 size_t j;
1984
1985 args.media_parse = ast_strdup(i->value);
1986 if (!args.media_parse) {
1988 goto fin;
1989 }
1990
1991 if (strlen(args.media_parse) == 0) {
1992 /* ast_app_separate_args can't handle "" */
1993 args.media_count = 1;
1994 vals[0] = args.media_parse;
1995 } else {
1996 args.media_count = ast_app_separate_args(
1997 args.media_parse, ',', vals,
1998 ARRAY_LEN(vals));
1999 }
2000
2001 if (args.media_count == 0) {
2003 goto fin;
2004 }
2005
2006 if (args.media_count >= MAX_VALS) {
2007 ast_ari_response_error(response, 400,
2008 "Bad Request",
2009 "Too many values for media");
2010 goto fin;
2011 }
2012
2013 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
2014 if (!args.media) {
2016 goto fin;
2017 }
2018
2019 for (j = 0; j < args.media_count; ++j) {
2020 args.media[j] = (vals[j]);
2021 }
2022 } else
2023 if (strcmp(i->name, "lang") == 0) {
2024 args.lang = (i->value);
2025 } else
2026 if (strcmp(i->name, "offsetms") == 0) {
2027 args.offsetms = atoi(i->value);
2028 } else
2029 if (strcmp(i->name, "skipms") == 0) {
2030 args.skipms = atoi(i->value);
2031 } else
2032 if (strcmp(i->name, "playbackId") == 0) {
2033 args.playback_id = (i->value);
2034 } else
2035 {}
2036 }
2037 for (i = path_vars; i; i = i->next) {
2038 if (strcmp(i->name, "channelId") == 0) {
2039 args.channel_id = (i->value);
2040 } else
2041 {}
2042 }
2045 goto fin;
2046 }
2047 ast_ari_channels_play(headers, &args, response);
2048#if defined(AST_DEVMODE)
2049 code = response->response_code;
2050
2051 switch (code) {
2052 case 0: /* Implementation is still a stub, or the code wasn't set */
2053 is_valid = response->message == NULL;
2054 break;
2055 case 500: /* Internal Server Error */
2056 case 501: /* Not Implemented */
2057 case 404: /* Channel not found */
2058 case 409: /* Channel not in a Stasis application */
2059 case 412: /* Channel in invalid state */
2060 is_valid = 1;
2061 break;
2062 default:
2063 if (200 <= code && code <= 299) {
2064 is_valid = ast_ari_validate_playback(
2065 response->message);
2066 } else {
2067 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/play\n", code);
2068 is_valid = 0;
2069 }
2070 }
2071
2072 if (!is_valid) {
2073 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/play\n");
2074 ast_ari_response_error(response, 500,
2075 "Internal Server Error", "Response validation failed");
2076 }
2077#endif /* AST_DEVMODE */
2078
2079fin: __attribute__((unused))
2080 ast_free(args.media_parse);
2081 ast_free(args.media);
2082 return;
2083}
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
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.

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 1904 of file res_ari_channels.c.

1907{
1908 struct ast_json *field;
1909 /* Parse query parameters out of it */
1910 field = ast_json_object_get(body, "media");
1911 if (field) {
1912 /* If they were silly enough to both pass in a query param and a
1913 * JSON body, free up the query value.
1914 */
1915 ast_free(args->media);
1916 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
1917 /* Multiple param passed as array */
1918 size_t i;
1919 args->media_count = ast_json_array_size(field);
1920 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1921
1922 if (!args->media) {
1923 return -1;
1924 }
1925
1926 for (i = 0; i < args->media_count; ++i) {
1927 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
1928 }
1929 } else {
1930 /* Multiple param passed as single value */
1931 args->media_count = 1;
1932 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
1933 if (!args->media) {
1934 return -1;
1935 }
1936 args->media[0] = ast_json_string_get(field);
1937 }
1938 }
1939 field = ast_json_object_get(body, "lang");
1940 if (field) {
1941 args->lang = ast_json_string_get(field);
1942 }
1943 field = ast_json_object_get(body, "offsetms");
1944 if (field) {
1945 args->offsetms = ast_json_integer_get(field);
1946 }
1947 field = ast_json_object_get(body, "skipms");
1948 if (field) {
1949 args->skipms = ast_json_integer_get(field);
1950 }
1951 field = ast_json_object_get(body, "playbackId");
1952 if (field) {
1953 args->playback_id = ast_json_string_get(field);
1954 }
1955 return 0;
1956}

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 2143 of file res_ari_channels.c.

2147{
2149 struct ast_variable *i;
2150#if defined(AST_DEVMODE)
2151 int is_valid;
2152 int code;
2153#endif /* AST_DEVMODE */
2154
2155 for (i = get_params; i; i = i->next) {
2156 if (strcmp(i->name, "media") == 0) {
2157 /* Parse comma separated list */
2158 char *vals[MAX_VALS];
2159 size_t j;
2160
2161 args.media_parse = ast_strdup(i->value);
2162 if (!args.media_parse) {
2164 goto fin;
2165 }
2166
2167 if (strlen(args.media_parse) == 0) {
2168 /* ast_app_separate_args can't handle "" */
2169 args.media_count = 1;
2170 vals[0] = args.media_parse;
2171 } else {
2172 args.media_count = ast_app_separate_args(
2173 args.media_parse, ',', vals,
2174 ARRAY_LEN(vals));
2175 }
2176
2177 if (args.media_count == 0) {
2179 goto fin;
2180 }
2181
2182 if (args.media_count >= MAX_VALS) {
2183 ast_ari_response_error(response, 400,
2184 "Bad Request",
2185 "Too many values for media");
2186 goto fin;
2187 }
2188
2189 args.media = ast_malloc(sizeof(*args.media) * args.media_count);
2190 if (!args.media) {
2192 goto fin;
2193 }
2194
2195 for (j = 0; j < args.media_count; ++j) {
2196 args.media[j] = (vals[j]);
2197 }
2198 } else
2199 if (strcmp(i->name, "lang") == 0) {
2200 args.lang = (i->value);
2201 } else
2202 if (strcmp(i->name, "offsetms") == 0) {
2203 args.offsetms = atoi(i->value);
2204 } else
2205 if (strcmp(i->name, "skipms") == 0) {
2206 args.skipms = atoi(i->value);
2207 } else
2208 {}
2209 }
2210 for (i = path_vars; i; i = i->next) {
2211 if (strcmp(i->name, "channelId") == 0) {
2212 args.channel_id = (i->value);
2213 } else
2214 if (strcmp(i->name, "playbackId") == 0) {
2215 args.playback_id = (i->value);
2216 } else
2217 {}
2218 }
2221 goto fin;
2222 }
2223 ast_ari_channels_play_with_id(headers, &args, response);
2224#if defined(AST_DEVMODE)
2225 code = response->response_code;
2226
2227 switch (code) {
2228 case 0: /* Implementation is still a stub, or the code wasn't set */
2229 is_valid = response->message == NULL;
2230 break;
2231 case 500: /* Internal Server Error */
2232 case 501: /* Not Implemented */
2233 case 404: /* Channel not found */
2234 case 409: /* Channel not in a Stasis application */
2235 case 412: /* Channel in invalid state */
2236 is_valid = 1;
2237 break;
2238 default:
2239 if (200 <= code && code <= 299) {
2240 is_valid = ast_ari_validate_playback(
2241 response->message);
2242 } else {
2243 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/play/{playbackId}\n", code);
2244 is_valid = 0;
2245 }
2246 }
2247
2248 if (!is_valid) {
2249 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/play/{playbackId}\n");
2250 ast_ari_response_error(response, 500,
2251 "Internal Server Error", "Response validation failed");
2252 }
2253#endif /* AST_DEVMODE */
2254
2255fin: __attribute__((unused))
2256 ast_free(args.media_parse);
2257 ast_free(args.media);
2258 return;
2259}
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 2084 of file res_ari_channels.c.

2087{
2088 struct ast_json *field;
2089 /* Parse query parameters out of it */
2090 field = ast_json_object_get(body, "media");
2091 if (field) {
2092 /* If they were silly enough to both pass in a query param and a
2093 * JSON body, free up the query value.
2094 */
2095 ast_free(args->media);
2096 if (ast_json_typeof(field) == AST_JSON_ARRAY) {
2097 /* Multiple param passed as array */
2098 size_t i;
2099 args->media_count = ast_json_array_size(field);
2100 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
2101
2102 if (!args->media) {
2103 return -1;
2104 }
2105
2106 for (i = 0; i < args->media_count; ++i) {
2107 args->media[i] = ast_json_string_get(ast_json_array_get(field, i));
2108 }
2109 } else {
2110 /* Multiple param passed as single value */
2111 args->media_count = 1;
2112 args->media = ast_malloc(sizeof(*args->media) * args->media_count);
2113 if (!args->media) {
2114 return -1;
2115 }
2116 args->media[0] = ast_json_string_get(field);
2117 }
2118 }
2119 field = ast_json_object_get(body, "lang");
2120 if (field) {
2121 args->lang = ast_json_string_get(field);
2122 }
2123 field = ast_json_object_get(body, "offsetms");
2124 if (field) {
2125 args->offsetms = ast_json_integer_get(field);
2126 }
2127 field = ast_json_object_get(body, "skipms");
2128 if (field) {
2129 args->skipms = ast_json_integer_get(field);
2130 }
2131 return 0;
2132}

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_progress_cb()

static void ast_ari_channels_progress_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}/progress.

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 1172 of file res_ari_channels.c.

1176{
1178 struct ast_variable *i;
1179#if defined(AST_DEVMODE)
1180 int is_valid;
1181 int code;
1182#endif /* AST_DEVMODE */
1183
1184 for (i = path_vars; i; i = i->next) {
1185 if (strcmp(i->name, "channelId") == 0) {
1186 args.channel_id = (i->value);
1187 } else
1188 {}
1189 }
1190 ast_ari_channels_progress(headers, &args, response);
1191#if defined(AST_DEVMODE)
1192 code = response->response_code;
1193
1194 switch (code) {
1195 case 0: /* Implementation is still a stub, or the code wasn't set */
1196 is_valid = response->message == NULL;
1197 break;
1198 case 500: /* Internal Server Error */
1199 case 501: /* Not Implemented */
1200 case 404: /* Channel not found */
1201 case 409: /* Channel not in a Stasis application */
1202 case 412: /* Channel in invalid state */
1203 is_valid = 1;
1204 break;
1205 default:
1206 if (200 <= code && code <= 299) {
1207 is_valid = ast_ari_validate_void(
1208 response->message);
1209 } else {
1210 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/progress\n", code);
1211 is_valid = 0;
1212 }
1213 }
1214
1215 if (!is_valid) {
1216 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/progress\n");
1217 ast_ari_response_error(response, 500,
1218 "Internal Server Error", "Response validation failed");
1219 }
1220#endif /* AST_DEVMODE */
1221
1222fin: __attribute__((unused))
1223 return;
1224}
void ast_ari_channels_progress(struct ast_variable *headers, struct ast_ari_channels_progress_args *args, struct ast_ari_response *response)
Indicate progress on a channel.

References args, ast_ari_channels_progress(), 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_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 2306 of file res_ari_channels.c.

2310{
2312 struct ast_variable *i;
2313#if defined(AST_DEVMODE)
2314 int is_valid;
2315 int code;
2316#endif /* AST_DEVMODE */
2317
2318 for (i = get_params; i; i = i->next) {
2319 if (strcmp(i->name, "name") == 0) {
2320 args.name = (i->value);
2321 } else
2322 if (strcmp(i->name, "format") == 0) {
2323 args.format = (i->value);
2324 } else
2325 if (strcmp(i->name, "maxDurationSeconds") == 0) {
2326 args.max_duration_seconds = atoi(i->value);
2327 } else
2328 if (strcmp(i->name, "maxSilenceSeconds") == 0) {
2329 args.max_silence_seconds = atoi(i->value);
2330 } else
2331 if (strcmp(i->name, "ifExists") == 0) {
2332 args.if_exists = (i->value);
2333 } else
2334 if (strcmp(i->name, "beep") == 0) {
2335 args.beep = ast_true(i->value);
2336 } else
2337 if (strcmp(i->name, "terminateOn") == 0) {
2338 args.terminate_on = (i->value);
2339 } else
2340 {}
2341 }
2342 for (i = path_vars; i; i = i->next) {
2343 if (strcmp(i->name, "channelId") == 0) {
2344 args.channel_id = (i->value);
2345 } else
2346 {}
2347 }
2350 goto fin;
2351 }
2352 ast_ari_channels_record(headers, &args, response);
2353#if defined(AST_DEVMODE)
2354 code = response->response_code;
2355
2356 switch (code) {
2357 case 0: /* Implementation is still a stub, or the code wasn't set */
2358 is_valid = response->message == NULL;
2359 break;
2360 case 500: /* Internal Server Error */
2361 case 501: /* Not Implemented */
2362 case 400: /* Invalid parameters */
2363 case 404: /* Channel not found */
2364 case 409: /* Channel is not in a Stasis application; the channel is currently bridged with other channels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
2365 case 422: /* The format specified is unknown on this system */
2366 is_valid = 1;
2367 break;
2368 default:
2369 if (200 <= code && code <= 299) {
2371 response->message);
2372 } else {
2373 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/record\n", code);
2374 is_valid = 0;
2375 }
2376 }
2377
2378 if (!is_valid) {
2379 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/record\n");
2380 ast_ari_response_error(response, 500,
2381 "Internal Server Error", "Response validation failed");
2382 }
2383#endif /* AST_DEVMODE */
2384
2385fin: __attribute__((unused))
2386 return;
2387}
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:2233

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 2260 of file res_ari_channels.c.

2263{
2264 struct ast_json *field;
2265 /* Parse query parameters out of it */
2266 field = ast_json_object_get(body, "name");
2267 if (field) {
2268 args->name = ast_json_string_get(field);
2269 }
2270 field = ast_json_object_get(body, "format");
2271 if (field) {
2272 args->format = ast_json_string_get(field);
2273 }
2274 field = ast_json_object_get(body, "maxDurationSeconds");
2275 if (field) {
2276 args->max_duration_seconds = ast_json_integer_get(field);
2277 }
2278 field = ast_json_object_get(body, "maxSilenceSeconds");
2279 if (field) {
2280 args->max_silence_seconds = ast_json_integer_get(field);
2281 }
2282 field = ast_json_object_get(body, "ifExists");
2283 if (field) {
2284 args->if_exists = ast_json_string_get(field);
2285 }
2286 field = ast_json_object_get(body, "beep");
2287 if (field) {
2288 args->beep = ast_json_is_true(field);
2289 }
2290 field = ast_json_object_get(body, "terminateOn");
2291 if (field) {
2292 args->terminate_on = ast_json_string_get(field);
2293 }
2294 return 0;
2295}
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 3115 of file res_ari_channels.c.

3119{
3121 struct ast_variable *i;
3122#if defined(AST_DEVMODE)
3123 int is_valid;
3124 int code;
3125#endif /* AST_DEVMODE */
3126
3127 for (i = path_vars; i; i = i->next) {
3128 if (strcmp(i->name, "channelId") == 0) {
3129 args.channel_id = (i->value);
3130 } else
3131 {}
3132 }
3133 ast_ari_channels_rtpstatistics(headers, &args, response);
3134#if defined(AST_DEVMODE)
3135 code = response->response_code;
3136
3137 switch (code) {
3138 case 0: /* Implementation is still a stub, or the code wasn't set */
3139 is_valid = response->message == NULL;
3140 break;
3141 case 500: /* Internal Server Error */
3142 case 501: /* Not Implemented */
3143 case 404: /* Channel cannot be found. */
3144 is_valid = 1;
3145 break;
3146 default:
3147 if (200 <= code && code <= 299) {
3148 is_valid = ast_ari_validate_rtpstat(
3149 response->message);
3150 } else {
3151 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/rtp_statistics\n", code);
3152 is_valid = 0;
3153 }
3154 }
3155
3156 if (!is_valid) {
3157 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/rtp_statistics\n");
3158 ast_ari_response_error(response, 500,
3159 "Internal Server Error", "Response validation failed");
3160 }
3161#endif /* AST_DEVMODE */
3162
3163fin: __attribute__((unused))
3164 return;
3165}
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 1263 of file res_ari_channels.c.

1267{
1269 struct ast_variable *i;
1270#if defined(AST_DEVMODE)
1271 int is_valid;
1272 int code;
1273#endif /* AST_DEVMODE */
1274
1275 for (i = get_params; i; i = i->next) {
1276 if (strcmp(i->name, "dtmf") == 0) {
1277 args.dtmf = (i->value);
1278 } else
1279 if (strcmp(i->name, "before") == 0) {
1280 args.before = atoi(i->value);
1281 } else
1282 if (strcmp(i->name, "between") == 0) {
1283 args.between = atoi(i->value);
1284 } else
1285 if (strcmp(i->name, "duration") == 0) {
1286 args.duration = atoi(i->value);
1287 } else
1288 if (strcmp(i->name, "after") == 0) {
1289 args.after = atoi(i->value);
1290 } else
1291 {}
1292 }
1293 for (i = path_vars; i; i = i->next) {
1294 if (strcmp(i->name, "channelId") == 0) {
1295 args.channel_id = (i->value);
1296 } else
1297 {}
1298 }
1301 goto fin;
1302 }
1303 ast_ari_channels_send_dtmf(headers, &args, response);
1304#if defined(AST_DEVMODE)
1305 code = response->response_code;
1306
1307 switch (code) {
1308 case 0: /* Implementation is still a stub, or the code wasn't set */
1309 is_valid = response->message == NULL;
1310 break;
1311 case 500: /* Internal Server Error */
1312 case 501: /* Not Implemented */
1313 case 400: /* DTMF is required */
1314 case 404: /* Channel not found */
1315 case 409: /* Channel not in a Stasis application */
1316 case 412: /* Channel in invalid state */
1317 is_valid = 1;
1318 break;
1319 default:
1320 if (200 <= code && code <= 299) {
1321 is_valid = ast_ari_validate_void(
1322 response->message);
1323 } else {
1324 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/dtmf\n", code);
1325 is_valid = 0;
1326 }
1327 }
1328
1329 if (!is_valid) {
1330 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/dtmf\n");
1331 ast_ari_response_error(response, 500,
1332 "Internal Server Error", "Response validation failed");
1333 }
1334#endif /* AST_DEVMODE */
1335
1336fin: __attribute__((unused))
1337 return;
1338}
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 1225 of file res_ari_channels.c.

1228{
1229 struct ast_json *field;
1230 /* Parse query parameters out of it */
1231 field = ast_json_object_get(body, "dtmf");
1232 if (field) {
1233 args->dtmf = ast_json_string_get(field);
1234 }
1235 field = ast_json_object_get(body, "before");
1236 if (field) {
1237 args->before = ast_json_integer_get(field);
1238 }
1239 field = ast_json_object_get(body, "between");
1240 if (field) {
1241 args->between = ast_json_integer_get(field);
1242 }
1243 field = ast_json_object_get(body, "duration");
1244 if (field) {
1245 args->duration = ast_json_integer_get(field);
1246 }
1247 field = ast_json_object_get(body, "after");
1248 if (field) {
1249 args->after = ast_json_integer_get(field);
1250 }
1251 return 0;
1252}

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 2503 of file res_ari_channels.c.

2507{
2509 struct ast_variable *i;
2510#if defined(AST_DEVMODE)
2511 int is_valid;
2512 int code;
2513#endif /* AST_DEVMODE */
2514
2515 for (i = get_params; i; i = i->next) {
2516 if (strcmp(i->name, "variable") == 0) {
2517 args.variable = (i->value);
2518 } else
2519 if (strcmp(i->name, "value") == 0) {
2520 args.value = (i->value);
2521 } else
2522 if (strcmp(i->name, "report_events") == 0) {
2523 args.report_events = ast_true(i->value);
2524 } else
2525 {}
2526 }
2527 for (i = path_vars; i; i = i->next) {
2528 if (strcmp(i->name, "channelId") == 0) {
2529 args.channel_id = (i->value);
2530 } else
2531 {}
2532 }
2535 goto fin;
2536 }
2537 ast_ari_channels_set_channel_var(headers, &args, response);
2538#if defined(AST_DEVMODE)
2539 code = response->response_code;
2540
2541 switch (code) {
2542 case 0: /* Implementation is still a stub, or the code wasn't set */
2543 is_valid = response->message == NULL;
2544 break;
2545 case 500: /* Internal Server Error */
2546 case 501: /* Not Implemented */
2547 case 400: /* Missing variable parameter. */
2548 case 404: /* Channel not found */
2549 case 409: /* Channel not in a Stasis application */
2550 is_valid = 1;
2551 break;
2552 default:
2553 if (200 <= code && code <= 299) {
2554 is_valid = ast_ari_validate_void(
2555 response->message);
2556 } else {
2557 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
2558 is_valid = 0;
2559 }
2560 }
2561
2562 if (!is_valid) {
2563 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
2564 ast_ari_response_error(response, 500,
2565 "Internal Server Error", "Response validation failed");
2566 }
2567#endif /* AST_DEVMODE */
2568
2569fin: __attribute__((unused))
2570 return;
2571}
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, 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_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 2473 of file res_ari_channels.c.

2476{
2477 struct ast_json *field;
2478 /* Parse query parameters out of it */
2479 field = ast_json_object_get(body, "variable");
2480 if (field) {
2481 args->variable = ast_json_string_get(field);
2482 }
2483 field = ast_json_object_get(body, "value");
2484 if (field) {
2485 args->value = ast_json_string_get(field);
2486 }
2487 field = ast_json_object_get(body, "report_events");
2488 if (field) {
2489 args->report_events = ast_json_is_true(field);
2490 }
2491 return 0;
2492}

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

Referenced by ast_ari_channels_set_channel_var_cb().

◆ ast_ari_channels_set_channel_vars_cb()

static void ast_ari_channels_set_channel_vars_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}/variables.

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 2741 of file res_ari_channels.c.

2745{
2747 struct ast_variable *i;
2748#if defined(AST_DEVMODE)
2749 int is_valid;
2750 int code;
2751#endif /* AST_DEVMODE */
2752
2753 for (i = path_vars; i; i = i->next) {
2754 if (strcmp(i->name, "channelId") == 0) {
2755 args.channel_id = (i->value);
2756 } else
2757 {}
2758 }
2759 args.variables = body;
2760 ast_ari_channels_set_channel_vars(headers, &args, response);
2761#if defined(AST_DEVMODE)
2762 code = response->response_code;
2763
2764 switch (code) {
2765 case 0: /* Implementation is still a stub, or the code wasn't set */
2766 is_valid = response->message == NULL;
2767 break;
2768 case 500: /* Internal Server Error */
2769 case 501: /* Not Implemented */
2770 case 400: /* Missing variables parameter. */
2771 case 404: /* Channel not found */
2772 case 409: /* Channel not in a Stasis application */
2773 is_valid = 1;
2774 break;
2775 default:
2776 if (200 <= code && code <= 299) {
2777 is_valid = ast_ari_validate_void(
2778 response->message);
2779 } else {
2780 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variables\n", code);
2781 is_valid = 0;
2782 }
2783 }
2784
2785 if (!is_valid) {
2786 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variables\n");
2787 ast_ari_response_error(response, 500,
2788 "Internal Server Error", "Response validation failed");
2789 }
2790#endif /* AST_DEVMODE */
2791
2792fin: __attribute__((unused))
2793 return;
2794}
void ast_ari_channels_set_channel_vars(struct ast_variable *headers, struct ast_ari_channels_set_channel_vars_args *args, struct ast_ari_response *response)
Set the values of multiple channel variables or functions.

References args, ast_ari_channels_set_channel_vars(), 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_vars_parse_body()

int ast_ari_channels_set_channel_vars_parse_body ( struct ast_json body,
struct ast_ari_channels_set_channel_vars_args args 
)

Body parsing function for /channels/{channelId}/variables.

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 2724 of file res_ari_channels.c.

2727{
2728 /* Parse query parameters out of it */
2729 return 0;
2730}

◆ 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 2833 of file res_ari_channels.c.

2837{
2839 struct ast_variable *i;
2840#if defined(AST_DEVMODE)
2841 int is_valid;
2842 int code;
2843#endif /* AST_DEVMODE */
2844
2845 for (i = get_params; i; i = i->next) {
2846 if (strcmp(i->name, "spy") == 0) {
2847 args.spy = (i->value);
2848 } else
2849 if (strcmp(i->name, "whisper") == 0) {
2850 args.whisper = (i->value);
2851 } else
2852 if (strcmp(i->name, "app") == 0) {
2853 args.app = (i->value);
2854 } else
2855 if (strcmp(i->name, "appArgs") == 0) {
2856 args.app_args = (i->value);
2857 } else
2858 if (strcmp(i->name, "snoopId") == 0) {
2859 args.snoop_id = (i->value);
2860 } else
2861 {}
2862 }
2863 for (i = path_vars; i; i = i->next) {
2864 if (strcmp(i->name, "channelId") == 0) {
2865 args.channel_id = (i->value);
2866 } else
2867 {}
2868 }
2871 goto fin;
2872 }
2873 ast_ari_channels_snoop_channel(headers, &args, response);
2874#if defined(AST_DEVMODE)
2875 code = response->response_code;
2876
2877 switch (code) {
2878 case 0: /* Implementation is still a stub, or the code wasn't set */
2879 is_valid = response->message == NULL;
2880 break;
2881 case 500: /* Internal Server Error */
2882 case 501: /* Not Implemented */
2883 case 400: /* Invalid parameters */
2884 case 404: /* Channel not found */
2885 is_valid = 1;
2886 break;
2887 default:
2888 if (200 <= code && code <= 299) {
2889 is_valid = ast_ari_validate_channel(
2890 response->message);
2891 } else {
2892 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/snoop\n", code);
2893 is_valid = 0;
2894 }
2895 }
2896
2897 if (!is_valid) {
2898 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/snoop\n");
2899 ast_ari_response_error(response, 500,
2900 "Internal Server Error", "Response validation failed");
2901 }
2902#endif /* AST_DEVMODE */
2903
2904fin: __attribute__((unused))
2905 return;
2906}
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 2795 of file res_ari_channels.c.

2798{
2799 struct ast_json *field;
2800 /* Parse query parameters out of it */
2801 field = ast_json_object_get(body, "spy");
2802 if (field) {
2803 args->spy = ast_json_string_get(field);
2804 }
2805 field = ast_json_object_get(body, "whisper");
2806 if (field) {
2807 args->whisper = ast_json_string_get(field);
2808 }
2809 field = ast_json_object_get(body, "app");
2810 if (field) {
2811 args->app = ast_json_string_get(field);
2812 }
2813 field = ast_json_object_get(body, "appArgs");
2814 if (field) {
2815 args->app_args = ast_json_string_get(field);
2816 }
2817 field = ast_json_object_get(body, "snoopId");
2818 if (field) {
2819 args->snoop_id = ast_json_string_get(field);
2820 }
2821 return 0;
2822}

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 2941 of file res_ari_channels.c.

2945{
2947 struct ast_variable *i;
2948#if defined(AST_DEVMODE)
2949 int is_valid;
2950 int code;
2951#endif /* AST_DEVMODE */
2952
2953 for (i = get_params; i; i = i->next) {
2954 if (strcmp(i->name, "spy") == 0) {
2955 args.spy = (i->value);
2956 } else
2957 if (strcmp(i->name, "whisper") == 0) {
2958 args.whisper = (i->value);
2959 } else
2960 if (strcmp(i->name, "app") == 0) {
2961 args.app = (i->value);
2962 } else
2963 if (strcmp(i->name, "appArgs") == 0) {
2964 args.app_args = (i->value);
2965 } else
2966 {}
2967 }
2968 for (i = path_vars; i; i = i->next) {
2969 if (strcmp(i->name, "channelId") == 0) {
2970 args.channel_id = (i->value);
2971 } else
2972 if (strcmp(i->name, "snoopId") == 0) {
2973 args.snoop_id = (i->value);
2974 } else
2975 {}
2976 }
2979 goto fin;
2980 }
2981 ast_ari_channels_snoop_channel_with_id(headers, &args, response);
2982#if defined(AST_DEVMODE)
2983 code = response->response_code;
2984
2985 switch (code) {
2986 case 0: /* Implementation is still a stub, or the code wasn't set */
2987 is_valid = response->message == NULL;
2988 break;
2989 case 500: /* Internal Server Error */
2990 case 501: /* Not Implemented */
2991 case 400: /* Invalid parameters */
2992 case 404: /* Channel not found */
2993 is_valid = 1;
2994 break;
2995 default:
2996 if (200 <= code && code <= 299) {
2997 is_valid = ast_ari_validate_channel(
2998 response->message);
2999 } else {
3000 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/snoop/{snoopId}\n", code);
3001 is_valid = 0;
3002 }
3003 }
3004
3005 if (!is_valid) {
3006 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/snoop/{snoopId}\n");
3007 ast_ari_response_error(response, 500,
3008 "Internal Server Error", "Response validation failed");
3009 }
3010#endif /* AST_DEVMODE */
3011
3012fin: __attribute__((unused))
3013 return;
3014}
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 2907 of file res_ari_channels.c.

2910{
2911 struct ast_json *field;
2912 /* Parse query parameters out of it */
2913 field = ast_json_object_get(body, "spy");
2914 if (field) {
2915 args->spy = ast_json_string_get(field);
2916 }
2917 field = ast_json_object_get(body, "whisper");
2918 if (field) {
2919 args->whisper = ast_json_string_get(field);
2920 }
2921 field = ast_json_object_get(body, "app");
2922 if (field) {
2923 args->app = ast_json_string_get(field);
2924 }
2925 field = ast_json_object_get(body, "appArgs");
2926 if (field) {
2927 args->app_args = ast_json_string_get(field);
2928 }
2929 return 0;
2930}

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 1655 of file res_ari_channels.c.

1659{
1661 struct ast_variable *i;
1662#if defined(AST_DEVMODE)
1663 int is_valid;
1664 int code;
1665#endif /* AST_DEVMODE */
1666
1667 for (i = get_params; i; i = i->next) {
1668 if (strcmp(i->name, "mohClass") == 0) {
1669 args.moh_class = (i->value);
1670 } else
1671 {}
1672 }
1673 for (i = path_vars; i; i = i->next) {
1674 if (strcmp(i->name, "channelId") == 0) {
1675 args.channel_id = (i->value);
1676 } else
1677 {}
1678 }
1681 goto fin;
1682 }
1683 ast_ari_channels_start_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}
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 1633 of file res_ari_channels.c.

1636{
1637 struct ast_json *field;
1638 /* Parse query parameters out of it */
1639 field = ast_json_object_get(body, "mohClass");
1640 if (field) {
1641 args->moh_class = ast_json_string_get(field);
1642 }
1643 return 0;
1644}

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 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_start_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_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 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_stop_moh(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}/moh\n", code);
1766 is_valid = 0;
1767 }
1768 }
1769
1770 if (!is_valid) {
1771 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/moh\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_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 1851 of file res_ari_channels.c.

1855{
1857 struct ast_variable *i;
1858#if defined(AST_DEVMODE)
1859 int is_valid;
1860 int code;
1861#endif /* AST_DEVMODE */
1862
1863 for (i = path_vars; i; i = i->next) {
1864 if (strcmp(i->name, "channelId") == 0) {
1865 args.channel_id = (i->value);
1866 } else
1867 {}
1868 }
1869 ast_ari_channels_stop_silence(headers, &args, response);
1870#if defined(AST_DEVMODE)
1871 code = response->response_code;
1872
1873 switch (code) {
1874 case 0: /* Implementation is still a stub, or the code wasn't set */
1875 is_valid = response->message == NULL;
1876 break;
1877 case 500: /* Internal Server Error */
1878 case 501: /* Not Implemented */
1879 case 404: /* Channel not found */
1880 case 409: /* Channel not in a Stasis application */
1881 case 412: /* Channel in invalid state */
1882 is_valid = 1;
1883 break;
1884 default:
1885 if (200 <= code && code <= 299) {
1886 is_valid = ast_ari_validate_void(
1887 response->message);
1888 } else {
1889 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/silence\n", code);
1890 is_valid = 0;
1891 }
1892 }
1893
1894 if (!is_valid) {
1895 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/silence\n");
1896 ast_ari_response_error(response, 500,
1897 "Internal Server Error", "Response validation failed");
1898 }
1899#endif /* AST_DEVMODE */
1900
1901fin: __attribute__((unused))
1902 return;
1903}
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_transfer_progress_cb()

static void ast_ari_channels_transfer_progress_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}/transfer_progress.

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 3326 of file res_ari_channels.c.

3330{
3332 struct ast_variable *i;
3333#if defined(AST_DEVMODE)
3334 int is_valid;
3335 int code;
3336#endif /* AST_DEVMODE */
3337
3338 for (i = get_params; i; i = i->next) {
3339 if (strcmp(i->name, "states") == 0) {
3340 args.states = (i->value);
3341 } else
3342 {}
3343 }
3344 for (i = path_vars; i; i = i->next) {
3345 if (strcmp(i->name, "channelId") == 0) {
3346 args.channel_id = (i->value);
3347 } else
3348 {}
3349 }
3352 goto fin;
3353 }
3354 ast_ari_channels_transfer_progress(headers, &args, response);
3355#if defined(AST_DEVMODE)
3356 code = response->response_code;
3357
3358 switch (code) {
3359 case 0: /* Implementation is still a stub, or the code wasn't set */
3360 is_valid = response->message == NULL;
3361 break;
3362 case 500: /* Internal Server Error */
3363 case 501: /* Not Implemented */
3364 case 400: /* Endpoint parameter not provided */
3365 case 404: /* Channel or endpoint not found */
3366 case 409: /* Channel not in a Stasis application */
3367 case 412: /* Channel in invalid state */
3368 is_valid = 1;
3369 break;
3370 default:
3371 if (200 <= code && code <= 299) {
3372 is_valid = ast_ari_validate_void(
3373 response->message);
3374 } else {
3375 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/transfer_progress\n", code);
3376 is_valid = 0;
3377 }
3378 }
3379
3380 if (!is_valid) {
3381 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/transfer_progress\n");
3382 ast_ari_response_error(response, 500,
3383 "Internal Server Error", "Response validation failed");
3384 }
3385#endif /* AST_DEVMODE */
3386
3387fin: __attribute__((unused))
3388 return;
3389}
int ast_ari_channels_transfer_progress_parse_body(struct ast_json *body, struct ast_ari_channels_transfer_progress_args *args)
Body parsing function for /channels/{channelId}/transfer_progress.
void ast_ari_channels_transfer_progress(struct ast_variable *headers, struct ast_ari_channels_transfer_progress_args *args, struct ast_ari_response *response)
Inform the channel about the progress of the attended/blind transfer.

References args, ast_ari_channels_transfer_progress(), ast_ari_channels_transfer_progress_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_transfer_progress_parse_body()

int ast_ari_channels_transfer_progress_parse_body ( struct ast_json body,
struct ast_ari_channels_transfer_progress_args args 
)

Body parsing function for /channels/{channelId}/transfer_progress.

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 3304 of file res_ari_channels.c.

3307{
3308 struct ast_json *field;
3309 /* Parse query parameters out of it */
3310 field = ast_json_object_get(body, "states");
3311 if (field) {
3312 args->states = ast_json_string_get(field);
3313 }
3314 return 0;
3315}

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

Referenced by ast_ari_channels_transfer_progress_cb().

◆ 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 1580 of file res_ari_channels.c.

1584{
1586 struct ast_variable *i;
1587#if defined(AST_DEVMODE)
1588 int is_valid;
1589 int code;
1590#endif /* AST_DEVMODE */
1591
1592 for (i = path_vars; i; i = i->next) {
1593 if (strcmp(i->name, "channelId") == 0) {
1594 args.channel_id = (i->value);
1595 } else
1596 {}
1597 }
1598 ast_ari_channels_unhold(headers, &args, response);
1599#if defined(AST_DEVMODE)
1600 code = response->response_code;
1601
1602 switch (code) {
1603 case 0: /* Implementation is still a stub, or the code wasn't set */
1604 is_valid = response->message == NULL;
1605 break;
1606 case 500: /* Internal Server Error */
1607 case 501: /* Not Implemented */
1608 case 404: /* Channel not found */
1609 case 409: /* Channel not in a Stasis application */
1610 case 412: /* Channel in invalid state */
1611 is_valid = 1;
1612 break;
1613 default:
1614 if (200 <= code && code <= 299) {
1615 is_valid = ast_ari_validate_void(
1616 response->message);
1617 } else {
1618 ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/hold\n", code);
1619 is_valid = 0;
1620 }
1621 }
1622
1623 if (!is_valid) {
1624 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/hold\n");
1625 ast_ari_response_error(response, 500,
1626 "Internal Server Error", "Response validation failed");
1627 }
1628#endif /* AST_DEVMODE */
1629
1630fin: __attribute__((unused))
1631 return;
1632}
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 1446 of file res_ari_channels.c.

1450{
1452 struct ast_variable *i;
1453#if defined(AST_DEVMODE)
1454 int is_valid;
1455 int code;
1456#endif /* AST_DEVMODE */
1457
1458 for (i = get_params; i; i = i->next) {
1459 if (strcmp(i->name, "direction") == 0) {
1460 args.direction = (i->value);
1461 } else
1462 {}
1463 }
1464 for (i = path_vars; i; i = i->next) {
1465 if (strcmp(i->name, "channelId") == 0) {
1466 args.channel_id = (i->value);
1467 } else
1468 {}
1469 }
1472 goto fin;
1473 }
1474 ast_ari_channels_unmute(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}/mute\n", code);
1495 is_valid = 0;
1496 }
1497 }
1498
1499 if (!is_valid) {
1500 ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mute\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}
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 1424 of file res_ari_channels.c.

1427{
1428 struct ast_json *field;
1429 /* Parse query parameters out of it */
1430 field = ast_json_object_get(body, "direction");
1431 if (field) {
1432 args->direction = ast_json_string_get(field);
1433 }
1434 return 0;
1435}

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 3655 of file res_ari_channels.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 3636 of file res_ari_channels.c.

3637{
3638 int res = 0;
3639
3640
3642 if (res) {
3643 unload_module();
3645 }
3646
3648}
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition res_ari.c:132
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
static int unload_module(void)
static struct stasis_rest_handlers 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 3630 of file res_ari_channels.c.

3631{
3633 return 0;
3634}
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
Definition res_ari.c:155

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 = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_answer,res_stasis_playback,res_stasis_recording,res_stasis_snoop", }
static

Definition at line 3655 of file res_ari_channels.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 3655 of file res_ari_channels.c.

◆ channels

struct stasis_rest_handlers channels
static

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

Definition at line 3620 of file res_ari_channels.c.

3620 {
3621 .path_segment = "channels",
3622 .callbacks = {
3625 },
3626 .num_children = 3,
3628};
@ AST_HTTP_POST
Definition http.h:61
@ AST_HTTP_GET
Definition http.h:60
static struct stasis_rest_handlers channels_create
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId
REST handler for /api-docs/channels.json.
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.
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.
static struct stasis_rest_handlers channels_externalMedia
REST handler for /api-docs/channels.json.

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 3599 of file res_ari_channels.c.

3599 {
3600 .path_segment = "channelId",
3601 .is_wildcard = 1,
3602 .callbacks = {
3606 },
3607 .num_children = 19,
3609};
@ AST_HTTP_DELETE
Definition http.h:64
static struct stasis_rest_handlers channels_channelId_hold
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_snoop
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_silence
REST handler for /api-docs/channels.json.
static void ast_ari_channels_hangup_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}.
static struct stasis_rest_handlers channels_channelId_mute
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_variable
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_answer
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_record
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_rtp_statistics
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_moh
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_variables
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_play
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_continue
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_dtmf
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_progress
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_move
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_ring
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_redirect
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_transfer_progress
REST handler for /api-docs/channels.json.
static struct stasis_rest_handlers channels_channelId_dial
REST handler for /api-docs/channels.json.
static void ast_ari_channels_originate_with_id_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}.
static void ast_ari_channels_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}.

◆ channels_channelId_answer

struct stasis_rest_handlers channels_channelId_answer
static

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

Definition at line 3428 of file res_ari_channels.c.

3428 {
3429 .path_segment = "answer",
3430 .callbacks = {
3432 },
3433 .num_children = 0,
3434 .children = { }
3435};
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.

◆ channels_channelId_continue

struct stasis_rest_handlers channels_channelId_continue
static

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

Definition at line 3401 of file res_ari_channels.c.

3401 {
3402 .path_segment = "continue",
3403 .callbacks = {
3405 },
3406 .num_children = 0,
3407 .children = { }
3408};
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.

◆ channels_channelId_dial

struct stasis_rest_handlers channels_channelId_dial
static

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

Definition at line 3572 of file res_ari_channels.c.

3572 {
3573 .path_segment = "dial",
3574 .callbacks = {
3576 },
3577 .num_children = 0,
3578 .children = { }
3579};
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.

◆ channels_channelId_dtmf

struct stasis_rest_handlers channels_channelId_dtmf
static

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

Definition at line 3456 of file res_ari_channels.c.

3456 {
3457 .path_segment = "dtmf",
3458 .callbacks = {
3460 },
3461 .num_children = 0,
3462 .children = { }
3463};
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.

◆ channels_channelId_hold

struct stasis_rest_handlers channels_channelId_hold
static

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

Definition at line 3475 of file res_ari_channels.c.

3475 {
3476 .path_segment = "hold",
3477 .callbacks = {
3480 },
3481 .num_children = 0,
3482 .children = { }
3483};
static void ast_ari_channels_hold_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/hold.
static void ast_ari_channels_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.

◆ channels_channelId_moh

struct stasis_rest_handlers channels_channelId_moh
static

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

Definition at line 3485 of file res_ari_channels.c.

3485 {
3486 .path_segment = "moh",
3487 .callbacks = {
3490 },
3491 .num_children = 0,
3492 .children = { }
3493};
static void ast_ari_channels_stop_moh_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/moh.
static 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.

◆ channels_channelId_move

struct stasis_rest_handlers channels_channelId_move
static

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

Definition at line 3410 of file res_ari_channels.c.

3410 {
3411 .path_segment = "move",
3412 .callbacks = {
3414 },
3415 .num_children = 0,
3416 .children = { }
3417};
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.

◆ channels_channelId_mute

struct stasis_rest_handlers channels_channelId_mute
static

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

Definition at line 3465 of file res_ari_channels.c.

3465 {
3466 .path_segment = "mute",
3467 .callbacks = {
3470 },
3471 .num_children = 0,
3472 .children = { }
3473};
static void ast_ari_channels_mute_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/mute.
static 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.

◆ channels_channelId_play

struct stasis_rest_handlers channels_channelId_play
static

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

Definition at line 3515 of file res_ari_channels.c.

3515 {
3516 .path_segment = "play",
3517 .callbacks = {
3519 },
3520 .num_children = 1,
3521 .children = { &channels_channelId_play_playbackId, }
3522};
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.
static struct stasis_rest_handlers channels_channelId_play_playbackId
REST handler for /api-docs/channels.json.

◆ channels_channelId_play_playbackId

struct stasis_rest_handlers channels_channelId_play_playbackId
static

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

Definition at line 3505 of file res_ari_channels.c.

3505 {
3506 .path_segment = "playbackId",
3507 .is_wildcard = 1,
3508 .callbacks = {
3510 },
3511 .num_children = 0,
3512 .children = { }
3513};
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}.

◆ channels_channelId_progress

struct stasis_rest_handlers channels_channelId_progress
static

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

Definition at line 3447 of file res_ari_channels.c.

3447 {
3448 .path_segment = "progress",
3449 .callbacks = {
3451 },
3452 .num_children = 0,
3453 .children = { }
3454};
static void ast_ari_channels_progress_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}/progress.

◆ channels_channelId_record

struct stasis_rest_handlers channels_channelId_record
static

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

Definition at line 3524 of file res_ari_channels.c.

3524 {
3525 .path_segment = "record",
3526 .callbacks = {
3528 },
3529 .num_children = 0,
3530 .children = { }
3531};
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.

◆ channels_channelId_redirect

struct stasis_rest_handlers channels_channelId_redirect
static

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

Definition at line 3419 of file res_ari_channels.c.

3419 {
3420 .path_segment = "redirect",
3421 .callbacks = {
3423 },
3424 .num_children = 0,
3425 .children = { }
3426};
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.

◆ channels_channelId_ring

struct stasis_rest_handlers channels_channelId_ring
static

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

Definition at line 3437 of file res_ari_channels.c.

3437 {
3438 .path_segment = "ring",
3439 .callbacks = {
3442 },
3443 .num_children = 0,
3444 .children = { }
3445};
static void ast_ari_channels_ring_stop_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/ring.
static 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.

◆ channels_channelId_rtp_statistics

struct stasis_rest_handlers channels_channelId_rtp_statistics
static

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

Definition at line 3581 of file res_ari_channels.c.

3581 {
3582 .path_segment = "rtp_statistics",
3583 .callbacks = {
3585 },
3586 .num_children = 0,
3587 .children = { }
3588};
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.

◆ channels_channelId_silence

struct stasis_rest_handlers channels_channelId_silence
static

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

Definition at line 3495 of file res_ari_channels.c.

3495 {
3496 .path_segment = "silence",
3497 .callbacks = {
3500 },
3501 .num_children = 0,
3502 .children = { }
3503};
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.
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.

◆ channels_channelId_snoop

struct stasis_rest_handlers channels_channelId_snoop
static

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

Definition at line 3563 of file res_ari_channels.c.

3563 {
3564 .path_segment = "snoop",
3565 .callbacks = {
3567 },
3568 .num_children = 1,
3569 .children = { &channels_channelId_snoop_snoopId, }
3570};
static void ast_ari_channels_snoop_channel_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/snoop.
static struct stasis_rest_handlers channels_channelId_snoop_snoopId
REST handler for /api-docs/channels.json.

◆ channels_channelId_snoop_snoopId

struct stasis_rest_handlers channels_channelId_snoop_snoopId
static

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

Definition at line 3553 of file res_ari_channels.c.

3553 {
3554 .path_segment = "snoopId",
3555 .is_wildcard = 1,
3556 .callbacks = {
3558 },
3559 .num_children = 0,
3560 .children = { }
3561};
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}.

◆ channels_channelId_transfer_progress

struct stasis_rest_handlers channels_channelId_transfer_progress
static

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

Definition at line 3590 of file res_ari_channels.c.

3590 {
3591 .path_segment = "transfer_progress",
3592 .callbacks = {
3594 },
3595 .num_children = 0,
3596 .children = { }
3597};
static void ast_ari_channels_transfer_progress_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}/transfer_progress.

◆ channels_channelId_variable

struct stasis_rest_handlers channels_channelId_variable
static

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

Definition at line 3533 of file res_ari_channels.c.

3533 {
3534 .path_segment = "variable",
3535 .callbacks = {
3538 },
3539 .num_children = 0,
3540 .children = { }
3541};
static void ast_ari_channels_set_channel_var_cb(struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Parameter parsing callback for /channels/{channelId}/variable.
static 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.

◆ channels_channelId_variables

struct stasis_rest_handlers channels_channelId_variables
static

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

Definition at line 3543 of file res_ari_channels.c.

3543 {
3544 .path_segment = "variables",
3545 .callbacks = {
3548 },
3549 .num_children = 0,
3550 .children = { }
3551};
static void ast_ari_channels_set_channel_vars_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}/variables.
static void ast_ari_channels_get_channel_vars_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}/variables.

◆ channels_create

struct stasis_rest_handlers channels_create
static

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

Definition at line 3392 of file res_ari_channels.c.

3392 {
3393 .path_segment = "create",
3394 .callbacks = {
3396 },
3397 .num_children = 0,
3398 .children = { }
3399};
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.

◆ channels_externalMedia

struct stasis_rest_handlers channels_externalMedia
static

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

Definition at line 3611 of file res_ari_channels.c.

3611 {
3612 .path_segment = "externalMedia",
3613 .callbacks = {
3615 },
3616 .num_children = 0,
3617 .children = { }
3618};
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.