mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
ari: expose channel driver's unique id to ARI channel resource
This change exposes the channel driver's unique id (i.e. the Call-ID for chan_sip/chan_pjsip based channels) to ARI channel resources as `protocol_id`. ASTERISK-30027 Reported by: Moritz Fain Tested by: Moritz Fain Change-Id: I7cc6e7a9d29efe74bc27811d788dac20fe559b87
This commit is contained in:
@@ -1043,6 +1043,7 @@ int ast_ari_validate_channel(struct ast_json *json)
|
||||
int has_id = 0;
|
||||
int has_language = 0;
|
||||
int has_name = 0;
|
||||
int has_protocol_id = 0;
|
||||
int has_state = 0;
|
||||
|
||||
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
||||
@@ -1135,6 +1136,16 @@ int ast_ari_validate_channel(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("protocol_id", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_protocol_id = 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 protocol_id failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_state = 1;
|
||||
@@ -1193,6 +1204,11 @@ int ast_ari_validate_channel(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_protocol_id) {
|
||||
ast_log(LOG_ERROR, "ARI Channel missing required field protocol_id\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_state) {
|
||||
ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
|
||||
res = 0;
|
||||
|
@@ -1353,6 +1353,7 @@ ari_validator ast_ari_validate_application_fn(void);
|
||||
* - id: string (required)
|
||||
* - language: string (required)
|
||||
* - name: string (required)
|
||||
* - protocol_id: string (required)
|
||||
* - state: string (required)
|
||||
* Dialed
|
||||
* DialplanCEP
|
||||
|
Reference in New Issue
Block a user