mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
Merge "main/json.c: Added app_name, app_data to channel type"
This commit is contained in:
@@ -1287,11 +1287,33 @@ int ast_ari_validate_dialplan_cep(struct ast_json *json)
|
||||
{
|
||||
int res = 1;
|
||||
struct ast_json_iter *iter;
|
||||
int has_app_data = 0;
|
||||
int has_app_name = 0;
|
||||
int has_context = 0;
|
||||
int has_exten = 0;
|
||||
int has_priority = 0;
|
||||
|
||||
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
||||
if (strcmp("app_data", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_app_data = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI DialplanCEP field app_data failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("app_name", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_app_name = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI DialplanCEP field app_name failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_context = 1;
|
||||
@@ -1330,6 +1352,16 @@ int ast_ari_validate_dialplan_cep(struct ast_json *json)
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_app_data) {
|
||||
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_data\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_app_name) {
|
||||
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_name\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_context) {
|
||||
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
|
||||
res = 0;
|
||||
|
@@ -1499,6 +1499,8 @@ ari_validator ast_ari_validate_application_fn(void);
|
||||
* - state: string (required)
|
||||
* Dialed
|
||||
* DialplanCEP
|
||||
* - app_data: string (required)
|
||||
* - app_name: string (required)
|
||||
* - context: string (required)
|
||||
* - exten: string (required)
|
||||
* - priority: long (required)
|
||||
|
Reference in New Issue
Block a user