[asterisk-commits] file: trunk r403241 - in /trunk: ./ res/ari/ rest-api/api-docs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 30 08:12:52 CST 2013


Author: file
Date: Sat Nov 30 08:12:50 2013
New Revision: 403241

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403241
Log:
res_ari: Add Recording events to the validator.
........

Merged revisions 403240 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/ari/ari_model_validators.c
    trunk/res/ari/ari_model_validators.h
    trunk/rest-api/api-docs/events.json

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Sat Nov 30 08:12:50 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403175,403179,403207,403209,403221,403223
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403175,403179,403207,403209,403221,403223,403240

Modified: trunk/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.c?view=diff&rev=403241&r1=403240&r2=403241
==============================================================================
--- trunk/res/ari/ari_model_validators.c (original)
+++ trunk/res/ari/ari_model_validators.c Sat Nov 30 08:12:50 2013
@@ -3032,6 +3032,15 @@
 	if (strcmp("PlaybackStarted", discriminator) == 0) {
 		return ast_ari_validate_playback_started(json);
 	} else
+	if (strcmp("RecordingFailed", discriminator) == 0) {
+		return ast_ari_validate_recording_failed(json);
+	} else
+	if (strcmp("RecordingFinished", discriminator) == 0) {
+		return ast_ari_validate_recording_finished(json);
+	} else
+	if (strcmp("RecordingStarted", discriminator) == 0) {
+		return ast_ari_validate_recording_started(json);
+	} else
 	if (strcmp("StasisEnd", discriminator) == 0) {
 		return ast_ari_validate_stasis_end(json);
 	} else
@@ -3179,6 +3188,15 @@
 	if (strcmp("PlaybackStarted", discriminator) == 0) {
 		return ast_ari_validate_playback_started(json);
 	} else
+	if (strcmp("RecordingFailed", discriminator) == 0) {
+		return ast_ari_validate_recording_failed(json);
+	} else
+	if (strcmp("RecordingFinished", discriminator) == 0) {
+		return ast_ari_validate_recording_finished(json);
+	} else
+	if (strcmp("RecordingStarted", discriminator) == 0) {
+		return ast_ari_validate_recording_started(json);
+	} else
 	if (strcmp("StasisEnd", discriminator) == 0) {
 		return ast_ari_validate_stasis_end(json);
 	} else
@@ -3440,9 +3458,40 @@
 {
 	int res = 1;
 	struct ast_json_iter *iter;
+	int has_type = 0;
+	int has_application = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_type = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFailed field type failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_application = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFailed field application failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ast_ari_validate_date(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFailed field timestamp failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_recording = 1;
@@ -3461,6 +3510,16 @@
 		}
 	}
 
+	if (!has_type) {
+		ast_log(LOG_ERROR, "ARI RecordingFailed missing required field type\n");
+		res = 0;
+	}
+
+	if (!has_application) {
+		ast_log(LOG_ERROR, "ARI RecordingFailed missing required field application\n");
+		res = 0;
+	}
+
 	if (!has_recording) {
 		ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
 		res = 0;
@@ -3478,9 +3537,40 @@
 {
 	int res = 1;
 	struct ast_json_iter *iter;
+	int has_type = 0;
+	int has_application = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_type = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFinished field type failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_application = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFinished field application failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ast_ari_validate_date(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingFinished field timestamp failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_recording = 1;
@@ -3499,6 +3589,16 @@
 		}
 	}
 
+	if (!has_type) {
+		ast_log(LOG_ERROR, "ARI RecordingFinished missing required field type\n");
+		res = 0;
+	}
+
+	if (!has_application) {
+		ast_log(LOG_ERROR, "ARI RecordingFinished missing required field application\n");
+		res = 0;
+	}
+
 	if (!has_recording) {
 		ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
 		res = 0;
@@ -3516,9 +3616,40 @@
 {
 	int res = 1;
 	struct ast_json_iter *iter;
+	int has_type = 0;
+	int has_application = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_type = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingStarted field type failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_application = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingStarted field application failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ast_ari_validate_date(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI RecordingStarted field timestamp failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_recording = 1;
@@ -3535,6 +3666,16 @@
 				ast_json_object_iter_key(iter));
 			res = 0;
 		}
+	}
+
+	if (!has_type) {
+		ast_log(LOG_ERROR, "ARI RecordingStarted missing required field type\n");
+		res = 0;
+	}
+
+	if (!has_application) {
+		ast_log(LOG_ERROR, "ARI RecordingStarted missing required field application\n");
+		res = 0;
 	}
 
 	if (!has_recording) {

Modified: trunk/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.h?view=diff&rev=403241&r1=403240&r2=403241
==============================================================================
--- trunk/res/ari/ari_model_validators.h (original)
+++ trunk/res/ari/ari_model_validators.h Sat Nov 30 08:12:50 2013
@@ -1212,10 +1212,19 @@
  * - timestamp: Date
  * - playback: Playback (required)
  * RecordingFailed
+ * - type: string (required)
+ * - application: string (required)
+ * - timestamp: Date
  * - recording: LiveRecording (required)
  * RecordingFinished
+ * - type: string (required)
+ * - application: string (required)
+ * - timestamp: Date
  * - recording: LiveRecording (required)
  * RecordingStarted
+ * - type: string (required)
+ * - application: string (required)
+ * - timestamp: Date
  * - recording: LiveRecording (required)
  * StasisEnd
  * - type: string (required)

Modified: trunk/rest-api/api-docs/events.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/events.json?view=diff&rev=403241&r1=403240&r2=403241
==============================================================================
--- trunk/rest-api/api-docs/events.json (original)
+++ trunk/rest-api/api-docs/events.json Sat Nov 30 08:12:50 2013
@@ -79,6 +79,9 @@
 				"DeviceStateChanged",
 				"PlaybackStarted",
 				"PlaybackFinished",
+				"RecordingStarted",
+				"RecordingFinished",
+				"RecordingFailed",
 				"ApplicationReplaced",
 				"BridgeCreated",
 				"BridgeDestroyed",




More information about the asterisk-commits mailing list