Author: bebuild Date: Fri Dec 19 15:48:28 2014 New Revision: 429891 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=429891 Log: 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 ........ Merged revisions 429206 from http://svn.asterisk.org/svn/asterisk/branches/13 Modified: certified/branches/13.1/ (props changed) certified/branches/13.1/main/manager_channels.c certified/branches/13.1/main/stasis_channels.c certified/branches/13.1/res/ari/ari_model_validators.c certified/branches/13.1/res/ari/ari_model_validators.h certified/branches/13.1/rest-api/api-docs/channels.json Propchange: certified/branches/13.1/ ------------------------------------------------------------------------------ --- branch-13-merged (original) +++ branch-13-merged Fri Dec 19 15:48:28 2014 @@ -1,1 +1,1 @@ -/branches/13:429175,429196,429407,429409,429433,429477,429497,429540,429571,429739,429761,429829 +/branches/13:429175,429196,429206,429407,429409,429433,429477,429497,429540,429571,429739,429761,429829 Modified: certified/branches/13.1/main/manager_channels.c URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/main/manager_channels.c?view=diff&rev=429891&r1=429890&r2=429891 ============================================================================== --- certified/branches/13.1/main/manager_channels.c (original) +++ certified/branches/13.1/main/manager_channels.c Fri Dec 19 15:48:28 2014 @@ -426,6 +426,7 @@ "%sCallerIDName: %s\r\n" "%sConnectedLineNum: %s\r\n" "%sConnectedLineName: %s\r\n" + "%sLanguage: %s\r\n" "%sAccountCode: %s\r\n" "%sContext: %s\r\n" "%sExten: %s\r\n" @@ -438,6 +439,7 @@ prefix, S_OR(snapshot->caller_name, "<unknown>"), prefix, S_OR(snapshot->connected_number, "<unknown>"), prefix, S_OR(snapshot->connected_name, "<unknown>"), + prefix, snapshot->language, prefix, snapshot->accountcode, prefix, snapshot->context, prefix, snapshot->exten, Modified: certified/branches/13.1/main/stasis_channels.c URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/main/stasis_channels.c?view=diff&rev=429891&r1=429890&r2=429891 ============================================================================== --- certified/branches/13.1/main/stasis_channels.c (original) +++ certified/branches/13.1/main/stasis_channels.c Fri Dec 19 15:48:28 2014 @@ -888,7 +888,7 @@ /* Broken up into groups of three for readability */ "{ s: s, s: s, s: s," " s: o, s: o, s: s," - " s: o, s: o }", + " s: o, s: o, s: s }", /* First line */ "id", snapshot->uniqueid, "name", snapshot->name, @@ -902,7 +902,8 @@ /* Third line */ "dialplan", ast_json_dialplan_cep( snapshot->context, snapshot->exten, snapshot->priority), - "creationtime", ast_json_timeval(snapshot->creationtime, NULL)); + "creationtime", ast_json_timeval(snapshot->creationtime, NULL), + "language", snapshot->language); return ast_json_ref(json_chan); } Modified: certified/branches/13.1/res/ari/ari_model_validators.c URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/res/ari/ari_model_validators.c?view=diff&rev=429891&r1=429890&r2=429891 ============================================================================== --- certified/branches/13.1/res/ari/ari_model_validators.c (original) +++ certified/branches/13.1/res/ari/ari_model_validators.c Fri Dec 19 15:48:28 2014 @@ -786,6 +786,7 @@ 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 @@ 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; @@ -905,6 +916,11 @@ if (!has_id) { ast_log(LOG_ERROR, "ARI Channel missing required field id\n"); + res = 0; + } + + if (!has_language) { + ast_log(LOG_ERROR, "ARI Channel missing required field language\n"); res = 0; } Modified: certified/branches/13.1/res/ari/ari_model_validators.h URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/res/ari/ari_model_validators.h?view=diff&rev=429891&r1=429890&r2=429891 ============================================================================== --- certified/branches/13.1/res/ari/ari_model_validators.h (original) +++ certified/branches/13.1/res/ari/ari_model_validators.h Fri Dec 19 15:48:28 2014 @@ -1242,6 +1242,7 @@ * - creationtime: Date (required) * - dialplan: DialplanCEP (required) * - id: string (required) + * - language: string (required) * - name: string (required) * - state: string (required) * Dialed Modified: certified/branches/13.1/rest-api/api-docs/channels.json URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/rest-api/api-docs/channels.json?view=diff&rev=429891&r1=429890&r2=429891 ============================================================================== --- certified/branches/13.1/rest-api/api-docs/channels.json (original) +++ certified/branches/13.1/rest-api/api-docs/channels.json Fri Dec 19 15:48:28 2014 @@ -1449,6 +1449,11 @@ "required": true, "type": "Date", "description": "Timestamp when channel was created" + }, + "language": { + "required": true, + "type": "string", + "description": "The default spoken language" } } } -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
