[asterisk-commits] mmichelson: branch mmichelson/park_swap r395702 - in /team/mmichelson/park_sw...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 29 14:33:07 CDT 2013


Author: mmichelson
Date: Mon Jul 29 14:33:05 2013
New Revision: 395702

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395702
Log:
Add a swap channel unique ID to a bridge enter event.


Modified:
    team/mmichelson/park_swap/include/asterisk/stasis_bridges.h
    team/mmichelson/park_swap/main/bridge_channel.c
    team/mmichelson/park_swap/main/manager_bridges.c
    team/mmichelson/park_swap/main/stasis_bridges.c

Modified: team/mmichelson/park_swap/include/asterisk/stasis_bridges.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/park_swap/include/asterisk/stasis_bridges.h?view=diff&rev=395702&r1=395701&r2=395702
==============================================================================
--- team/mmichelson/park_swap/include/asterisk/stasis_bridges.h (original)
+++ team/mmichelson/park_swap/include/asterisk/stasis_bridges.h Mon Jul 29 14:33:05 2013
@@ -192,8 +192,10 @@
  *
  * \param bridge The bridge a channel entered
  * \param chan The channel that entered the bridge
- */
-void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan);
+ * \param swap The channel being swapped out of the bridge
+ */
+void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan,
+		struct ast_channel *swap);
 
 /*!
  * \since 12

Modified: team/mmichelson/park_swap/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/park_swap/main/bridge_channel.c?view=diff&rev=395702&r1=395701&r2=395702
==============================================================================
--- team/mmichelson/park_swap/main/bridge_channel.c (original)
+++ team/mmichelson/park_swap/main/bridge_channel.c Mon Jul 29 14:33:05 2013
@@ -1416,7 +1416,7 @@
 		bridge->v_table->name,
 		bridge->uniqueid);
 
-	ast_bridge_publish_enter(bridge, bridge_channel->chan);
+	ast_bridge_publish_enter(bridge, bridge_channel->chan, swap ? swap->chan : NULL);
 	if (swap) {
 		ast_bridge_channel_leave_bridge(swap, BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE);
 		bridge_channel_internal_pull(swap);

Modified: team/mmichelson/park_swap/main/manager_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/park_swap/main/manager_bridges.c?view=diff&rev=395702&r1=395701&r2=395702
==============================================================================
--- team/mmichelson/park_swap/main/manager_bridges.c (original)
+++ team/mmichelson/park_swap/main/manager_bridges.c Mon Jul 29 14:33:05 2013
@@ -70,6 +70,9 @@
 				<xi:include xpointer="xpointer(/docs/managerEvent[@name='BridgeCreate']/managerEventInstance/syntax/parameter)" />
 				<parameter name="Uniqueid">
 					<para>The uniqueid of the channel entering the bridge</para>
+				</parameter>
+				<parameter name="SwapUniqueid">
+					<para>The uniqueid of the channel being swapped out of the bridge</para>
 				</parameter>
 			</syntax>
 		</managerEventInstance>
@@ -267,9 +270,11 @@
 				    struct stasis_topic *topic,
 				    struct stasis_message *message)
 {
+	static const char *swap_name = "SwapUniqueid: ";
 	struct ast_bridge_blob *blob = stasis_message_data(message);
 	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
 	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
+	const char *swap_id;
 
 	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
@@ -277,11 +282,17 @@
 		return;
 	}
 
+	swap_id = ast_json_string_get(ast_json_object_get(blob->blob, "swap"));
+
 	manager_event(EVENT_FLAG_CALL, "BridgeEnter",
 		"%s"
-		"%s",
+		"%s"
+		"%s%s%s",
 		ast_str_buffer(bridge_text),
-		ast_str_buffer(channel_text));
+		ast_str_buffer(channel_text),
+		swap_id ? swap_name : "",
+		S_OR(swap_id, ""),
+		swap_id ? "\r\n" : "");
 }
 
 static void channel_leave_cb(void *data, struct stasis_subscription *sub,

Modified: team/mmichelson/park_swap/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/park_swap/main/stasis_bridges.c?view=diff&rev=395702&r1=395701&r2=395702
==============================================================================
--- team/mmichelson/park_swap/main/stasis_bridges.c (original)
+++ team/mmichelson/park_swap/main/stasis_bridges.c Mon Jul 29 14:33:05 2013
@@ -586,11 +586,20 @@
 	return msg;
 }
 
-void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan)
+void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan,
+		struct ast_channel *swap)
 {
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-
-	msg = ast_bridge_blob_create(ast_channel_entered_bridge_type(), bridge, chan, NULL);
+	RAII_VAR(struct ast_json *, blob, NULL, ao2_cleanup);
+
+	if (swap) {
+		blob = ast_json_pack("{s: s}", "swap", ast_channel_uniqueid(swap));
+		if (!blob) {
+			return;
+		}
+	}
+
+	msg = ast_bridge_blob_create(ast_channel_entered_bridge_type(), bridge, chan, blob);
 	if (!msg) {
 		return;
 	}




More information about the asterisk-commits mailing list