mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
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:
@@ -426,6 +426,7 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
|
|||||||
"%sCallerIDName: %s\r\n"
|
"%sCallerIDName: %s\r\n"
|
||||||
"%sConnectedLineNum: %s\r\n"
|
"%sConnectedLineNum: %s\r\n"
|
||||||
"%sConnectedLineName: %s\r\n"
|
"%sConnectedLineName: %s\r\n"
|
||||||
|
"%sLanguage: %s\r\n"
|
||||||
"%sAccountCode: %s\r\n"
|
"%sAccountCode: %s\r\n"
|
||||||
"%sContext: %s\r\n"
|
"%sContext: %s\r\n"
|
||||||
"%sExten: %s\r\n"
|
"%sExten: %s\r\n"
|
||||||
@@ -438,6 +439,7 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
|
|||||||
prefix, S_OR(snapshot->caller_name, "<unknown>"),
|
prefix, S_OR(snapshot->caller_name, "<unknown>"),
|
||||||
prefix, S_OR(snapshot->connected_number, "<unknown>"),
|
prefix, S_OR(snapshot->connected_number, "<unknown>"),
|
||||||
prefix, S_OR(snapshot->connected_name, "<unknown>"),
|
prefix, S_OR(snapshot->connected_name, "<unknown>"),
|
||||||
|
prefix, snapshot->language,
|
||||||
prefix, snapshot->accountcode,
|
prefix, snapshot->accountcode,
|
||||||
prefix, snapshot->context,
|
prefix, snapshot->context,
|
||||||
prefix, snapshot->exten,
|
prefix, snapshot->exten,
|
||||||
|
@@ -888,7 +888,7 @@ struct ast_json *ast_channel_snapshot_to_json(
|
|||||||
/* Broken up into groups of three for readability */
|
/* Broken up into groups of three for readability */
|
||||||
"{ s: s, s: s, s: s,"
|
"{ s: s, s: s, s: s,"
|
||||||
" s: o, s: o, s: s,"
|
" s: o, s: o, s: s,"
|
||||||
" s: o, s: o }",
|
" s: o, s: o, s: s }",
|
||||||
/* First line */
|
/* First line */
|
||||||
"id", snapshot->uniqueid,
|
"id", snapshot->uniqueid,
|
||||||
"name", snapshot->name,
|
"name", snapshot->name,
|
||||||
@@ -902,7 +902,8 @@ struct ast_json *ast_channel_snapshot_to_json(
|
|||||||
/* Third line */
|
/* Third line */
|
||||||
"dialplan", ast_json_dialplan_cep(
|
"dialplan", ast_json_dialplan_cep(
|
||||||
snapshot->context, snapshot->exten, snapshot->priority),
|
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);
|
return ast_json_ref(json_chan);
|
||||||
}
|
}
|
||||||
|
@@ -786,6 +786,7 @@ int ast_ari_validate_channel(struct ast_json *json)
|
|||||||
int has_creationtime = 0;
|
int has_creationtime = 0;
|
||||||
int has_dialplan = 0;
|
int has_dialplan = 0;
|
||||||
int has_id = 0;
|
int has_id = 0;
|
||||||
|
int has_language = 0;
|
||||||
int has_name = 0;
|
int has_name = 0;
|
||||||
int has_state = 0;
|
int has_state = 0;
|
||||||
|
|
||||||
@@ -850,6 +851,16 @@ int ast_ari_validate_channel(struct ast_json *json)
|
|||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
} else
|
} 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) {
|
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
|
||||||
int prop_is_valid;
|
int prop_is_valid;
|
||||||
has_name = 1;
|
has_name = 1;
|
||||||
@@ -908,6 +919,11 @@ int ast_ari_validate_channel(struct ast_json *json)
|
|||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!has_language) {
|
||||||
|
ast_log(LOG_ERROR, "ARI Channel missing required field language\n");
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!has_name) {
|
if (!has_name) {
|
||||||
ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
|
ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
|
||||||
res = 0;
|
res = 0;
|
||||||
|
@@ -1242,6 +1242,7 @@ ari_validator ast_ari_validate_application_fn(void);
|
|||||||
* - creationtime: Date (required)
|
* - creationtime: Date (required)
|
||||||
* - dialplan: DialplanCEP (required)
|
* - dialplan: DialplanCEP (required)
|
||||||
* - id: string (required)
|
* - id: string (required)
|
||||||
|
* - language: string (required)
|
||||||
* - name: string (required)
|
* - name: string (required)
|
||||||
* - state: string (required)
|
* - state: string (required)
|
||||||
* Dialed
|
* Dialed
|
||||||
|
@@ -1465,6 +1465,11 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"type": "Date",
|
"type": "Date",
|
||||||
"description": "Timestamp when channel was created"
|
"description": "Timestamp when channel was created"
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"description": "The default spoken language"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user