diff options
author | Kevin Harwell <kharwell@digium.com> | 2014-12-09 20:19:40 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2014-12-09 20:19:40 +0000 |
commit | 2f21f85c3733ff633937549c3ba8983df0636dce (patch) | |
tree | 947d5e0ef279ca153fc3dbb27ed39a3663ced829 /res/ari/ari_model_validators.c | |
parent | 525c823b4b7e63dc74669ebb5284397713804c75 (diff) |
ARI/AMI: Include language in standard channel snapshot output
The channel "language" was already part of a channel snapshot, however is was
not sent out over AMI or ARI. This patch makes it so the channel "language" is
included in the appropriate AMI or ARI events.
ASTERISK-24553 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4245/
........
Merged revisions 429204 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@429206 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari/ari_model_validators.c')
-rw-r--r-- | res/ari/ari_model_validators.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/res/ari/ari_model_validators.c b/res/ari/ari_model_validators.c index 9b5671a76..491a4cca1 100644 --- a/res/ari/ari_model_validators.c +++ b/res/ari/ari_model_validators.c @@ -786,6 +786,7 @@ int ast_ari_validate_channel(struct ast_json *json) int has_creationtime = 0; int has_dialplan = 0; int has_id = 0; + int has_language = 0; int has_name = 0; int has_state = 0; @@ -850,6 +851,16 @@ int ast_ari_validate_channel(struct ast_json *json) res = 0; } } else + if (strcmp("language", ast_json_object_iter_key(iter)) == 0) { + int prop_is_valid; + has_language = 1; + prop_is_valid = ast_ari_validate_string( + ast_json_object_iter_value(iter)); + if (!prop_is_valid) { + ast_log(LOG_ERROR, "ARI Channel field language failed validation\n"); + res = 0; + } + } else if (strcmp("name", ast_json_object_iter_key(iter)) == 0) { int prop_is_valid; has_name = 1; @@ -908,6 +919,11 @@ int ast_ari_validate_channel(struct ast_json *json) res = 0; } + if (!has_language) { + ast_log(LOG_ERROR, "ARI Channel missing required field language\n"); + res = 0; + } + if (!has_name) { ast_log(LOG_ERROR, "ARI Channel missing required field name\n"); res = 0; |