[svn-commits] dlee: branch dlee/ari-async-bridge r396467 - in /team/dlee/ari-async-bridge: ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 8 16:18:34 CDT 2013


Author: dlee
Date: Thu Aug  8 16:18:31 2013
New Revision: 396467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396467
Log:
Merged revisions 396417-396463 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/dlee/ari-async-bridge/   (props changed)
    team/dlee/ari-async-bridge/apps/confbridge/confbridge_manager.c
    team/dlee/ari-async-bridge/include/asterisk/manager.h
    team/dlee/ari-async-bridge/main/manager_bridges.c
    team/dlee/ari-async-bridge/main/stasis_bridges.c
    team/dlee/ari-async-bridge/tests/test_stasis.c

Propchange: team/dlee/ari-async-bridge/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Thu Aug  8 16:18:31 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702,385356,395020
+/branches/11:373240,375247,375702,385356,395020,396441

Propchange: team/dlee/ari-async-bridge/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug  8 16:18:31 2013
@@ -1,1 +1,1 @@
-/trunk:1-396412
+/trunk:1-396465

Modified: team/dlee/ari-async-bridge/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/apps/confbridge/confbridge_manager.c?view=diff&rev=396467&r1=396466&r2=396467
==============================================================================
--- team/dlee/ari-async-bridge/apps/confbridge/confbridge_manager.c (original)
+++ team/dlee/ari-async-bridge/apps/confbridge/confbridge_manager.c Thu Aug  8 16:18:31 2013
@@ -200,7 +200,7 @@
 	ast_assert(blob != NULL);
 	ast_assert(event != NULL);
 
-	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge);
 	if (!bridge_text) {
 		return;
 	}

Modified: team/dlee/ari-async-bridge/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/include/asterisk/manager.h?view=diff&rev=396467&r1=396466&r2=396467
==============================================================================
--- team/dlee/ari-async-bridge/include/asterisk/manager.h (original)
+++ team/dlee/ari-async-bridge/include/asterisk/manager.h Thu Aug  8 16:18:31 2013
@@ -397,13 +397,27 @@
  *
  * \param snapshot the bridge snapshot for which to generate an AMI message
  *                 body
+ * \param prefix What to prepend to the bridge fields
  *
  * \retval NULL on error
  * \retval ast_str* on success (must be ast_freed by caller)
  */
+struct ast_str *ast_manager_build_bridge_state_string_prefix(
+	const struct ast_bridge_snapshot *snapshot,
+	const char *prefix);
+
+/*!
+ * \brief Generate the AMI message body from a bridge snapshot
+ * \since 12
+ *
+ * \param snapshot the bridge snapshot for which to generate an AMI message
+ *                 body
+ *
+ * \retval NULL on error
+ * \retval ast_str* on success (must be ast_freed by caller)
+ */
 struct ast_str *ast_manager_build_bridge_state_string(
-	const struct ast_bridge_snapshot *snapshot,
-	const char *suffix);
+	const struct ast_bridge_snapshot *snapshot);
 
 /*! \brief Struct containing info for an AMI event to send out. */
 struct ast_manager_event_blob {

Modified: team/dlee/ari-async-bridge/main/manager_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/main/manager_bridges.c?view=diff&rev=396467&r1=396466&r2=396467
==============================================================================
--- team/dlee/ari-async-bridge/main/manager_bridges.c (original)
+++ team/dlee/ari-async-bridge/main/manager_bridges.c Thu Aug  8 16:18:31 2013
@@ -108,31 +108,38 @@
  */
 static struct stasis_subscription *topic_forwarder;
 
-struct ast_str *ast_manager_build_bridge_state_string(
+struct ast_str *ast_manager_build_bridge_state_string_prefix(
 	const struct ast_bridge_snapshot *snapshot,
-	const char *suffix)
+	const char *prefix)
 {
 	struct ast_str *out = ast_str_create(128);
-	int res = 0;
+	int res;
+
 	if (!out) {
 		return NULL;
 	}
+
 	res = ast_str_set(&out, 0,
-		"BridgeUniqueid%s: %s\r\n"
-		"BridgeType%s: %s\r\n"
-		"BridgeTechnology%s: %s\r\n"
-		"BridgeNumChannels%s: %d\r\n",
-		suffix, snapshot->uniqueid,
-		suffix, snapshot->subclass,
-		suffix, snapshot->technology,
-		suffix, snapshot->num_channels);
-
+		"%sBridgeUniqueid: %s\r\n"
+		"%sBridgeType: %s\r\n"
+		"%sBridgeTechnology: %s\r\n"
+		"%sBridgeNumChannels: %d\r\n",
+		prefix, snapshot->uniqueid,
+		prefix, snapshot->subclass,
+		prefix, snapshot->technology,
+		prefix, snapshot->num_channels);
 	if (!res) {
 		ast_free(out);
 		return NULL;
 	}
 
 	return out;
+}
+
+struct ast_str *ast_manager_build_bridge_state_string(
+	const struct ast_bridge_snapshot *snapshot)
+{
+	return ast_manager_build_bridge_state_string_prefix(snapshot, "");
 }
 
 /*! \brief Typedef for callbacks that get called on channel snapshot updates */
@@ -201,7 +208,7 @@
 		if (!bridge_event_string) {
 			bridge_event_string =
 				ast_manager_build_bridge_state_string(
-					new_snapshot ? new_snapshot : old_snapshot, "");
+					new_snapshot ? new_snapshot : old_snapshot);
 			if (!bridge_event_string) {
 				return;
 			}
