[Asterisk-code-review] res/res_ari: Added timestamp as a requirement for all ARI events (...asterisk[16])

Friendly Automation asteriskteam at digium.com
Tue Mar 26 08:52:46 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11175 )

Change subject: res/res_ari: Added timestamp as a requirement for all ARI events
......................................................................

res/res_ari: Added timestamp as a requirement for all ARI events

Changed to requirement to having timestamp for all of ARI events.
The below ARI events were changed to having timestamp.
PlaybackStarted, PlaybackContinuing, PlaybackFinished,
RecordingStarted, RecordingFinished, RecordingFailed,
ApplicationReplaced, ApplicationMoveFailed

ASTERISK-28326

Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
---
M res/ari/ari_model_validators.c
M res/ari/ari_model_validators.h
M res/res_stasis.c
M res/res_stasis_playback.c
M res/res_stasis_recording.c
M res/stasis/app.c
M rest-api/api-docs/events.json
M tests/test_res_stasis.c
8 files changed, 335 insertions(+), 58 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/ari/ari_model_validators.c b/res/ari/ari_model_validators.c
index d5f1885..bc7ac6b 100644
--- a/res/ari/ari_model_validators.c
+++ b/res/ari/ari_model_validators.c
@@ -2171,6 +2171,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 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) {
@@ -2204,6 +2205,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2229,6 +2231,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field timestamp\n");
+		res = 0;
+	}
+
 	return res;
 }
 
@@ -2243,6 +2250,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_destination_type = 0;
 	int has_is_external = 0;
 	int has_result = 0;
@@ -2281,6 +2289,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2455,6 +2464,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_destination_type) {
 		ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
 		res = 0;
@@ -2494,6 +2508,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 	int has_context = 0;
 	int has_exten = 0;
@@ -2532,6 +2547,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2634,6 +2650,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
 		res = 0;
@@ -2673,6 +2694,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2707,6 +2729,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2742,6 +2765,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeCreated missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
 		res = 0;
@@ -2761,6 +2789,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2795,6 +2824,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2830,6 +2860,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
 		res = 0;
@@ -2849,6 +2884,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 	int has_bridge_from = 0;
 
@@ -2884,6 +2920,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -2929,6 +2966,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeMerged missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
 		res = 0;
@@ -2953,6 +2995,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2987,6 +3030,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3031,6 +3075,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
 		res = 0;
@@ -3050,6 +3099,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_caller_presentation = 0;
 	int has_caller_presentation_txt = 0;
 	int has_channel = 0;
@@ -3086,6 +3136,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3141,6 +3192,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_caller_presentation) {
 		ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
 		res = 0;
@@ -3170,6 +3226,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3204,6 +3261,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3239,6 +3297,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
 		res = 0;
@@ -3258,6 +3321,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3292,6 +3356,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3327,6 +3392,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelCreated missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
 		res = 0;
@@ -3346,6 +3416,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_cause = 0;
 	int has_cause_txt = 0;
 	int has_channel = 0;
@@ -3382,6 +3453,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3437,6 +3509,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_cause) {
 		ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
 		res = 0;
@@ -3466,6 +3543,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 	int has_dialplan_app = 0;
 	int has_dialplan_app_data = 0;
@@ -3502,6 +3580,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3557,6 +3636,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
 		res = 0;
@@ -3586,6 +3670,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 	int has_digit = 0;
 	int has_duration_ms = 0;
@@ -3622,6 +3707,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3677,6 +3763,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
 		res = 0;
@@ -3706,6 +3797,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3740,6 +3832,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3784,6 +3877,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
 		res = 0;
@@ -3803,6 +3901,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3837,6 +3936,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3890,6 +3990,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
 		res = 0;
@@ -3909,6 +4014,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3943,6 +4049,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -3987,6 +4094,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelHold missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
 		res = 0;
@@ -4006,6 +4118,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_bridge = 0;
 	int has_channel = 0;
 
@@ -4041,6 +4154,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4086,6 +4200,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_bridge) {
 		ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
 		res = 0;
@@ -4110,6 +4229,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4144,6 +4264,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4179,6 +4300,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
 		res = 0;
@@ -4198,6 +4324,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 	int has_duration = 0;
 
@@ -4233,6 +4360,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4278,6 +4406,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
 		res = 0;
@@ -4302,6 +4435,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4336,6 +4470,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4371,6 +4506,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
 		res = 0;
@@ -4390,6 +4530,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4424,6 +4565,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4459,6 +4601,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
 		res = 0;
@@ -4478,6 +4625,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_eventname = 0;
 	int has_userevent = 0;
 
@@ -4513,6 +4661,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4585,6 +4734,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_eventname) {
 		ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
 		res = 0;
@@ -4609,6 +4763,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_value = 0;
 	int has_variable = 0;
 
@@ -4644,6 +4799,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4698,6 +4854,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ChannelVarset missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_value) {
 		ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
 		res = 0;
@@ -4801,6 +4962,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_contact_info = 0;
 	int has_endpoint = 0;
 
@@ -4836,6 +4998,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4881,6 +5044,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_contact_info) {
 		ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n");
 		res = 0;
@@ -4905,6 +5073,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_device_state = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4939,6 +5108,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -4974,6 +5144,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_device_state) {
 		ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
 		res = 0;
@@ -4993,6 +5168,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_dialstatus = 0;
 	int has_peer = 0;
 
@@ -5028,6 +5204,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -5109,6 +5286,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI Dial missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_dialstatus) {
 		ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
 		res = 0;
@@ -5133,6 +5315,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_endpoint = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5167,6 +5350,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -5202,6 +5386,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_endpoint) {
 		ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
 		res = 0;
@@ -5221,6 +5410,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	const char *discriminator;
 
 	discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
@@ -5384,6 +5574,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -5409,6 +5600,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI Event missing required field timestamp\n");
+		res = 0;
+	}
+
 	return res;
 }
 
