[Asterisk-code-review] ari: Update model validator based on addition of asterisk id. (asterisk[14])

Joshua Colp asteriskteam at digium.com
Tue Oct 18 11:51:45 CDT 2016


Joshua Colp has uploaded a new change for review. ( https://gerrit.asterisk.org/4144 )

Change subject: ari: Update model validator based on addition of asterisk_id.
......................................................................

ari: Update model validator based on addition of asterisk_id.

ASTERISK-26470

Change-Id: I9c386f7a1c7d969161b28f189eb6298bbc5b7541
---
M res/ari/ari_model_validators.c
M res/ari/ari_model_validators.h
2 files changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/4144/1

diff --git a/res/ari/ari_model_validators.c b/res/ari/ari_model_validators.c
index 57c79c9..633a94c 100644
--- a/res/ari/ari_model_validators.c
+++ b/res/ari/ari_model_validators.c
@@ -5510,6 +5510,15 @@
 	int has_playback = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI PlaybackContinuing field asterisk_id failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_type = 1;
diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h
index ffe82cc..0b08ce8 100644
--- a/res/ari/ari_model_validators.h
+++ b/res/ari/ari_model_validators.h
@@ -1720,6 +1720,7 @@
  * - endpoint: Endpoint (required)
  * - peer: Peer (required)
  * PlaybackContinuing
+ * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
  * - timestamp: Date

-- 
To view, visit https://gerrit.asterisk.org/4144
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c386f7a1c7d969161b28f189eb6298bbc5b7541
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list