[asterisk-commits] kmoore: branch kmoore/stasis-bridging_events-rework r390026 - in /team/kmoore...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 10:50:55 CDT 2013


Author: kmoore
Date: Wed May 29 10:50:51 2013
New Revision: 390026

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390026
Log:
Tweak docs and make things work again

Modified:
    team/kmoore/stasis-bridging_events-rework/include/asterisk/stasis_app.h
    team/kmoore/stasis-bridging_events-rework/res/res_stasis.c
    team/kmoore/stasis-bridging_events-rework/res/stasis/control.c
    team/kmoore/stasis-bridging_events-rework/res/stasis_http/resource_bridges.c
    team/kmoore/stasis-bridging_events-rework/rest-api/api-docs/bridges.json

Modified: team/kmoore/stasis-bridging_events-rework/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging_events-rework/include/asterisk/stasis_app.h?view=diff&rev=390026&r1=390025&r2=390026
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/include/asterisk/stasis_app.h (original)
+++ team/kmoore/stasis-bridging_events-rework/include/asterisk/stasis_app.h Wed May 29 10:50:51 2013
@@ -210,38 +210,31 @@
  *
  * \param control Control whose channel should be added to the bridge
  * \param bridge Pointer to the bridge
+ */
+void stasis_app_control_add_channel_to_bridge(
+	struct stasis_app_control *control, struct ast_bridge *bridge);
+
+/*!
+ * \brief Remove a channel from the bridge.
+ *
+ * \param control Control whose channel should be removed from the bridge
+ * \param bridge Pointer to the bridge
  *
  * \retval non-zero on failure
  * \retval zero on success
  */
-int stasis_app_control_add_channel_to_bridge(
+int stasis_app_control_remove_channel_from_bridge(
 	struct stasis_app_control *control, struct ast_bridge *bridge);
 
 /*!
- * \brief Remove a channel from the bridge.
- *
- * \param control Control whose channel should be removed from the bridge
- * \param bridge Pointer to the bridge
+ * \brief Destroy the bridge.
+ *
+ * \param bridge_id Uniqueid of bridge to be destroyed
  *
  * \retval non-zero on failure
  * \retval zero on success
  */
-int stasis_app_control_remove_channel_from_bridge(
-	struct stasis_app_control *control, struct ast_bridge *bridge);
-
-/*!
- * \brief Destroy the bridge.
- *
- * \param bridge_id Uniqueid of bridge to be destroyed
- *
- * \retval non-zero on failure
- * \retval zero on success
- */
-int stasis_app_destroy_bridge(
-	const char *bridge_id);
-
-void stasis_app_bridge_remove(struct ast_bridge *bridge);
-void stasis_app_bridge_remove_by_id(const char *bridge_id);
+void stasis_app_bridge_destroy(const char *bridge_id);
 
 /*!
  * \brief Increment the res_stasis reference count.

Modified: team/kmoore/stasis-bridging_events-rework/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging_events-rework/res/res_stasis.c?view=diff&rev=390026&r1=390025&r2=390026
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/res/res_stasis.c (original)
+++ team/kmoore/stasis-bridging_events-rework/res/res_stasis.c Wed May 29 10:50:51 2013
@@ -431,28 +431,18 @@
 	return bridge;
 }
 
-void stasis_app_bridge_remove(struct ast_bridge *bridge)
-{
+static void bridge_destroy(struct ast_bridge *bridge)
+{
+	if (!bridge) {
+		return;
+	}
 	ao2_unlink(app_bridges, bridge);
-}
-
-void stasis_app_bridge_remove_by_id(const char *bridge_id)
-{
-	ao2_find(app_bridges, bridge_id, OBJ_KEY | OBJ_NODATA | OBJ_UNLINK);
-}
-
-/*!
- * \brief In addition to running ao2_cleanup(), this function also removes the
- * object from the app_bridges container.
- */
-static void bridge_unlink(struct ast_bridge *bridge)
-{
-	if (!bridge) {
-		return;
-	}
-
-	stasis_app_bridge_remove(bridge);
-	ao2_cleanup(bridge);
+	ast_bridge_destroy(bridge);
+}
+
+void stasis_app_bridge_destroy(const char *bridge_id)
+{
+	bridge_destroy(ao2_find(app_bridges, bridge_id, OBJ_KEY));
 }
 
 int app_send_start_msg(struct app *app, struct ast_channel *chan,
@@ -822,7 +812,7 @@
 		 * structure */
 		msg = stasis_json_event_bridge_destroyed_create(old_snapshot);
 		ao2_callback(watching_apps, OBJ_NODATA, remove_bridge_cb, bridge_id);
-		bridge_unlink(stasis_app_bridge_find_by_id(old_snapshot->uniqueid));
+		bridge_destroy(stasis_app_bridge_find_by_id(old_snapshot->uniqueid));
 	} else if (!old_snapshot) {
 		msg = stasis_json_event_bridge_created_create(old_snapshot);
 	}

Modified: team/kmoore/stasis-bridging_events-rework/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging_events-rework/res/stasis/control.c?view=diff&rev=390026&r1=390025&r2=390026
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/res/stasis/control.c (original)
+++ team/kmoore/stasis-bridging_events-rework/res/stasis/control.c Wed May 29 10:50:51 2013
@@ -215,22 +215,12 @@
 	return NULL;
 }
 
