|
|
|
@ -1552,6 +1552,373 @@ ari_validator ast_ari_validate_application_replaced_fn(void)
|
|
|
|
|
return ast_ari_validate_application_replaced;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
|
|
|
|
|
{
|
|
|
|
|
int res = 1;
|
|
|
|
|
struct ast_json_iter *iter;
|
|
|
|
|
int has_type = 0;
|
|
|
|
|
int has_application = 0;
|
|
|
|
|
int has_destination_type = 0;
|
|
|
|
|
int has_is_external = 0;
|
|
|
|
|
int has_result = 0;
|
|
|
|
|
int has_transferer_first_leg = 0;
|
|
|
|
|
int has_transferer_second_leg = 0;
|
|
|
|
|
|
|
|
|
|
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
|
|
|
|
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_type = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_application = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_date(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_bridge(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_destination_type = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_is_external = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_boolean(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_result = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_transferer_first_leg = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_bridge(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_transferer_second_leg = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_bridge(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
|
"ARI BridgeAttendedTransfer has undocumented field %s\n",
|
|
|
|
|
ast_json_object_iter_key(iter));
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_type) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_application) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_destination_type) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_is_external) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_result) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_transferer_first_leg) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_transferer_second_leg) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
|
|
|
|
|
{
|
|
|
|
|
return ast_ari_validate_bridge_attended_transfer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
|
|
|
|
|
{
|
|
|
|
|
int res = 1;
|
|
|
|
|
struct ast_json_iter *iter;
|
|
|
|
|
int has_type = 0;
|
|
|
|
|
int has_application = 0;
|
|
|
|
|
int has_channel = 0;
|
|
|
|
|
int has_context = 0;
|
|
|
|
|
int has_exten = 0;
|
|
|
|
|
int has_is_external = 0;
|
|
|
|
|
int has_result = 0;
|
|
|
|
|
|
|
|
|
|
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
|
|
|
|
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_type = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_application = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_date(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
prop_is_valid = ast_ari_validate_bridge(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_channel = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_channel(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_context = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_exten = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_is_external = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_boolean(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
|
|
|
|
|
int prop_is_valid;
|
|
|
|
|
has_result = 1;
|
|
|
|
|
prop_is_valid = ast_ari_validate_string(
|
|
|
|
|
ast_json_object_iter_value(iter));
|
|
|
|
|
if (!prop_is_valid) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
|
"ARI BridgeBlindTransfer has undocumented field %s\n",
|
|
|
|
|
ast_json_object_iter_key(iter));
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_type) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_application) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_channel) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_context) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_exten) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_is_external) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_result) {
|
|
|
|
|
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
|
|
|
|
|
{
|
|
|
|
|
return ast_ari_validate_bridge_blind_transfer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ast_ari_validate_bridge_created(struct ast_json *json)
|
|
|
|
|
{
|
|
|
|
|
int res = 1;
|
|
|
|
@ -3211,6 +3578,12 @@ int ast_ari_validate_event(struct ast_json *json)
|
|
|
|
|
if (strcmp("ApplicationReplaced", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_application_replaced(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_attended_transfer(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_blind_transfer(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeCreated", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_created(json);
|
|
|
|
|
} else
|
|
|
|
@ -3364,6 +3737,12 @@ int ast_ari_validate_message(struct ast_json *json)
|
|
|
|
|
if (strcmp("ApplicationReplaced", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_application_replaced(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_attended_transfer(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_blind_transfer(json);
|
|
|
|
|
} else
|
|
|
|
|
if (strcmp("BridgeCreated", discriminator) == 0) {
|
|
|
|
|
return ast_ari_validate_bridge_created(json);
|
|
|
|
|
} else
|
|
|
|
|