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
parent 61585af9bd
commit 0d7012044a
7 changed files with 48 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;