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
This commit is contained in:
Kevin Harwell
2014-12-09 20:19:40 +00:00
parent 525c823b4b
commit 2f21f85c37
5 changed files with 27 additions and 2 deletions

View File

@@ -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;