bridging: Add creation timestamps

This small feature will help to checking the bridge's status to
figure out which bridge is in old/zombie or not. Also added
detail items for the 'bridge show *' cli to provide more detail
info. And added creation item to the ARI as well.

ASTERISK-28279

Change-Id: I460238c488eca4d216b9176576211cb03286e040
This commit is contained in:
sungtae kim
2019-02-08 22:32:18 +01:00
committed by sungtae kim
parent 8f9ffe5905
commit 3638c433ac
6 changed files with 49 additions and 5 deletions

View File

@@ -1360,6 +1360,7 @@ int ast_ari_validate_bridge(struct ast_json *json)
int has_bridge_class = 0;
int has_bridge_type = 0;
int has_channels = 0;
int has_creationtime = 0;
int has_creator = 0;
int has_id = 0;
int has_name = 0;
@@ -1397,6 +1398,16 @@ int ast_ari_validate_bridge(struct ast_json *json)
res = 0;
}
} else
if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_creationtime = 1;
prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field creationtime failed validation\n");
res = 0;
}
} else
if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_creator = 1;
@@ -1478,6 +1489,11 @@ int ast_ari_validate_bridge(struct ast_json *json)
res = 0;
}
if (!has_creationtime) {
ast_log(LOG_ERROR, "ARI Bridge missing required field creationtime\n");
res = 0;
}
if (!has_creator) {
ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
res = 0;

View File

@@ -1488,6 +1488,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - bridge_class: string (required)
* - bridge_type: string (required)
* - channels: List[string] (required)
* - creationtime: Date (required)
* - creator: string (required)
* - id: string (required)
* - name: string (required)