[asterisk-commits] dlee: branch dlee/ari-url-shuffle r391644 - /team/dlee/ari-url-shuffle/rest-a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 09:01:51 CDT 2013


Author: dlee
Date: Thu Jun 13 09:01:50 2013
New Revision: 391644

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391644
Log:
Allow multiple subprotocols on a WebSocket

Modified:
    team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache
    team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py

Modified: team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache?view=diff&rev=391644&r1=391643&r2=391644
==============================================================================
--- team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache (original)
+++ team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache Thu Jun 13 09:01:50 2013
@@ -110,12 +110,14 @@
 {
 	int r = 0;
 {{#apis}}
-{{#operations}}
-{{#is_websocket}}
+{{#has_websocket}}
 	{{full_name}}.ws_server = ast_websocket_server_create();
 	if (!{{full_name}}.ws_server) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
+{{/has_websocket}}
+{{#operations}}
+{{#is_websocket}}
 	r |= ast_websocket_server_add_protocol({{full_name}}.ws_server,
 		"{{websocket_protocol}}", {{c_nickname}}_ws_cb);
 {{/is_websocket}}
@@ -130,12 +132,10 @@
 {
 	stasis_http_remove_handler(&{{root_full_name}});
 {{#apis}}
-{{#operations}}
-{{#is_websocket}}
+{{#has_websocket}}
 	ao2_cleanup({{full_name}}.ws_server);
 	{{full_name}}.ws_server = NULL;
-{{/is_websocket}}
-{{/operations}}
+{{/has_websocket}}
 {{/apis}}
 	stasis_app_unref();
 	return 0;

Modified: team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py?view=diff&rev=391644&r1=391643&r2=391644
==============================================================================
--- team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py (original)
+++ team/dlee/ari-url-shuffle/rest-api-templates/swagger_model.py Thu Jun 13 09:01:50 2013
@@ -271,6 +271,9 @@
         op_json = api_json.get('operations')
         self.operations = [
             Operation().load(j, processor, context) for j in op_json]
+        self.has_websocket = \
+            filter(lambda op: op.is_websocket, self.operations) != []
+        print "%r" % (filter(lambda op: op.is_websocket, self.operations) and True)
         return self
 
 




More information about the asterisk-commits mailing list