summaryrefslogtreecommitdiff
path: root/res/res_ari_channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_ari_channels.c')
-rw-r--r--res/res_ari_channels.c318
1 files changed, 26 insertions, 292 deletions
diff --git a/res/res_ari_channels.c b/res/res_ari_channels.c
index 8cb3388fe..fca0cef05 100644
--- a/res/res_ari_channels.c
+++ b/res/res_ari_channels.c
@@ -62,10 +62,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_list_args args = {};
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -174,11 +173,10 @@ int ast_ari_channels_originate_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_originate_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -226,21 +224,6 @@ static void ast_ari_channels_originate_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
args.variables = body;
ast_ari_channels_originate(headers, &args, response);
#if defined(AST_DEVMODE)
@@ -286,11 +269,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_get_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -402,11 +384,10 @@ int ast_ari_channels_originate_with_id_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_originate_with_id_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -457,21 +438,6 @@ static void ast_ari_channels_originate_with_id_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
args.variables = body;
ast_ari_channels_originate_with_id(headers, &args, response);
#if defined(AST_DEVMODE)
@@ -530,11 +496,10 @@ int ast_ari_channels_hangup_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_hangup_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -552,21 +517,6 @@ static void ast_ari_channels_hangup_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_hangup_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -640,11 +590,10 @@ int ast_ari_channels_continue_in_dialplan_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_continue_in_dialplan_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -671,21 +620,6 @@ static void ast_ari_channels_continue_in_dialplan_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_continue_in_dialplan_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -747,11 +681,10 @@ int ast_ari_channels_redirect_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_redirect_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -769,21 +702,6 @@ static void ast_ari_channels_redirect_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_redirect_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -834,11 +752,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_answer_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -894,11 +811,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_ring_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -954,11 +870,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_ring_stop_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1043,11 +958,10 @@ int ast_ari_channels_send_dtmf_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_send_dtmf_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1077,21 +991,6 @@ static void ast_ari_channels_send_dtmf_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_send_dtmf_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -1154,11 +1053,10 @@ int ast_ari_channels_mute_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_mute_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1176,21 +1074,6 @@ static void ast_ari_channels_mute_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_mute_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -1252,11 +1135,10 @@ int ast_ari_channels_unmute_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_unmute_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1274,21 +1156,6 @@ static void ast_ari_channels_unmute_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_unmute_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -1337,11 +1204,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_hold_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1397,11 +1263,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_unhold_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1470,11 +1335,10 @@ int ast_ari_channels_start_moh_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_start_moh_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1492,21 +1356,6 @@ static void ast_ari_channels_start_moh_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_start_moh_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -1555,11 +1404,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_stop_moh_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1615,11 +1463,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_start_silence_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1675,11 +1522,10 @@ fin: __attribute__((unused))
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_stop_silence_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1764,11 +1610,10 @@ int ast_ari_channels_play_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_play_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1798,21 +1643,6 @@ static void ast_ari_channels_play_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_play_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -1886,11 +1716,10 @@ int ast_ari_channels_play_with_id_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_play_with_id_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -1920,21 +1749,6 @@ static void ast_ari_channels_play_with_id_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_play_with_id_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -2020,11 +1834,10 @@ int ast_ari_channels_record_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_record_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -2060,21 +1873,6 @@ static void ast_ari_channels_record_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_record_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -2138,11 +1936,10 @@ int ast_ari_channels_get_channel_var_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_get_channel_var_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -2160,21 +1957,6 @@ static void ast_ari_channels_get_channel_var_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_get_channel_var_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -2241,11 +2023,10 @@ int ast_ari_channels_set_channel_var_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_set_channel_var_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -2266,21 +2047,6 @@ static void ast_ari_channels_set_channel_var_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_set_channel_var_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -2359,11 +2125,10 @@ int ast_ari_channels_snoop_channel_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_snoop_channel_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -2393,21 +2158,6 @@ static void ast_ari_channels_snoop_channel_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_snoop_channel_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -2481,11 +2231,10 @@ int ast_ari_channels_snoop_channel_with_id_parse_body(
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_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_channels_snoop_channel_with_id_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -2515,21 +2264,6 @@ static void ast_ari_channels_snoop_channel_with_id_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_channels_snoop_channel_with_id_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;