@@ -5744,6 +5940,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_endpoint = 0;
 	int has_peer = 0;
 
@@ -5779,6 +5976,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -5824,6 +6022,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_endpoint) {
 		ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n");
 		res = 0;
@@ -5848,6 +6051,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_playback = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5882,6 +6086,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -5917,6 +6122,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_playback) {
 		ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n");
 		res = 0;
@@ -5936,6 +6146,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_playback = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5970,6 +6181,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6005,6 +6217,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_playback) {
 		ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
 		res = 0;
@@ -6024,6 +6241,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_playback = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6058,6 +6276,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6093,6 +6312,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_playback) {
 		ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
 		res = 0;
@@ -6112,6 +6336,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6146,6 +6371,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6181,6 +6407,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI RecordingFailed missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_recording) {
 		ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
 		res = 0;
@@ -6200,6 +6431,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6234,6 +6466,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6269,6 +6502,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI RecordingFinished missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_recording) {
 		ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
 		res = 0;
@@ -6288,6 +6526,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_recording = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6322,6 +6561,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6357,6 +6597,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI RecordingStarted missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_recording) {
 		ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
 		res = 0;
@@ -6376,6 +6621,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_channel = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6410,6 +6656,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6445,6 +6692,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI StasisEnd missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_channel) {
 		ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
 		res = 0;
@@ -6464,6 +6716,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_args = 0;
 	int has_channel = 0;
 
@@ -6499,6 +6752,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6554,6 +6808,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI StasisStart missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_args) {
 		ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
 		res = 0;
@@ -6578,6 +6837,7 @@
 	struct ast_json_iter *iter;
 	int has_type = 0;
 	int has_application = 0;
+	int has_timestamp = 0;
 	int has_message = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6612,6 +6872,7 @@
 		} else
 		if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
+			has_timestamp = 1;
 			prop_is_valid = ast_ari_validate_date(
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
@@ -6656,6 +6917,11 @@
 		res = 0;
 	}
 
