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

This commit is contained in:
Friendly Automation
2019-03-26 08:32:28 -05:00
committed by Gerrit Code Review
8 changed files with 335 additions and 58 deletions

View File

@@ -2171,6 +2171,7 @@ int ast_ari_validate_application_replaced(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 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)) { 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) { if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
@@ -2204,6 +2205,7 @@ int ast_ari_validate_application_replaced(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2229,6 +2231,11 @@ int ast_ari_validate_application_replaced(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field timestamp\n");
res = 0;
}
return res; return res;
} }
@@ -2243,6 +2250,7 @@ int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_destination_type = 0; int has_destination_type = 0;
int has_is_external = 0; int has_is_external = 0;
int has_result = 0; int has_result = 0;
@@ -2281,6 +2289,7 @@ int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2455,6 +2464,11 @@ int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field timestamp\n");
res = 0;
}
if (!has_destination_type) { if (!has_destination_type) {
ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n"); ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
res = 0; res = 0;
@@ -2494,6 +2508,7 @@ int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
int has_context = 0; int has_context = 0;
int has_exten = 0; int has_exten = 0;
@@ -2532,6 +2547,7 @@ int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2634,6 +2650,11 @@ int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n"); ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
res = 0; res = 0;
@@ -2673,6 +2694,7 @@ int ast_ari_validate_bridge_created(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2707,6 +2729,7 @@ int ast_ari_validate_bridge_created(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2742,6 +2765,11 @@ int ast_ari_validate_bridge_created(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeCreated missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n"); ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
res = 0; res = 0;
@@ -2761,6 +2789,7 @@ int ast_ari_validate_bridge_destroyed(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2795,6 +2824,7 @@ int ast_ari_validate_bridge_destroyed(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2830,6 +2860,11 @@ int ast_ari_validate_bridge_destroyed(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n"); ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
res = 0; res = 0;
@@ -2849,6 +2884,7 @@ int ast_ari_validate_bridge_merged(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
int has_bridge_from = 0; int has_bridge_from = 0;
@@ -2884,6 +2920,7 @@ int ast_ari_validate_bridge_merged(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -2929,6 +2966,11 @@ int ast_ari_validate_bridge_merged(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n"); ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
res = 0; res = 0;
@@ -2953,6 +2995,7 @@ int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -2987,6 +3030,7 @@ int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3031,6 +3075,11 @@ int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n"); ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
res = 0; res = 0;
@@ -3050,6 +3099,7 @@ int ast_ari_validate_channel_caller_id(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_caller_presentation = 0; int has_caller_presentation = 0;
int has_caller_presentation_txt = 0; int has_caller_presentation_txt = 0;
int has_channel = 0; int has_channel = 0;
@@ -3086,6 +3136,7 @@ int ast_ari_validate_channel_caller_id(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3141,6 +3192,11 @@ int ast_ari_validate_channel_caller_id(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field timestamp\n");
res = 0;
}
if (!has_caller_presentation) { if (!has_caller_presentation) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n"); ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
res = 0; res = 0;
@@ -3170,6 +3226,7 @@ int ast_ari_validate_channel_connected_line(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3204,6 +3261,7 @@ int ast_ari_validate_channel_connected_line(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3239,6 +3297,11 @@ int ast_ari_validate_channel_connected_line(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
res = 0; res = 0;
@@ -3258,6 +3321,7 @@ int ast_ari_validate_channel_created(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3292,6 +3356,7 @@ int ast_ari_validate_channel_created(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3327,6 +3392,11 @@ int ast_ari_validate_channel_created(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelCreated missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
res = 0; res = 0;
@@ -3346,6 +3416,7 @@ int ast_ari_validate_channel_destroyed(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_cause = 0; int has_cause = 0;
int has_cause_txt = 0; int has_cause_txt = 0;
int has_channel = 0; int has_channel = 0;
@@ -3382,6 +3453,7 @@ int ast_ari_validate_channel_destroyed(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3437,6 +3509,11 @@ int ast_ari_validate_channel_destroyed(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field timestamp\n");
res = 0;
}
if (!has_cause) { if (!has_cause) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n"); ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
res = 0; res = 0;
@@ -3466,6 +3543,7 @@ int ast_ari_validate_channel_dialplan(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
int has_dialplan_app = 0; int has_dialplan_app = 0;
int has_dialplan_app_data = 0; int has_dialplan_app_data = 0;
@@ -3502,6 +3580,7 @@ int ast_ari_validate_channel_dialplan(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3557,6 +3636,11 @@ int ast_ari_validate_channel_dialplan(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
res = 0; res = 0;
@@ -3586,6 +3670,7 @@ int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
int has_digit = 0; int has_digit = 0;
int has_duration_ms = 0; int has_duration_ms = 0;
@@ -3622,6 +3707,7 @@ int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3677,6 +3763,11 @@ int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
res = 0; res = 0;
@@ -3706,6 +3797,7 @@ int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3740,6 +3832,7 @@ int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3784,6 +3877,11 @@ int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n"); ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
res = 0; res = 0;
@@ -3803,6 +3901,7 @@ int ast_ari_validate_channel_hangup_request(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3837,6 +3936,7 @@ int ast_ari_validate_channel_hangup_request(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3890,6 +3990,11 @@ int ast_ari_validate_channel_hangup_request(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
res = 0; res = 0;
@@ -3909,6 +4014,7 @@ int ast_ari_validate_channel_hold(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -3943,6 +4049,7 @@ int ast_ari_validate_channel_hold(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -3987,6 +4094,11 @@ int ast_ari_validate_channel_hold(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelHold missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
res = 0; res = 0;
@@ -4006,6 +4118,7 @@ int ast_ari_validate_channel_left_bridge(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_bridge = 0; int has_bridge = 0;
int has_channel = 0; int has_channel = 0;
@@ -4041,6 +4154,7 @@ int ast_ari_validate_channel_left_bridge(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4086,6 +4200,11 @@ int ast_ari_validate_channel_left_bridge(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field timestamp\n");
res = 0;
}
if (!has_bridge) { if (!has_bridge) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n"); ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
res = 0; res = 0;
@@ -4110,6 +4229,7 @@ int ast_ari_validate_channel_state_change(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4144,6 +4264,7 @@ int ast_ari_validate_channel_state_change(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4179,6 +4300,11 @@ int ast_ari_validate_channel_state_change(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
res = 0; res = 0;
@@ -4198,6 +4324,7 @@ int ast_ari_validate_channel_talking_finished(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
int has_duration = 0; int has_duration = 0;
@@ -4233,6 +4360,7 @@ int ast_ari_validate_channel_talking_finished(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4278,6 +4406,11 @@ int ast_ari_validate_channel_talking_finished(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
res = 0; res = 0;
@@ -4302,6 +4435,7 @@ int ast_ari_validate_channel_talking_started(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4336,6 +4470,7 @@ int ast_ari_validate_channel_talking_started(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4371,6 +4506,11 @@ int ast_ari_validate_channel_talking_started(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
res = 0; res = 0;
@@ -4390,6 +4530,7 @@ int ast_ari_validate_channel_unhold(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4424,6 +4565,7 @@ int ast_ari_validate_channel_unhold(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4459,6 +4601,11 @@ int ast_ari_validate_channel_unhold(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n"); ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
res = 0; res = 0;
@@ -4478,6 +4625,7 @@ int ast_ari_validate_channel_userevent(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_eventname = 0; int has_eventname = 0;
int has_userevent = 0; int has_userevent = 0;
@@ -4513,6 +4661,7 @@ int ast_ari_validate_channel_userevent(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4585,6 +4734,11 @@ int ast_ari_validate_channel_userevent(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field timestamp\n");
res = 0;
}
if (!has_eventname) { if (!has_eventname) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n"); ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
res = 0; res = 0;
@@ -4609,6 +4763,7 @@ int ast_ari_validate_channel_varset(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_value = 0; int has_value = 0;
int has_variable = 0; int has_variable = 0;
@@ -4644,6 +4799,7 @@ int ast_ari_validate_channel_varset(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4698,6 +4854,11 @@ int ast_ari_validate_channel_varset(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field timestamp\n");
res = 0;
}
if (!has_value) { if (!has_value) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n"); ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
res = 0; res = 0;
@@ -4801,6 +4962,7 @@ int ast_ari_validate_contact_status_change(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_contact_info = 0; int has_contact_info = 0;
int has_endpoint = 0; int has_endpoint = 0;
@@ -4836,6 +4998,7 @@ int ast_ari_validate_contact_status_change(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4881,6 +5044,11 @@ int ast_ari_validate_contact_status_change(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field timestamp\n");
res = 0;
}
if (!has_contact_info) { if (!has_contact_info) {
ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n"); ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n");
res = 0; res = 0;
@@ -4905,6 +5073,7 @@ int ast_ari_validate_device_state_changed(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_device_state = 0; int has_device_state = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -4939,6 +5108,7 @@ int ast_ari_validate_device_state_changed(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -4974,6 +5144,11 @@ int ast_ari_validate_device_state_changed(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field timestamp\n");
res = 0;
}
if (!has_device_state) { if (!has_device_state) {
ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n"); ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
res = 0; res = 0;
@@ -4993,6 +5168,7 @@ int ast_ari_validate_dial(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_dialstatus = 0; int has_dialstatus = 0;
int has_peer = 0; int has_peer = 0;
@@ -5028,6 +5204,7 @@ int ast_ari_validate_dial(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -5109,6 +5286,11 @@ int ast_ari_validate_dial(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI Dial missing required field timestamp\n");
res = 0;
}
if (!has_dialstatus) { if (!has_dialstatus) {
ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n"); ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
res = 0; res = 0;
@@ -5133,6 +5315,7 @@ int ast_ari_validate_endpoint_state_change(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_endpoint = 0; int has_endpoint = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5167,6 +5350,7 @@ int ast_ari_validate_endpoint_state_change(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -5202,6 +5386,11 @@ int ast_ari_validate_endpoint_state_change(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field timestamp\n");
res = 0;
}
if (!has_endpoint) { if (!has_endpoint) {
ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n"); ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
res = 0; res = 0;
@@ -5221,6 +5410,7 @@ int ast_ari_validate_event(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
const char *discriminator; const char *discriminator;
discriminator = ast_json_string_get(ast_json_object_get(json, "type")); discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
@@ -5384,6 +5574,7 @@ int ast_ari_validate_event(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -5409,6 +5600,11 @@ int ast_ari_validate_event(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI Event missing required field timestamp\n");
res = 0;
}
return res; return res;
} }
@@ -5744,6 +5940,7 @@ int ast_ari_validate_peer_status_change(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_endpoint = 0; int has_endpoint = 0;
int has_peer = 0; int has_peer = 0;
@@ -5779,6 +5976,7 @@ int ast_ari_validate_peer_status_change(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -5824,6 +6022,11 @@ int ast_ari_validate_peer_status_change(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field timestamp\n");
res = 0;
}
if (!has_endpoint) { if (!has_endpoint) {
ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n"); ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n");
res = 0; res = 0;
@@ -5848,6 +6051,7 @@ int ast_ari_validate_playback_continuing(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_playback = 0; int has_playback = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5882,6 +6086,7 @@ int ast_ari_validate_playback_continuing(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -5917,6 +6122,11 @@ int ast_ari_validate_playback_continuing(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field timestamp\n");
res = 0;
}
if (!has_playback) { if (!has_playback) {
ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n"); ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n");
res = 0; res = 0;
@@ -5936,6 +6146,7 @@ int ast_ari_validate_playback_finished(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_playback = 0; int has_playback = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -5970,6 +6181,7 @@ int ast_ari_validate_playback_finished(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6005,6 +6217,11 @@ int ast_ari_validate_playback_finished(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field timestamp\n");
res = 0;
}
if (!has_playback) { if (!has_playback) {
ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n"); ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
res = 0; res = 0;
@@ -6024,6 +6241,7 @@ int ast_ari_validate_playback_started(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_playback = 0; int has_playback = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6058,6 +6276,7 @@ int ast_ari_validate_playback_started(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6093,6 +6312,11 @@ int ast_ari_validate_playback_started(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field timestamp\n");
res = 0;
}
if (!has_playback) { if (!has_playback) {
ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n"); ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
res = 0; res = 0;
@@ -6112,6 +6336,7 @@ int ast_ari_validate_recording_failed(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_recording = 0; int has_recording = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6146,6 +6371,7 @@ int ast_ari_validate_recording_failed(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6181,6 +6407,11 @@ int ast_ari_validate_recording_failed(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI RecordingFailed missing required field timestamp\n");
res = 0;
}
if (!has_recording) { if (!has_recording) {
ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n"); ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
res = 0; res = 0;
@@ -6200,6 +6431,7 @@ int ast_ari_validate_recording_finished(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_recording = 0; int has_recording = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6234,6 +6466,7 @@ int ast_ari_validate_recording_finished(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6269,6 +6502,11 @@ int ast_ari_validate_recording_finished(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI RecordingFinished missing required field timestamp\n");
res = 0;
}
if (!has_recording) { if (!has_recording) {
ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n"); ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
res = 0; res = 0;
@@ -6288,6 +6526,7 @@ int ast_ari_validate_recording_started(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_recording = 0; int has_recording = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6322,6 +6561,7 @@ int ast_ari_validate_recording_started(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6357,6 +6597,11 @@ int ast_ari_validate_recording_started(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI RecordingStarted missing required field timestamp\n");
res = 0;
}
if (!has_recording) { if (!has_recording) {
ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n"); ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
res = 0; res = 0;
@@ -6376,6 +6621,7 @@ int ast_ari_validate_stasis_end(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_channel = 0; int has_channel = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6410,6 +6656,7 @@ int ast_ari_validate_stasis_end(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6445,6 +6692,11 @@ int ast_ari_validate_stasis_end(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI StasisEnd missing required field timestamp\n");
res = 0;
}
if (!has_channel) { if (!has_channel) {
ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n"); ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
res = 0; res = 0;
@@ -6464,6 +6716,7 @@ int ast_ari_validate_stasis_start(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_args = 0; int has_args = 0;
int has_channel = 0; int has_channel = 0;
@@ -6499,6 +6752,7 @@ int ast_ari_validate_stasis_start(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6554,6 +6808,11 @@ int ast_ari_validate_stasis_start(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field timestamp\n");
res = 0;
}
if (!has_args) { if (!has_args) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n"); ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
res = 0; res = 0;
@@ -6578,6 +6837,7 @@ int ast_ari_validate_text_message_received(struct ast_json *json)
struct ast_json_iter *iter; struct ast_json_iter *iter;
int has_type = 0; int has_type = 0;
int has_application = 0; int has_application = 0;
int has_timestamp = 0;
int has_message = 0; int has_message = 0;
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -6612,6 +6872,7 @@ int ast_ari_validate_text_message_received(struct ast_json *json)
} else } else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) { if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid; int prop_is_valid;
has_timestamp = 1;
prop_is_valid = ast_ari_validate_date( prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter)); ast_json_object_iter_value(iter));
if (!prop_is_valid) { if (!prop_is_valid) {
@@ -6656,6 +6917,11 @@ int ast_ari_validate_text_message_received(struct ast_json *json)
res = 0; res = 0;
} }
if (!has_timestamp) {
ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field timestamp\n");
res = 0;
}
if (!has_message) { if (!has_message) {
ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n"); ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
res = 0; res = 0;

View File

@@ -1558,12 +1558,12 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* BridgeAttendedTransfer * BridgeAttendedTransfer
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - destination_application: string * - destination_application: string
* - destination_bridge: string * - destination_bridge: string
* - destination_link_first_leg: Channel * - destination_link_first_leg: Channel
@@ -1584,7 +1584,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge * - bridge: Bridge
* - channel: Channel (required) * - channel: Channel (required)
* - context: string (required) * - context: string (required)
@@ -1597,33 +1597,33 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* BridgeDestroyed * BridgeDestroyed
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* BridgeMerged * BridgeMerged
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - bridge_from: Bridge (required) * - bridge_from: Bridge (required)
* BridgeVideoSourceChanged * BridgeVideoSourceChanged
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - old_video_source_id: string * - old_video_source_id: string
* ChannelCallerId * ChannelCallerId
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - caller_presentation: int (required) * - caller_presentation: int (required)
* - caller_presentation_txt: string (required) * - caller_presentation_txt: string (required)
* - channel: Channel (required) * - channel: Channel (required)
@@ -1631,19 +1631,19 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelCreated * ChannelCreated
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelDestroyed * ChannelDestroyed
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - cause: int (required) * - cause: int (required)
* - cause_txt: string (required) * - cause_txt: string (required)
* - channel: Channel (required) * - channel: Channel (required)
@@ -1651,7 +1651,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* - dialplan_app: string (required) * - dialplan_app: string (required)
* - dialplan_app_data: string (required) * - dialplan_app_data: string (required)
@@ -1659,7 +1659,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* - digit: string (required) * - digit: string (required)
* - duration_ms: int (required) * - duration_ms: int (required)
@@ -1667,14 +1667,14 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - channel: Channel * - channel: Channel
* ChannelHangupRequest * ChannelHangupRequest
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - cause: int * - cause: int
* - channel: Channel (required) * - channel: Channel (required)
* - soft: boolean * - soft: boolean
@@ -1682,46 +1682,46 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* - musicclass: string * - musicclass: string
* ChannelLeftBridge * ChannelLeftBridge
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge (required) * - bridge: Bridge (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelStateChange * ChannelStateChange
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelTalkingFinished * ChannelTalkingFinished
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* - duration: int (required) * - duration: int (required)
* ChannelTalkingStarted * ChannelTalkingStarted
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelUnhold * ChannelUnhold
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* ChannelUserevent * ChannelUserevent
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - bridge: Bridge * - bridge: Bridge
* - channel: Channel * - channel: Channel
* - endpoint: Endpoint * - endpoint: Endpoint
@@ -1731,7 +1731,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel * - channel: Channel
* - value: string (required) * - value: string (required)
* - variable: string (required) * - variable: string (required)
@@ -1744,20 +1744,20 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - contact_info: ContactInfo (required) * - contact_info: ContactInfo (required)
* - endpoint: Endpoint (required) * - endpoint: Endpoint (required)
* DeviceStateChanged * DeviceStateChanged
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - device_state: DeviceState (required) * - device_state: DeviceState (required)
* Dial * Dial
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - caller: Channel * - caller: Channel
* - dialstatus: string (required) * - dialstatus: string (required)
* - dialstring: string * - dialstring: string
@@ -1768,13 +1768,13 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - endpoint: Endpoint (required) * - endpoint: Endpoint (required)
* Event * Event
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* Message * Message
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
@@ -1792,56 +1792,56 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - endpoint: Endpoint (required) * - endpoint: Endpoint (required)
* - peer: Peer (required) * - peer: Peer (required)
* PlaybackContinuing * PlaybackContinuing
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - playback: Playback (required) * - playback: Playback (required)
* PlaybackFinished * PlaybackFinished
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - playback: Playback (required) * - playback: Playback (required)
* PlaybackStarted * PlaybackStarted
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - playback: Playback (required) * - playback: Playback (required)
* RecordingFailed * RecordingFailed
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - recording: LiveRecording (required) * - recording: LiveRecording (required)
* RecordingFinished * RecordingFinished
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - recording: LiveRecording (required) * - recording: LiveRecording (required)
* RecordingStarted * RecordingStarted
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - recording: LiveRecording (required) * - recording: LiveRecording (required)
* StasisEnd * StasisEnd
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - channel: Channel (required) * - channel: Channel (required)
* StasisStart * StasisStart
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - args: List[string] (required) * - args: List[string] (required)
* - channel: Channel (required) * - channel: Channel (required)
* - replace_channel: Channel * - replace_channel: Channel
@@ -1849,7 +1849,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - asterisk_id: string * - asterisk_id: string
* - type: string (required) * - type: string (required)
* - application: string (required) * - application: string (required)
* - timestamp: Date * - timestamp: Date (required)
* - endpoint: Endpoint * - endpoint: Endpoint
* - message: TextMessage (required) * - message: TextMessage (required)
* Application * Application

View File

@@ -1470,30 +1470,35 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
int next_argc = control_next_app_args_size(control); int next_argc = control_next_app_args_size(control);
char **next_argv = control_next_app_args(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", "type", "ApplicationMoveFailed",
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
"channel", ast_channel_snapshot_to_json(snapshot, NULL), "channel", ast_channel_snapshot_to_json(snapshot, NULL),
"destination", control_next_app(control), "destination", control_next_app(control),
"args"); "args");
json_args = ast_json_object_get(msg, "args"); if (!msg) {
if (!json_args) { ast_log(LOG_ERROR, "Failed to pack JSON for ApplicationMoveFailed message\n");
ast_log(LOG_ERROR, "Could not get args json array");
} else { } else {
int r = 0; json_args = ast_json_object_get(msg, "args");
int idx; if (!json_args) {
for (idx = 0; idx < next_argc; ++idx) { ast_log(LOG_ERROR, "Could not get args json array");
r = ast_json_array_append(json_args, } else {
ast_json_string_create(next_argv[idx])); int r = 0;
if (r != 0) { int idx;
ast_log(LOG_ERROR, "Error appending to ApplicationMoveFailed message\n"); for (idx = 0; idx < next_argc; ++idx) {
break; 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) { ast_json_unref(msg);
app_send(control_app(control), msg);
}
} }
ast_json_unref(msg);
} }
} }
control_move_cleanup(control); control_move_cleanup(control);

View File

@@ -111,8 +111,9 @@ static struct ast_json *playback_to_json(struct stasis_message *message,
return NULL; return NULL;
} }
return ast_json_pack("{s: s, s: O}", return ast_json_pack("{s: s, s: o?, s: O}",
"type", type, "type", type,
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
"playback", blob); "playback", blob);
} }

View File

@@ -89,8 +89,9 @@ static struct ast_json *recording_to_json(struct stasis_message *message,
return NULL; return NULL;
} }
return ast_json_pack("{s: s, s: O}", return ast_json_pack("{s: s, s: o?, s: O}",
"type", type, "type", type,
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
"recording", blob); "recording", blob);
} }

View File

@@ -1121,8 +1121,9 @@ void app_update(struct stasis_app *app, stasis_app_cb handler, void *data)
ast_verb(1, "Replacing Stasis app '%s'\n", app->name); 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", "type", "ApplicationReplaced",
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
"application", app->name); "application", app->name);
if (msg) { if (msg) {
app_send(app, msg); app_send(app, msg);

View File

@@ -148,7 +148,7 @@
"timestamp": { "timestamp": {
"type": "Date", "type": "Date",
"description": "Time at which this event was created.", "description": "Time at which this event was created.",
"required": false "required": true
} }
}, },
"subTypes": [ "subTypes": [

View File

@@ -167,7 +167,10 @@ AST_TEST_DEFINE(app_replaced)
res = stasis_app_send(app_name, message); res = stasis_app_send(app_name, message);
ast_test_validate(test, 0 == res); ast_test_validate(test, 0 == res);
ast_test_validate(test, 1 == app_data1->invocations); 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, ast_json_equal(expected_message1, app_data1->messages));
ast_test_validate(test, 1 == app_data2->invocations); ast_test_validate(test, 1 == app_data2->invocations);
ast_test_validate(test, ast_json_equal(expected_message2, app_data2->messages)); ast_test_validate(test, ast_json_equal(expected_message2, app_data2->messages));