[asterisk-commits] dlee: branch dlee/ari-event-remodel2 r392407 - in /team/dlee/ari-event-remode...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 21 01:20:05 CDT 2013
Author: dlee
Date: Fri Jun 21 01:20:03 2013
New Revision: 392407
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392407
Log:
Event cleanup
Modified:
team/dlee/ari-event-remodel2/res/res_stasis.c
team/dlee/ari-event-remodel2/res/res_stasis_http.c
team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c
team/dlee/ari-event-remodel2/res/stasis_http/ari_model.h
team/dlee/ari-event-remodel2/res/stasis_http/resource_channels.c
team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache
team/dlee/ari-event-remodel2/rest-api/api-docs/events.json
Modified: team/dlee/ari-event-remodel2/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/res/res_stasis.c?view=diff&rev=392407&r1=392406&r2=392407
==============================================================================
--- team/dlee/ari-event-remodel2/res/res_stasis.c (original)
+++ team/dlee/ari-event-remodel2/res/res_stasis.c Fri Jun 21 01:20:03 2013
@@ -290,13 +290,6 @@
return NULL;
}
-static struct ast_json *channel_dialplan_event(
- struct ast_channel_snapshot *snapshot,
- const struct timeval *tv)
-{
- return simple_channel_event("ChannelDialplan", snapshot, tv);
-}
-
static struct ast_json *channel_dialplan(
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot,
@@ -318,14 +311,12 @@
return NULL;
}
- return channel_dialplan_event(new_snapshot, tv);
-}
-
-static struct ast_json *channel_callerid_event(
- struct ast_channel_snapshot *snapshot,
- const struct timeval *tv)
-{
- return simple_channel_event("ChannelCallerId", snapshot, tv);
+ return ast_json_pack("{s: s, s: o, s: s, s: s, s: o}",
+ "type", "ChannelDialplan",
+ "timestamp", ast_json_timeval(*tv, NULL),
+ "dialplan_app", snapshot->appl,
+ "dialplan_app_data", snapshot->data,
+ "channel", ast_channel_snapshot_to_json(snapshot));
}
static struct ast_json *channel_callerid(
@@ -344,7 +335,13 @@
return NULL;
}
- return channel_callerid_event(new_snapshot, tv);
+ return ast_json_pack("{s: s, s: o, s: i, s: s, s: o}",
+ "type", "ChannelCallerId",
+ "timestamp", ast_json_timeval(*tv, NULL),
+ "caller_presentation", snapshot->caller_pres,
+ "caller_presentation_txt", ast_describe_caller_presentation(
+ snapshot->caller_pres));
+ "channel", ast_channel_snapshot_to_json(snapshot));
}
channel_snapshot_monitor channel_monitors[] = {
Modified: team/dlee/ari-event-remodel2/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/res/res_stasis_http.c?view=diff&rev=392407&r1=392406&r2=392407
==============================================================================
--- team/dlee/ari-event-remodel2/res/res_stasis_http.c (original)
+++ team/dlee/ari-event-remodel2/res/res_stasis_http.c Fri Jun 21 01:20:03 2013
@@ -846,8 +846,8 @@
return 0;
}
- /* If you explicitly want to have no content for a different return
- * code, set message to ast_json_null().
+ /* If you explicitly want to have no content, set message to
+ * ast_json_null().
*/
ast_assert(response.message != NULL);
ast_assert(response.response_code > 0);
Modified: team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c?view=diff&rev=392407&r1=392406&r2=392407
==============================================================================
--- team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c (original)
+++ team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c Fri Jun 21 01:20:03 2013
@@ -49,7 +49,6 @@
}
}
-
return res;
}
@@ -63,41 +62,41 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_channel_ids = 1;
- prop_res = ari_validate_list(
+ prop_is_valid = ari_validate_list(
ast_json_object_iter_value(iter),
ari_validate_string);
- if (!prop_res) {
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field channel_ids failed validation\n");
res = 0;
}
} else
if (strcmp("resource", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_resource = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field resource failed validation\n");
res = 0;
}
} else
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field state failed validation\n");
res = 0;
}
} else
if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_technology = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field technology failed validation\n");
res = 0;
}
@@ -113,15 +112,17 @@
if (!has_channel_ids) {
ast_log(LOG_ERROR, "ARI Endpoint missing required field channel_ids\n");
res = 0;
- }
+ }
+
if (!has_resource) {
ast_log(LOG_ERROR, "ARI Endpoint missing required field resource\n");
res = 0;
- }
+ }
+
if (!has_technology) {
ast_log(LOG_ERROR, "ARI Endpoint missing required field technology\n");
res = 0;
- }
+ }
return res;
}
@@ -135,21 +136,21 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_name = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI CallerID field name failed validation\n");
res = 0;
}
} else
if (strcmp("number", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_number = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI CallerID field number failed validation\n");
res = 0;
}
@@ -165,11 +166,12 @@
if (!has_name) {
ast_log(LOG_ERROR, "ARI CallerID missing required field name\n");
res = 0;
- }
+ }
+
if (!has_number) {
ast_log(LOG_ERROR, "ARI CallerID missing required field number\n");
res = 0;
- }
+ }
return res;
}
@@ -189,81 +191,81 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_accountcode = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
res = 0;
}
} else
if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_caller = 1;
- prop_res = ari_validate_caller_id(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_caller_id(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
res = 0;
}
} else
if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_connected = 1;
- prop_res = ari_validate_caller_id(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_caller_id(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
res = 0;
}
} else
if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_creationtime = 1;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
res = 0;
}
} else
if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_dialplan = 1;
- prop_res = ari_validate_dialplan_cep(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_dialplan_cep(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
res = 0;
}
} else
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_id = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
res = 0;
}
} else
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_name = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
res = 0;
}
} else
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_state = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
res = 0;
}
@@ -279,35 +281,42 @@
if (!has_accountcode) {
ast_log(LOG_ERROR, "ARI Channel missing required field accountcode\n");
res = 0;
- }
+ }
+
if (!has_caller) {
ast_log(LOG_ERROR, "ARI Channel missing required field caller\n");
res = 0;
- }
+ }
+
if (!has_connected) {
ast_log(LOG_ERROR, "ARI Channel missing required field connected\n");
res = 0;
- }
+ }
+
if (!has_creationtime) {
ast_log(LOG_ERROR, "ARI Channel missing required field creationtime\n");
res = 0;
- }
+ }
+
if (!has_dialplan) {
ast_log(LOG_ERROR, "ARI Channel missing required field dialplan\n");
res = 0;
- }
+ }
+
if (!has_id) {
ast_log(LOG_ERROR, "ARI Channel missing required field id\n");
res = 0;
- }
+ }
+
if (!has_name) {
ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
res = 0;
- }
+ }
+
if (!has_state) {
ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
res = 0;
- }
+ }
return res;
}
@@ -325,7 +334,6 @@
res = 0;
}
}
-
return res;
}
@@ -340,31 +348,31 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_context = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
res = 0;
}
} else
if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_exten = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
res = 0;
}
} else
if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_priority = 1;
- prop_res = ari_validate_long(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_long(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
res = 0;
}
@@ -380,15 +388,17 @@
if (!has_context) {
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
res = 0;
- }
+ }
+
if (!has_exten) {
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
res = 0;
- }
+ }
+
if (!has_priority) {
ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
res = 0;
- }
+ }
return res;
}
@@ -402,22 +412,22 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_bridge_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
res = 0;
}
} else
if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_channels = 1;
- prop_res = ari_validate_list(
+ prop_is_valid = ari_validate_list(
ast_json_object_iter_value(iter),
ari_validate_string);
- if (!prop_res) {
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
res = 0;
}
@@ -433,11 +443,12 @@
if (!has_bridge_type) {
ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
res = 0;
- }
+ }
+
if (!has_channels) {
ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
res = 0;
- }
+ }
return res;
}
@@ -450,11 +461,11 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_id = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI LiveRecording field id failed validation\n");
res = 0;
}
@@ -470,7 +481,7 @@
if (!has_id) {
ast_log(LOG_ERROR, "ARI LiveRecording missing required field id\n");
res = 0;
- }
+ }
return res;
}
@@ -484,40 +495,40 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("duration_seconds", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_int(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_int(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StoredRecording field duration_seconds failed validation\n");
res = 0;
}
} else
if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_formats = 1;
- prop_res = ari_validate_list(
+ prop_is_valid = ari_validate_list(
ast_json_object_iter_value(iter),
ari_validate_string);
- if (!prop_res) {
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StoredRecording field formats failed validation\n");
res = 0;
}
} else
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_id = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StoredRecording field id failed validation\n");
res = 0;
}
} else
if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StoredRecording field time failed validation\n");
res = 0;
}
@@ -533,11 +544,12 @@
if (!has_formats) {
ast_log(LOG_ERROR, "ARI StoredRecording missing required field formats\n");
res = 0;
- }
+ }
+
if (!has_id) {
ast_log(LOG_ERROR, "ARI StoredRecording missing required field id\n");
res = 0;
- }
+ }
return res;
}
@@ -552,41 +564,41 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_formats = 1;
- prop_res = ari_validate_list(
+ prop_is_valid = ari_validate_list(
ast_json_object_iter_value(iter),
ari_validate_string);
- if (!prop_res) {
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
res = 0;
}
} else
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_id = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
res = 0;
}
} else
if (strcmp("lang", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_lang = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field lang failed validation\n");
res = 0;
}
} else
if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
res = 0;
}
@@ -602,15 +614,17 @@
if (!has_formats) {
ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
res = 0;
- }
+ }
+
if (!has_id) {
ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
res = 0;
- }
+ }
+
if (!has_lang) {
ast_log(LOG_ERROR, "ARI Sound missing required field lang\n");
res = 0;
- }
+ }
return res;
}
@@ -626,50 +640,50 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_id = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
res = 0;
}
} else
if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
res = 0;
}
} else
if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_media_uri = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
res = 0;
}
} else
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_state = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
res = 0;
}
} else
if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_target_uri = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
res = 0;
}
@@ -685,19 +699,22 @@
if (!has_id) {
ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
res = 0;
- }
+ }
+
if (!has_media_uri) {
ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
res = 0;
- }
+ }
+
if (!has_state) {
ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
res = 0;
- }
+ }
+
if (!has_target_uri) {
ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
res = 0;
- }
+ }
return res;
}
@@ -711,30 +728,30 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
res = 0;
}
@@ -750,11 +767,12 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
res = 0;
- }
+ }
return res;
}
@@ -769,40 +787,40 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
res = 0;
}
} else
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_bridge = 1;
- prop_res = ari_validate_bridge(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_bridge(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
res = 0;
}
@@ -818,15 +836,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
res = 0;
- }
+ }
+
if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
res = 0;
- }
+ }
return res;
}
@@ -841,40 +861,40 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
res = 0;
}
} else
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_bridge = 1;
- prop_res = ari_validate_bridge(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_bridge(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
res = 0;
}
@@ -890,15 +910,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
res = 0;
- }
+ }
+
if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
res = 0;
- }
+ }
return res;
}
@@ -914,50 +936,50 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
res = 0;
}
} else
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_bridge = 1;
- prop_res = ari_validate_bridge(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_bridge(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
res = 0;
}
} else
if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_bridge_from = 1;
- prop_res = ari_validate_bridge(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_bridge(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
res = 0;
}
@@ -973,19 +995,22 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
res = 0;
- }
+ }
+
if (!has_bridge) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
res = 0;
- }
+ }
+
if (!has_bridge_from) {
ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
res = 0;
- }
+ }
return res;
}
@@ -1002,60 +1027,60 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
res = 0;
}
} else
if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_caller_presentation = 1;
- prop_res = ari_validate_int(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_int(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
res = 0;
}
} else
if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_caller_presentation_txt = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
res = 0;
}
} else
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_channel = 1;
- prop_res = ari_validate_channel(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_channel(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
res = 0;
}
@@ -1071,23 +1096,27 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
res = 0;
- }
+ }
+
if (!has_caller_presentation) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
res = 0;
- }
+ }
+
if (!has_caller_presentation_txt) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
res = 0;
- }
+ }
+
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1102,40 +1131,40 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
res = 0;
}
} else
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_channel = 1;
- prop_res = ari_validate_channel(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_channel(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
res = 0;
}
@@ -1151,15 +1180,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
res = 0;
- }
+ }
+
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
res = 0;
- }
+ }
+
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1176,60 +1207,60 @@
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_application = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
res = 0;
}
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
- prop_res = ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ int prop_is_valid;
+ prop_is_valid = ari_validate_date(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
res = 0;
}
} else
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_type = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
res = 0;
}
} else
if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_cause = 1;
- prop_res = ari_validate_int(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_int(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
res = 0;
}
} else
if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_cause_txt = 1;
- prop_res = ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_res) {
+ prop_is_valid = ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
res = 0;
}
} else
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
- int prop_res;
+ int prop_is_valid;
has_channel = 1;
- prop_res = ari_validate_channel(
- ast_json_object_iter_value(iter));
[... 1342 lines stripped ...]
More information about the asterisk-commits
mailing list