[asterisk-commits] file: branch 12 r403240 - in /branches/12: res/ari/ rest-api/api-docs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Nov 30 08:12:03 CST 2013
Author: file
Date: Sat Nov 30 08:11:55 2013
New Revision: 403240
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403240
Log:
res_ari: Add Recording events to the validator.
Modified:
branches/12/res/ari/ari_model_validators.c
branches/12/res/ari/ari_model_validators.h
branches/12/rest-api/api-docs/events.json
Modified: branches/12/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/ari/ari_model_validators.c?view=diff&rev=403240&r1=403239&r2=403240
==============================================================================
--- branches/12/res/ari/ari_model_validators.c (original)
+++ branches/12/res/ari/ari_model_validators.c Sat Nov 30 08:11:55 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: branches/12/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/ari/ari_model_validators.h?view=diff&rev=403240&r1=403239&r2=403240
==============================================================================
--- branches/12/res/ari/ari_model_validators.h (original)
+++ branches/12/res/ari/ari_model_validators.h Sat Nov 30 08:11:55 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: branches/12/rest-api/api-docs/events.json
URL: http://svnview.digium.com/svn/asterisk/branches/12/rest-api/api-docs/events.json?view=diff&rev=403240&r1=403239&r2=403240
==============================================================================
--- branches/12/rest-api/api-docs/events.json (original)
+++ branches/12/rest-api/api-docs/events.json Sat Nov 30 08:11:55 2013
@@ -79,6 +79,9 @@
"DeviceStateChanged",
"PlaybackStarted",
"PlaybackFinished",
+ "RecordingStarted",
+ "RecordingFinished",
+ "RecordingFailed",
"ApplicationReplaced",
"BridgeCreated",
"BridgeDestroyed",
More information about the asterisk-commits
mailing list