@ -59,10 +59,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_list_args args = { } ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -108,11 +110,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_originate_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -145,6 +150,54 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " endpoint " ) ;
if ( field ) {
args . endpoint = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " extension " ) ;
if ( field ) {
args . extension = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " context " ) ;
if ( field ) {
args . context = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " priority " ) ;
if ( field ) {
args . priority = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " app " ) ;
if ( field ) {
args . app = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " appArgs " ) ;
if ( field ) {
args . app_args = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " callerId " ) ;
if ( field ) {
args . caller_id = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " timeout " ) ;
if ( field ) {
args . timeout = ast_json_integer_get ( field ) ;
}
ast_ari_channels_originate ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -186,11 +239,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -243,11 +298,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_hangup_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -265,6 +323,26 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " reason " ) ;
if ( field ) {
args . reason = ast_json_string_get ( field ) ;
}
ast_ari_channels_hangup ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -307,11 +385,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_continue_in_dialplan_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -335,6 +416,34 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " context " ) ;
if ( field ) {
args . context = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " extension " ) ;
if ( field ) {
args . extension = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " priority " ) ;
if ( field ) {
args . priority = ast_json_integer_get ( field ) ;
}
ast_ari_channels_continue_in_dialplan ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -377,11 +486,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -435,11 +546,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -493,11 +606,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -551,11 +666,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_send_dtmf_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -585,6 +703,42 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " dtmf " ) ;
if ( field ) {
args . dtmf = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " before " ) ;
if ( field ) {
args . before = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " between " ) ;
if ( field ) {
args . between = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " duration " ) ;
if ( field ) {
args . duration = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " after " ) ;
if ( field ) {
args . after = ast_json_integer_get ( field ) ;
}
ast_ari_channels_send_dtmf ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -628,11 +782,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_mute_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -650,6 +807,26 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " direction " ) ;
if ( field ) {
args . direction = ast_json_string_get ( field ) ;
}
ast_ari_channels_mute ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -692,11 +869,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_unmute_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -714,6 +894,26 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " direction " ) ;
if ( field ) {
args . direction = ast_json_string_get ( field ) ;
}
ast_ari_channels_unmute ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -756,11 +956,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -814,11 +1016,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -872,11 +1076,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_start_moh_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -894,6 +1101,26 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " mohClass " ) ;
if ( field ) {
args . moh_class = ast_json_string_get ( field ) ;
}
ast_ari_channels_start_moh ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -936,11 +1163,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -994,11 +1223,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -1052,11 +1283,13 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_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 ;
@ -1110,11 +1343,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_play_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -1141,6 +1377,38 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " media " ) ;
if ( field ) {
args . media = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " lang " ) ;
if ( field ) {
args . lang = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " offsetms " ) ;
if ( field ) {
args . offsetms = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " skipms " ) ;
if ( field ) {
args . skipms = ast_json_integer_get ( field ) ;
}
ast_ari_channels_play ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -1183,11 +1451,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_record_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -1223,6 +1494,50 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " name " ) ;
if ( field ) {
args . name = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " format " ) ;
if ( field ) {
args . format = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " maxDurationSeconds " ) ;
if ( field ) {
args . max_duration_seconds = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " maxSilenceSeconds " ) ;
if ( field ) {
args . max_silence_seconds = ast_json_integer_get ( field ) ;
}
field = ast_json_object_get ( body , " ifExists " ) ;
if ( field ) {
args . if_exists = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " beep " ) ;
if ( field ) {
args . beep = ast_json_is_true ( field ) ;
}
field = ast_json_object_get ( body , " terminateOn " ) ;
if ( field ) {
args . terminate_on = ast_json_string_get ( field ) ;
}
ast_ari_channels_record ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -1267,11 +1582,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_get_channel_var_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -1289,6 +1607,26 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " variable " ) ;
if ( field ) {
args . variable = ast_json_string_get ( field ) ;
}
ast_ari_channels_get_channel_var ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -1332,11 +1670,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_set_channel_var_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -1357,6 +1698,30 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " variable " ) ;
if ( field ) {
args . variable = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " value " ) ;
if ( field ) {
args . value = ast_json_string_get ( field ) ;
}
ast_ari_channels_set_channel_var ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;
@ -1400,11 +1765,14 @@ fin: __attribute__((unused))
* \ param [ out ] response Response to the HTTP request .
*/
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_ari_channels_snoop_channel_args args = { } ;
struct ast_variable * i ;
RAII_VAR ( struct ast_json * , body , NULL , ast_json_unref ) ;
struct ast_json * field ;
# if defined(AST_DEVMODE)
int is_valid ;
int code ;
@ -1431,6 +1799,38 @@ 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 ;
}
}
/* Parse query parameters out of it */
field = ast_json_object_get ( body , " spy " ) ;
if ( field ) {
args . spy = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " whisper " ) ;
if ( field ) {
args . whisper = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " app " ) ;
if ( field ) {
args . app = ast_json_string_get ( field ) ;
}
field = ast_json_object_get ( body , " appArgs " ) ;
if ( field ) {
args . app_args = ast_json_string_get ( field ) ;
}
ast_ari_channels_snoop_channel ( headers , & args , response ) ;
# if defined(AST_DEVMODE)
code = response - > response_code ;