[asterisk-commits] dlee: branch dlee/ari-event-remodel2 r392462 - in /team/dlee/ari-event-remode...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 21 13:37:05 CDT 2013
Author: dlee
Date: Fri Jun 21 13:37:03 2013
New Revision: 392462
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392462
Log:
Final fixups
Modified:
team/dlee/ari-event-remodel2/res/stasis_http/ari_model.c
team/dlee/ari-event-remodel2/res/stasis_http/ari_websockets.c
team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache
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=392462&r1=392461&r2=392462
==============================================================================
--- 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 13:37:03 2013
@@ -112,17 +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;
}
@@ -166,12 +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;
}
@@ -281,42 +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;
}
@@ -388,17 +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;
}
@@ -476,27 +476,27 @@
if (!has_bridge_class) {
ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
res = 0;
- }
+ }
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;
- }
+ }
if (!has_id) {
ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
res = 0;
- }
+ }
if (!has_technology) {
ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
res = 0;
- }
+ }
return res;
}
@@ -529,7 +529,7 @@
if (!has_id) {
ast_log(LOG_ERROR, "ARI LiveRecording missing required field id\n");
res = 0;
- }
+ }
return res;
}
@@ -592,12 +592,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;
}
@@ -662,17 +662,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;
}
@@ -747,22 +747,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;
}
@@ -815,12 +815,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;
}
@@ -884,17 +884,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;
}
@@ -958,17 +958,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;
}
@@ -1043,22 +1043,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;
}
@@ -1144,27 +1144,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;
}
@@ -1228,17 +1228,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;
}
@@ -1324,27 +1324,27 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
res = 0;
- }
+ }
if (!has_cause) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
res = 0;
- }
+ }
if (!has_cause_txt) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1430,27 +1430,27 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
res = 0;
- }
+ }
if (!has_dialplan_app) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
res = 0;
- }
+ }
if (!has_dialplan_app_data) {
ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
res = 0;
- }
+ }
return res;
}
@@ -1536,27 +1536,27 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
res = 0;
- }
+ }
if (!has_digit) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
res = 0;
- }
+ }
if (!has_duration_ms) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
res = 0;
- }
+ }
return res;
}
@@ -1629,17 +1629,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
res = 0;
- }
+ }
if (!has_bridge) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
res = 0;
- }
+ }
return res;
}
@@ -1721,17 +1721,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1806,22 +1806,22 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
res = 0;
- }
+ }
if (!has_bridge) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1885,17 +1885,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -1970,22 +1970,22 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field channel\n");
res = 0;
- }
+ }
if (!has_eventname) {
ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
res = 0;
- }
+ }
return res;
}
@@ -2069,22 +2069,22 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
res = 0;
- }
+ }
if (!has_value) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
res = 0;
- }
+ }
if (!has_variable) {
ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
res = 0;
- }
+ }
return res;
}
@@ -2209,12 +2209,12 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI Event missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI Event missing required field type\n");
res = 0;
- }
+ }
return res;
}
@@ -2278,17 +2278,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
res = 0;
- }
+ }
if (!has_playback) {
ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
res = 0;
- }
+ }
return res;
}
@@ -2352,17 +2352,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field type\n");
res = 0;
- }
+ }
if (!has_playback) {
ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
res = 0;
- }
+ }
return res;
}
@@ -2426,17 +2426,17 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI StasisEnd missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI StasisEnd missing required field type\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
res = 0;
- }
+ }
return res;
}
@@ -2512,22 +2512,22 @@
if (!has_application) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field application\n");
res = 0;
- }
+ }
if (!has_type) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field type\n");
res = 0;
- }
+ }
if (!has_args) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
res = 0;
- }
+ }
if (!has_channel) {
ast_log(LOG_ERROR, "ARI StasisStart missing required field channel\n");
res = 0;
- }
-
- return res;
-}
+ }
+
+ return res;
+}
Modified: team/dlee/ari-event-remodel2/res/stasis_http/ari_websockets.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/res/stasis_http/ari_websockets.c?view=diff&rev=392462&r1=392461&r2=392462
==============================================================================
--- team/dlee/ari-event-remodel2/res/stasis_http/ari_websockets.c (original)
+++ team/dlee/ari-event-remodel2/res/stasis_http/ari_websockets.c Fri Jun 21 13:37:03 2013
@@ -123,10 +123,22 @@
return ast_json_ref(message);
}
+#define VALIDATION_FAILED \
+ "{ \"error\": \"Outgoing message failed validation\" }"
+
int ari_websocket_session_write(struct ari_websocket_session *session,
struct ast_json *message)
{
RAII_VAR(char *, str, NULL, ast_free);
+
+#ifdef AST_DEVMODE
+ if (!session->validator(message)) {
+ ast_log(LOG_ERROR, "Outgoing message failed validation\n");
+ return ast_websocket_write(session->ws_session,
+ AST_WEBSOCKET_OPCODE_TEXT, VALIDATION_FAILED,
+ strlen(VALIDATION_FAILED));
+ }
+#endif
str = ast_json_dump_string_format(message, stasis_http_json_format());
@@ -135,12 +147,6 @@
return -1;
}
-#ifdef AST_DEVMODE
- if (!session->validator(message)) {
- ast_log(LOG_ERROR, "Outgoing message failed validation\n");
- }
-#endif
-
return ast_websocket_write(session->ws_session,
AST_WEBSOCKET_OPCODE_TEXT, str, strlen(str));
}
Modified: team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache?view=diff&rev=392462&r1=392461&r2=392462
==============================================================================
--- team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache (original)
+++ team/dlee/ari-event-remodel2/rest-api-templates/ari_model.c.mustache Fri Jun 21 13:37:03 2013
@@ -105,7 +105,7 @@
if (!has_{{name}}) {
ast_log(LOG_ERROR, "ARI {{id}} missing required field {{name}}\n");
res = 0;
- }
+ }
{{/required}}
{{/properties}}
More information about the asterisk-commits
mailing list