+	if (!has_timestamp) {
+		ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field timestamp\n");
+		res = 0;
+	}
+
 	if (!has_message) {
 		ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
 		res = 0;
diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h
index 484f9c1..8fa28bc 100644
--- a/res/ari/ari_model_validators.h
+++ b/res/ari/ari_model_validators.h
@@ -1558,12 +1558,12 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * BridgeAttendedTransfer
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - destination_application: string
  * - destination_bridge: string
  * - destination_link_first_leg: Channel
@@ -1584,7 +1584,7 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge
  * - channel: Channel (required)
  * - context: string (required)
@@ -1597,33 +1597,33 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * BridgeDestroyed
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * BridgeMerged
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * - bridge_from: Bridge (required)
  * BridgeVideoSourceChanged
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * - old_video_source_id: string
  * ChannelCallerId
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - caller_presentation: int (required)
  * - caller_presentation_txt: string (required)
  * - channel: Channel (required)
@@ -1631,19 +1631,19 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * ChannelCreated
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * ChannelDestroyed
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - cause: int (required)
  * - cause_txt: string (required)
  * - channel: Channel (required)
@@ -1651,7 +1651,7 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * - dialplan_app: string (required)
  * - dialplan_app_data: string (required)
@@ -1659,7 +1659,7 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * - digit: string (required)
  * - duration_ms: int (required)
@@ -1667,14 +1667,14 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * - channel: Channel
  * ChannelHangupRequest
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - cause: int
  * - channel: Channel (required)
  * - soft: boolean
@@ -1682,46 +1682,46 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * - musicclass: string
  * ChannelLeftBridge
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge (required)
  * - channel: Channel (required)
  * ChannelStateChange
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * ChannelTalkingFinished
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * - duration: int (required)
  * ChannelTalkingStarted
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * ChannelUnhold
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * ChannelUserevent
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - bridge: Bridge
  * - channel: Channel
  * - endpoint: Endpoint
@@ -1731,7 +1731,7 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel
  * - value: string (required)
  * - variable: string (required)
@@ -1744,20 +1744,20 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - contact_info: ContactInfo (required)
  * - endpoint: Endpoint (required)
  * DeviceStateChanged
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - device_state: DeviceState (required)
  * Dial
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - caller: Channel
  * - dialstatus: string (required)
  * - dialstring: string
@@ -1768,13 +1768,13 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - endpoint: Endpoint (required)
  * Event
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * Message
  * - asterisk_id: string
  * - type: string (required)
@@ -1792,56 +1792,56 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - endpoint: Endpoint (required)
  * - peer: Peer (required)
  * PlaybackContinuing
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - playback: Playback (required)
  * PlaybackFinished
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - playback: Playback (required)
  * PlaybackStarted
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - playback: Playback (required)
  * RecordingFailed
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - recording: LiveRecording (required)
  * RecordingFinished
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - recording: LiveRecording (required)
  * RecordingStarted
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - recording: LiveRecording (required)
  * StasisEnd
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - channel: Channel (required)
  * StasisStart
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - args: List[string] (required)
  * - channel: Channel (required)
  * - replace_channel: Channel
@@ -1849,7 +1849,7 @@
  * - asterisk_id: string
  * - type: string (required)
  * - application: string (required)
- * - timestamp: Date
+ * - timestamp: Date (required)
  * - endpoint: Endpoint
  * - message: TextMessage (required)
  * Application
diff --git a/res/res_stasis.c b/res/res_stasis.c
index 25e2fe9..5cc758c 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1470,30 +1470,35 @@
 					int next_argc = control_next_app_args_size(control);
 					char **next_argv = control_next_app_args(control);
 
-					msg = ast_json_pack("{s: s, s: o, s: s, s: []}",
+					msg = ast_json_pack("{s: s, s: o, s: o, s: s, s: []}",
 						"type", "ApplicationMoveFailed",
+						"timestamp", ast_json_timeval(ast_tvnow(), NULL),
 						"channel", ast_channel_snapshot_to_json(snapshot, NULL),
 						"destination", control_next_app(control),
 						"args");
-					json_args = ast_json_object_get(msg, "args");
-					if (!json_args) {
-						ast_log(LOG_ERROR, "Could not get args json array");
+					if (!msg) {
+						ast_log(LOG_ERROR, "Failed to pack JSON for ApplicationMoveFailed message\n");
 					} else {
-						int r = 0;
-						int idx;
-						for (idx = 0; idx < next_argc; ++idx) {
-							r = ast_json_array_append(json_args,
-								ast_json_string_create(next_argv[idx]));
-							if (r != 0) {
-								ast_log(LOG_ERROR, "Error appending to ApplicationMoveFailed message\n");
-								break;
+						json_args = ast_json_object_get(msg, "args");
+						if (!json_args) {
+							ast_log(LOG_ERROR, "Could not get args json array");
+						} else {
+							int r = 0;
+							int idx;
+							for (idx = 0; idx < next_argc; ++idx) {
+								r = ast_json_array_append(json_args,
+									ast_json_string_create(next_argv[idx]));
+								if (r != 0) {
+									ast_log(LOG_ERROR, "Error appending to ApplicationMoveFailed message\n");
+									break;
+								}
+							}
+							if (r == 0) {
+								app_send(control_app(control), msg);
 							}
 						}
-						if (r == 0) {
-							app_send(control_app(control), msg);
-						}
+						ast_json_unref(msg);
 					}
-					ast_json_unref(msg);
 				}
 			}
 			control_move_cleanup(control);
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index 4a8e84d..4a75382 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -111,8 +111,9 @@
 		return NULL;
 	}
 
-	return ast_json_pack("{s: s, s: O}",
+	return ast_json_pack("{s: s, s: o?, s: O}",
 		"type", type,
+		"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
 		"playback", blob);
 }
 
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 4077fc8..0ab50e4d 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -89,8 +89,9 @@
 		return NULL;
 	}
 
-	return ast_json_pack("{s: s, s: O}",
+	return ast_json_pack("{s: s, s: o?, s: O}",
 		"type", type,
+		"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
 		"recording", blob);
 }
 
diff --git a/res/stasis/app.c b/res/stasis/app.c
index eee60ef..859c3d1 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -1161,8 +1161,9 @@
 
 		ast_verb(1, "Replacing Stasis app '%s'\n", app->name);
 
-		msg = ast_json_pack("{s: s, s: s}",
+		msg = ast_json_pack("{s: s, s: o?, s: s}",
 			"type", "ApplicationReplaced",
+			"timestamp", ast_json_timeval(ast_tvnow(), NULL),
 			"application", app->name);
 		if (msg) {
 			app_send(app, msg);
diff --git a/rest-api/api-docs/events.json b/rest-api/api-docs/events.json
index c9f4b6a..c9822f6 100644
--- a/rest-api/api-docs/events.json
+++ b/rest-api/api-docs/events.json
@@ -148,7 +148,7 @@
 				"timestamp": {
 					"type": "Date",
 					"description": "Time at which this event was created.",
-					"required": false
+					"required": true
 				}
 			},
 			"subTypes": [
diff --git a/tests/test_res_stasis.c b/tests/test_res_stasis.c
index 1d90a28..1727107 100644
--- a/tests/test_res_stasis.c
+++ b/tests/test_res_stasis.c
@@ -167,7 +167,10 @@
 	res = stasis_app_send(app_name, message);
 	ast_test_validate(test, 0 == res);
 	ast_test_validate(test, 1 == app_data1->invocations);
+	ast_test_validate(test, ast_json_object_get(ast_json_array_get(app_data1->messages, 0), "timestamp")? 1: 0);
+	ast_json_object_del(ast_json_array_get(app_data1->messages, 0), "timestamp");
 	ast_test_validate(test, ast_json_equal(expected_message1, app_data1->messages));
+
 	ast_test_validate(test, 1 == app_data2->invocations);
 	ast_test_validate(test, ast_json_equal(expected_message2, app_data2->messages));
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11175
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
Gerrit-Change-Number: 11175
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190326/f5f81ac7/attachment-0001.html>


More information about the asterisk-code-review mailing list