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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 12:39:07 CDT 2013


Author: kmoore
Date: Wed May 29 12:39:04 2013
New Revision: 390033

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390033
Log:
Minor cleanup

Address a function naming inconsistency
Fix a response code issued when allocation fails
Doxygenify static functions

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_http/resource_bridges.c

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=390033&r1=390032&r2=390033
==============================================================================
--- 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 12:39:04 2013
@@ -194,7 +194,7 @@
  * \return New bridge.
  * \return \c NULL on error.
  */
-struct ast_bridge *stasis_app_create_bridge(const char *type);
+struct ast_bridge *stasis_app_bridge_create(const char *type);
 
 /*!
  * \brief Returns the bridge with the given id.

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=390033&r1=390032&r2=390033
==============================================================================
--- team/kmoore/stasis-bridging_events-rework/res/res_stasis.c (original)
+++ team/kmoore/stasis-bridging_events-rework/res/res_stasis.c Wed May 29 12:39:04 2013
@@ -200,6 +200,7 @@
 /*! \brief Typedef for blob handler callbacks */
 typedef struct ast_json *(*channel_blob_handler_cb)(struct ast_channel_blob *);
 
+/*! \brief Callback to check whether an app is watching a given channel */
 static int app_watching_channel_cb(void *obj, void *arg, int flags)
 {
 	struct app *app = obj;
@@ -208,6 +209,7 @@
 	return app_is_watching_channel(app, uniqueid) ? CMP_MATCH : 0;
 }
 
+/*! \brief Get a container full of apps that are interested in the specified channel */
 static struct ao2_container *get_apps_watching_channel(const char *uniqueid)
 {
 	struct ao2_container *watching_apps;
@@ -408,7 +410,7 @@
 	ao2_cleanup(control);
 }
 
-struct ast_bridge *stasis_app_create_bridge(const char *type)
+struct ast_bridge *stasis_app_bridge_create(const char *type)
 {
 	struct ast_bridge *bridge;
 	int flags;
@@ -750,6 +752,7 @@
 	ast_module_unref(ast_module_info->self);
 }
 
+/*! \brief Callback to check whether an app is watching a given bridge */
 static int app_watching_bridge_cb(void *obj, void *arg, int flags)
 {
 	struct app *app = obj;
@@ -758,6 +761,7 @@
 	return app_is_watching_bridge(app, uniqueid) ? CMP_MATCH : 0;
 }
 
+/*! \brief Get a container full of apps that are interested in the specified bridge */
 static struct ao2_container *get_apps_watching_bridge(const char *uniqueid)
 {
 	struct ao2_container *watching_apps;
@@ -778,6 +782,7 @@
 	return watching_apps_iter->c;
 }
 
+/*! Callback used to remove an app's interest in a bridge */
 static int remove_bridge_cb(void *obj, void *arg, int flags)
 {
 	app_remove_bridge(obj, arg);
@@ -820,6 +825,7 @@
 	distribute_message(watching_apps, msg);
 }
 
+/*! \brief Callback used to merge two containers of applications */
 static int list_merge_cb(void *obj, void *arg, int flags)
 {
 	/* remove any current entries for this app */
@@ -829,17 +835,20 @@
 	return 0;
 }
 
+/*! \brief Merge container src into container dst without modifying src */
 static void update_apps_list(struct ao2_container *dst, struct ao2_container *src)
 {
 	ao2_callback(src, OBJ_NODATA, list_merge_cb, dst);
 }
 
+/*! \brief Callback for adding to an app's bridges of interest */
 static int app_add_bridge_cb(void *obj, void *arg, int flags)
 {
 	app_add_bridge(obj, arg);
 	return 0;
 }
 
+/*! \brief Add interest in the given bridge to all apps in the container */
 static void update_bridge_interest(struct ao2_container *apps, const char *bridge_id)
 {
 	RAII_VAR(char *, bridge_id_dup, ast_strdup(bridge_id), ast_free);

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=390033&r1=390032&r2=390033
==============================================================================
--- 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 12:39:04 2013
@@ -39,12 +39,13 @@
 #include "asterisk/bridging.h"
 
 /*!
- * \brief Finds the control object for a bridge, filling the response with an
- * error, if appropriate.
+ * \brief Finds a bridge, filling the response with an error, if appropriate.
+ *
  * \param[out] response Response to fill with an error if control is not found.
  * \param bridge_id ID of the bridge to lookup.
- * \return Bridge control object.
- * \return \c NULL if control object does not exist.
+ *
+ * \return Bridget.
+ * \return \c NULL if bridge does not exist.
  */
 static struct ast_bridge *find_bridge(
 	struct stasis_http_response *response,
@@ -233,7 +234,7 @@
 
 void stasis_http_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct stasis_http_response *response)
 {
-	RAII_VAR(struct ast_bridge *, bridge, stasis_app_create_bridge(args->type), ao2_cleanup);
+	RAII_VAR(struct ast_bridge *, bridge, stasis_app_bridge_create(args->type), ao2_cleanup);
 	RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
 
 	if (!bridge) {
@@ -258,6 +259,6 @@
 	}
 
 	stasis_http_response_error(
-		response, 404, "Not Found",
-		"Bridge not found");
-}
+		response, 500, "Internal Error",
+		"Unable to get snapshot for new bridge");
+}




More information about the asterisk-commits mailing list