[asterisk-commits] pabelanger: trunk r401041 - in /trunk: ./ res/ rest-api/api-docs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 15 19:12:43 CDT 2013


Author: pabelanger
Date: Tue Oct 15 19:12:36 2013
New Revision: 401041

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401041
Log:
Use POST / DELETE to toggle ARI bridge moh

Review: https://reviewboard.asterisk.org/r/2911/
........

Merged revisions 401040 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/res_ari_bridges.c
    trunk/rest-api/api-docs/bridges.json

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/res_ari_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_ari_bridges.c?view=diff&rev=401041&r1=401040&r2=401041
==============================================================================
--- trunk/res/res_ari_bridges.c (original)
+++ trunk/res/res_ari_bridges.c Tue Oct 15 19:12:36 2013
@@ -490,7 +490,7 @@
 	return;
 }
 /*!
- * \brief Parameter parsing callback for /bridges/{bridgeId}/mohStart.
+ * \brief Parameter parsing callback for /bridges/{bridgeId}/moh.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -538,23 +538,23 @@
 			is_valid = ast_ari_validate_void(
 				response->message);
 		} else {
-			ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/mohStart\n", code);
-			is_valid = 0;
-		}
-	}
-
-	if (!is_valid) {
-		ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/mohStart\n");
-		ast_ari_response_error(response, 500,
-			"Internal Server Error", "Response validation failed");
-	}
-#endif /* AST_DEVMODE */
-
-fin: __attribute__((unused))
-	return;
-}
-/*!
- * \brief Parameter parsing callback for /bridges/{bridgeId}/mohStop.
+			ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
+			is_valid = 0;
+		}
+	}
+
+	if (!is_valid) {
+		ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/moh\n");
+		ast_ari_response_error(response, 500,
+			"Internal Server Error", "Response validation failed");
+	}
+#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+	return;
+}
+/*!
+ * \brief Parameter parsing callback for /bridges/{bridgeId}/moh.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
@@ -596,13 +596,13 @@
 			is_valid = ast_ari_validate_void(
 				response->message);
 		} else {
-			ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/mohStop\n", code);
-			is_valid = 0;
-		}
-	}
-
-	if (!is_valid) {
-		ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/mohStop\n");
+			ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/moh\n", code);
+			is_valid = 0;
+		}
+	}
+
+	if (!is_valid) {
+		ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/moh\n");
 		ast_ari_response_error(response, 500,
 			"Internal Server Error", "Response validation failed");
 	}
@@ -787,19 +787,11 @@
 	.children = {  }
 };
 /*! \brief REST handler for /api-docs/bridges.{format} */
-static struct stasis_rest_handlers bridges_bridgeId_mohStart = {
-	.path_segment = "mohStart",
+static struct stasis_rest_handlers bridges_bridgeId_moh = {
+	.path_segment = "moh",
 	.callbacks = {
 		[AST_HTTP_POST] = ast_ari_moh_start_bridge_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
-/*! \brief REST handler for /api-docs/bridges.{format} */
-static struct stasis_rest_handlers bridges_bridgeId_mohStop = {
-	.path_segment = "mohStop",
-	.callbacks = {
-		[AST_HTTP_POST] = ast_ari_moh_stop_bridge_cb,
+		[AST_HTTP_DELETE] = ast_ari_moh_stop_bridge_cb,
 	},
 	.num_children = 0,
 	.children = {  }
@@ -830,8 +822,8 @@
 		[AST_HTTP_GET] = ast_ari_get_bridge_cb,
 		[AST_HTTP_DELETE] = ast_ari_delete_bridge_cb,
 	},
-	.num_children = 6,
-	.children = { &bridges_bridgeId_addChannel,&bridges_bridgeId_removeChannel,&bridges_bridgeId_mohStart,&bridges_bridgeId_mohStop,&bridges_bridgeId_play,&bridges_bridgeId_record, }
+	.num_children = 5,
+	.children = { &bridges_bridgeId_addChannel,&bridges_bridgeId_removeChannel,&bridges_bridgeId_moh,&bridges_bridgeId_play,&bridges_bridgeId_record, }
 };
 /*! \brief REST handler for /api-docs/bridges.{format} */
 static struct stasis_rest_handlers bridges = {

Modified: trunk/rest-api/api-docs/bridges.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/bridges.json?view=diff&rev=401041&r1=401040&r2=401041
==============================================================================
--- trunk/rest-api/api-docs/bridges.json (original)
+++ trunk/rest-api/api-docs/bridges.json Tue Oct 15 19:12:36 2013
@@ -199,7 +199,7 @@
 			]
 		},
 		{
-			"path": "/bridges/{bridgeId}/mohStart",
+			"path": "/bridges/{bridgeId}/moh",
 			"description": "Play music on hold to a bridge",
 			"operations": [
 				{
@@ -239,11 +239,11 @@
 			]
 		},
 		{
-			"path": "/bridges/{bridgeId}/mohStop",
+			"path": "/bridges/{bridgeId}/moh",
 			"description": "Stop music on hold for a bridge",
 			"operations": [
 				{
-					"httpMethod": "POST",
+					"httpMethod": "DELETE",
 					"summary": "Stop playing music on hold to a bridge.",
 					"notes": "This will only stop music on hold being played via bridges/{bridgeId}/mohStart.",
 					"nickname": "mohStopBridge",




More information about the asterisk-commits mailing list