-int stasis_app_control_add_channel_to_bridge(struct stasis_app_control *control, struct ast_bridge *bridge)
-{
-	int *retval;
-
+void stasis_app_control_add_channel_to_bridge(struct stasis_app_control *control, struct ast_bridge *bridge)
+{
 	ast_debug(3, "%s: Sending channel add_to_bridge command\n",
 			ast_channel_uniqueid(control->channel));
 
-	retval = stasis_app_send_command(control, app_control_join_bridge, bridge);
-
-	if (retval == NULL || *retval != 0) {
-		ast_log(LOG_WARNING, "%s: Failed to add channel",
-			ast_channel_uniqueid(control->channel));
-		return -1;
-	}
-
-	return 0;
+	stasis_app_send_command_async(control, app_control_join_bridge, bridge);
 }
 
 int stasis_app_control_remove_channel_from_bridge(

Modified: team/kmoore/stasis-bridging_events-rework/res/stasis_http/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging_events-rework/res/stasis_http/resource_bridges.c?view=diff&rev=390026&r1=390025&r2=390026
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/res/stasis_http/resource_bridges.c (original)
+++ team/kmoore/stasis-bridging_events-rework/res/stasis_http/resource_bridges.c Wed May 29 10:50:51 2013
@@ -115,7 +115,6 @@
 		return;
 	}
 
-	/* channel reference is consumed by the add channel call */
 	channel = ast_channel_get_by_name(args->channel);
 	if (!channel) {
 		stasis_http_response_error(response, 404, "Not Found",
@@ -123,12 +122,8 @@
 		return;
 	}
 
-	if (stasis_app_control_add_channel_to_bridge(control, bridge)) {
-		stasis_http_response_error(response, 500, "Internal Error",
-			"Could not add channel to bridge");
-	} else {
-		stasis_http_response_no_content(response);
-	}
+	stasis_app_control_add_channel_to_bridge(control, bridge);
+	stasis_http_response_no_content(response);
 }
 
 void stasis_http_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct stasis_http_response *response)
@@ -187,7 +182,7 @@
 		return;
 	}
 
-	stasis_app_bridge_remove(bridge);
+	stasis_app_bridge_destroy(args->bridge_id);
 	stasis_http_response_no_content(response);
 }
 

Modified: team/kmoore/stasis-bridging_events-rework/rest-api/api-docs/bridges.json
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging_events-rework/rest-api/api-docs/bridges.json?view=diff&rev=390026&r1=390025&r2=390026
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/rest-api/api-docs/bridges.json (original)
+++ team/kmoore/stasis-bridging_events-rework/rest-api/api-docs/bridges.json Wed May 29 10:50:51 2013
@@ -66,7 +66,7 @@
 				},
 				{
 					"httpMethod": "DELETE",
-					"summary": "Shut down a bridge bridge.",
+					"summary": "Shut down a bridge.",
 					"notes": "If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand.",
 					"nickname": "deleteBridge",
 					"responseClass": "void",




More information about the asterisk-commits mailing list