@@ -224,8 +231,8 @@
 	ast_assert(merge_msg->to != NULL);
 	ast_assert(merge_msg->from != NULL);
 
-	to_text = ast_manager_build_bridge_state_string(merge_msg->to, "");
-	from_text = ast_manager_build_bridge_state_string(merge_msg->from, "From");
+	to_text = ast_manager_build_bridge_state_string_prefix(merge_msg->to, "To");
+	from_text = ast_manager_build_bridge_state_string_prefix(merge_msg->from, "From");
 	if (!to_text || !from_text) {
 		return;
 	}
@@ -234,7 +241,7 @@
 		<managerEventInstance>
 			<synopsis>Raised when two bridges are merged.</synopsis>
 			<syntax>
-				<bridge_snapshot/>
+				<bridge_snapshot prefix="To"/>
 				<bridge_snapshot prefix="From"/>
 			</syntax>
 		</managerEventInstance>
@@ -256,7 +263,7 @@
 	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
 	const char *swap_id;
 
-	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge);
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
 	if (!bridge_text || !channel_text) {
 		return;
@@ -283,7 +290,7 @@
 	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
 	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
 
-	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge);
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
 	if (!bridge_text || !channel_text) {
 		return;
@@ -309,7 +316,7 @@
 	struct ast_bridge_snapshot *snapshot = stasis_message_data(obj);
 	struct mansession *s = arg;
 	char *id_text = data;
-	RAII_VAR(struct ast_str *, bridge_info, ast_manager_build_bridge_state_string(snapshot, ""), ast_free);
+	RAII_VAR(struct ast_str *, bridge_info, ast_manager_build_bridge_state_string(snapshot), ast_free_ptr);
 
 	if (!bridge_info) {
 		return 0;
@@ -432,7 +439,7 @@
 	astman_send_ack(s, m, "Bridge channel listing will follow");
 
 	snapshot = stasis_message_data(msg);
-	bridge_info = ast_manager_build_bridge_state_string(snapshot, "");
+	bridge_info = ast_manager_build_bridge_state_string(snapshot);
 
 	ao2_callback_data(snapshot->channels, OBJ_NODATA, send_bridge_info_item_cb, s, ast_str_buffer(id_text));
 

Modified: team/dlee/ari-async-bridge/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/main/stasis_bridges.c?view=diff&rev=396467&r1=396466&r2=396467
==============================================================================
--- team/dlee/ari-async-bridge/main/stasis_bridges.c (original)
+++ team/dlee/ari-async-bridge/main/stasis_bridges.c Thu Aug  8 16:18:31 2013
@@ -537,8 +537,7 @@
 	}
 
 	channel_state = ast_manager_build_channel_state_string_prefix(blob->channel, "Transferer");
-	bridge_state = ast_manager_build_bridge_state_string(blob->bridge, "");
-
+	bridge_state = ast_manager_build_bridge_state_string(blob->bridge);
 	if (!channel_state || !bridge_state) {
 		return NULL;
 	}
@@ -605,20 +604,21 @@
 
 	transferer1_state = ast_manager_build_channel_state_string_prefix(transfer_msg->to_transferee.channel_snapshot, "OrigTransferer");
 	transferer2_state = ast_manager_build_channel_state_string_prefix(transfer_msg->to_transfer_target.channel_snapshot, "SecondTransferer");
-
 	if (!transferer1_state || !transferer2_state) {
 		return NULL;
 	}
 
 	if (transfer_msg->to_transferee.bridge_snapshot) {
-		bridge1_state = ast_manager_build_bridge_state_string(transfer_msg->to_transferee.bridge_snapshot, "Orig");
+		bridge1_state = ast_manager_build_bridge_state_string_prefix(
+			transfer_msg->to_transferee.bridge_snapshot, "Orig");
 		if (!bridge1_state) {
 			return NULL;
 		}
 	}
 
 	if (transfer_msg->to_transfer_target.bridge_snapshot) {
-		bridge2_state = ast_manager_build_bridge_state_string(transfer_msg->to_transfer_target.bridge_snapshot, "Second");
+		bridge2_state = ast_manager_build_bridge_state_string_prefix(
+			transfer_msg->to_transfer_target.bridge_snapshot, "Second");
 		if (!bridge2_state) {
 			return NULL;
 		}
@@ -660,7 +660,7 @@
 			"%s"
 			"%s"
 			"IsExternal: %s\r\n"
-			"%s\r\n",
+			"%s",
 			result_strs[transfer_msg->result],
 			ast_str_buffer(transferer1_state),
 			bridge1_state ? ast_str_buffer(bridge1_state) : "",

Modified: team/dlee/ari-async-bridge/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/tests/test_stasis.c?view=diff&rev=396467&r1=396466&r2=396467
==============================================================================
--- team/dlee/ari-async-bridge/tests/test_stasis.c (original)
+++ team/dlee/ari-async-bridge/tests/test_stasis.c Thu Aug  8 16:18:31 2013
@@ -54,7 +54,7 @@
 	const char *text = stasis_message_data(message);
 
 	res = ast_manager_event_blob_create(EVENT_FLAG_TEST, "FakeMI",
-		"Message: %s", text);
+		"Message: %s\r\n", text);
 
 	if (res == NULL) {
 		return NULL;




More information about the svn-commits mailing list