[asterisk-commits] dlee: branch dlee/stasis-http r385833 - in /team/dlee/stasis-http: res/ rest-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 16 08:54:50 CDT 2013


Author: dlee
Date: Tue Apr 16 08:54:48 2013
New Revision: 385833

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385833
Log:
Fixed param parsing

Modified:
    team/dlee/stasis-http/res/res_stasis_http_asterisk.c
    team/dlee/stasis-http/res/res_stasis_http_bridges.c
    team/dlee/stasis-http/res/res_stasis_http_channels.c
    team/dlee/stasis-http/res/res_stasis_http_endpoints.c
    team/dlee/stasis-http/res/res_stasis_http_events.c
    team/dlee/stasis-http/res/res_stasis_http_recordings.c
    team/dlee/stasis-http/rest-api-templates/res_stasis_http_resource.c.mustache
    team/dlee/stasis-http/rest-api-templates/swagger_model.py

Modified: team/dlee/stasis-http/res/res_stasis_http_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_asterisk.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_asterisk.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_asterisk.c Tue Apr 16 08:54:48 2013
@@ -55,6 +55,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_asterisk_info_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "only") == 0) {
+			args.only = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_asterisk_info(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/res/res_stasis_http_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_bridges.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_bridges.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_bridges.c Tue Apr 16 08:54:48 2013
@@ -83,6 +83,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_bridge_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "bridgeId") == 0) {
+			args.bridge_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_bridge(headers, &args, response);
 }
 /*!
@@ -97,6 +105,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_delete_bridge_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "bridgeId") == 0) {
+			args.bridge_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_delete_bridge(headers, &args, response);
 }
 /*!
@@ -111,6 +127,20 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_add_channel_to_bridge_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "channel") == 0) {
+			args.channel = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "bridgeId") == 0) {
+			args.bridge_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_add_channel_to_bridge(headers, &args, response);
 }
 /*!
@@ -125,6 +155,20 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_remove_channel_from_bridge_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "channel") == 0) {
+			args.channel = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "bridgeId") == 0) {
+			args.bridge_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_remove_channel_from_bridge(headers, &args, response);
 }
 /*!
@@ -139,6 +183,35 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_record_bridge_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "name") == 0) {
+			args.name = (i->value);
+		} else
+		if (strcmp(i->name, "maxDurationSeconds") == 0) {
+			args.max_duration_seconds = atoi(i->value);
+		} else
+		if (strcmp(i->name, "maxSilenceSeconds") == 0) {
+			args.max_silence_seconds = atoi(i->value);
+		} else
+		if (strcmp(i->name, "append") == 0) {
+			args.append = atoi(i->value);
+		} else
+		if (strcmp(i->name, "beep") == 0) {
+			args.beep = atoi(i->value);
+		} else
+		if (strcmp(i->name, "terminateOn") == 0) {
+			args.terminate_on = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "bridgeId") == 0) {
+			args.bridge_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_record_bridge(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_channels.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_channels.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_channels.c Tue Apr 16 08:54:48 2013
@@ -69,6 +69,20 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_originate_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "endpoint") == 0) {
+			args.endpoint = (i->value);
+		} else
+		if (strcmp(i->name, "extension") == 0) {
+			args.extension = (i->value);
+		} else
+		if (strcmp(i->name, "context") == 0) {
+			args.context = (i->value);
+		} else
+                {}
+        }
 	stasis_http_originate(headers, &args, response);
 }
 /*!
@@ -83,6 +97,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_channel(headers, &args, response);
 }
 /*!
@@ -97,6 +119,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_delete_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_delete_channel(headers, &args, response);
 }
 /*!
@@ -111,6 +141,26 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_dial_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "endpoint") == 0) {
+			args.endpoint = (i->value);
+		} else
+		if (strcmp(i->name, "extension") == 0) {
+			args.extension = (i->value);
+		} else
+		if (strcmp(i->name, "context") == 0) {
+			args.context = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_dial(headers, &args, response);
 }
 /*!
@@ -125,6 +175,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_continue_in_dialplan_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_continue_in_dialplan(headers, &args, response);
 }
 /*!
@@ -139,6 +197,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_reject_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_reject_channel(headers, &args, response);
 }
 /*!
@@ -153,6 +219,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_answer_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_answer_channel(headers, &args, response);
 }
 /*!
@@ -167,6 +241,20 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_mute_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "direction") == 0) {
+			args.direction = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_mute_channel(headers, &args, response);
 }
 /*!
@@ -181,6 +269,20 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_unmute_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "direction") == 0) {
+			args.direction = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_unmute_channel(headers, &args, response);
 }
 /*!
@@ -195,6 +297,35 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_record_channel_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "name") == 0) {
+			args.name = (i->value);
+		} else
+		if (strcmp(i->name, "maxDurationSeconds") == 0) {
+			args.max_duration_seconds = atoi(i->value);
+		} else
+		if (strcmp(i->name, "maxSilenceSeconds") == 0) {
+			args.max_silence_seconds = atoi(i->value);
+		} else
+		if (strcmp(i->name, "append") == 0) {
+			args.append = atoi(i->value);
+		} else
+		if (strcmp(i->name, "beep") == 0) {
+			args.beep = atoi(i->value);
+		} else
+		if (strcmp(i->name, "terminateOn") == 0) {
+			args.terminate_on = (i->value);
+		} else
+                {}
+        }
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "channelId") == 0) {
+			args.channel_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_record_channel(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/res/res_stasis_http_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_endpoints.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_endpoints.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_endpoints.c Tue Apr 16 08:54:48 2013
@@ -55,6 +55,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_endpoints_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "withType") == 0) {
+			args.with_type = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_endpoints(headers, &args, response);
 }
 /*!
@@ -69,6 +77,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_endpoint_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "endpointId") == 0) {
+			args.endpoint_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_endpoint(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/res/res_stasis_http_events.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_events.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_events.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_events.c Tue Apr 16 08:54:48 2013
@@ -55,6 +55,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_event_websocket_args args = {};
+        struct ast_variable *i;
+
+        for (i = get_params; i; i = i->next) {
+		if (strcmp(i->name, "app") == 0) {
+			args.app = (i->value);
+		} else
+                {}
+        }
 	stasis_http_event_websocket(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/res/res_stasis_http_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http_recordings.c?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http_recordings.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http_recordings.c Tue Apr 16 08:54:48 2013
@@ -69,6 +69,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_get_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_get_recording(headers, &args, response);
 }
 /*!
@@ -83,6 +91,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_delete_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_delete_recording(headers, &args, response);
 }
 /*!
@@ -97,6 +113,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_stop_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_stop_recording(headers, &args, response);
 }
 /*!
@@ -111,6 +135,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_pause_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_pause_recording(headers, &args, response);
 }
 /*!
@@ -125,6 +157,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_unpause_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_unpause_recording(headers, &args, response);
 }
 /*!
@@ -139,6 +179,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_mute_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_mute_recording(headers, &args, response);
 }
 /*!
@@ -153,6 +201,14 @@
     struct ast_variable *headers, struct stasis_http_response *response)
 {
         struct ast_unmute_recording_args args = {};
+        struct ast_variable *i;
+
+        for (i = path_vars; i; i = i->next) {
+		if (strcmp(i->name, "recordingId") == 0) {
+			args.recording_id = (i->value);
+		} else
+                {}
+        }
 	stasis_http_unmute_recording(headers, &args, response);
 }
 

Modified: team/dlee/stasis-http/rest-api-templates/res_stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/rest-api-templates/res_stasis_http_resource.c.mustache?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/rest-api-templates/res_stasis_http_resource.c.mustache (original)
+++ team/dlee/stasis-http/rest-api-templates/res_stasis_http_resource.c.mustache Tue Apr 16 08:54:48 2013
@@ -68,7 +68,7 @@
 {{#has_query_parameters}}
         for (i = get_params; i; i = i->next) {
 {{#query_parameters}}
-		if (strcmp(i->name, "{{c_name}}") == 0) {
+		if (strcmp(i->name, "{{name}}") == 0) {
 			args.{{c_name}} = {{c_convert}}(i->value);
 		} else
 {{/query_parameters}}
@@ -78,7 +78,7 @@
 {{#has_path_parameters}}
         for (i = path_vars; i; i = i->next) {
 {{#path_parameters}}
-		if (strcmp(i->name, "{{c_name}}") == 0) {
+		if (strcmp(i->name, "{{name}}") == 0) {
 			args.{{c_name}} = {{c_convert}}(i->value);
 		} else
 {{/path_parameters}}

Modified: team/dlee/stasis-http/rest-api-templates/swagger_model.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/rest-api-templates/swagger_model.py?view=diff&rev=385833&r1=385832&r2=385833
==============================================================================
--- team/dlee/stasis-http/rest-api-templates/swagger_model.py (original)
+++ team/dlee/stasis-http/rest-api-templates/swagger_model.py Tue Apr 16 08:54:48 2013
@@ -228,8 +228,8 @@
         self.header_parameters = [
             p for p in self.parameters if p.is_type('header')]
         self.has_header_parameters = self.header_parameters and True
-        self.has_parameters = self.has_query_parameters and \
-            self.has_path_parameters and self.has_header_parameters
+        self.has_parameters = self.has_query_parameters or \
+            self.has_path_parameters or self.has_header_parameters
         self.summary = op_json.get('summary')
         self.notes = op_json.get('notes')
         err_json = op_json.get('errorResponses') or []




More information about the asterisk-commits mailing list