mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
bridging: Give bridges a name and a known creator
Bridges have two new optional properties, a creator and a name. Certain consumers of bridges will automatically provide bridges that they create with these properties. Examples include app_bridgewait, res_parking, app_confbridge, and app_agent_pool. In addition, a name may now be provided as an argument to the POST function for creating new bridges via ARI. (closes issue AFS-47) Review: https://reviewboard.asterisk.org/r/3070/ ........ Merged revisions 404042 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -891,7 +891,9 @@ 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_creator = 0;
|
||||
int has_id = 0;
|
||||
int has_name = 0;
|
||||
int has_technology = 0;
|
||||
|
||||
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
||||
@@ -926,6 +928,16 @@ int ast_ari_validate_bridge(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_creator = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_id = 1;
|
||||
@@ -936,6 +948,16 @@ int ast_ari_validate_bridge(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_name = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_technology = 1;
|
||||
@@ -969,11 +991,21 @@ int ast_ari_validate_bridge(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_creator) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_id) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_name) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_technology) {
|
||||
ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
|
||||
res = 0;
|
||||
|
||||
Reference in New Issue
Block a user