[asterisk-commits] file: branch file/bridging r117366 - /team/file/bridging/main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 20 21:20:23 CDT 2008


Author: file
Date: Tue May 20 21:20:23 2008
New Revision: 117366

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117366
Log:
Add working functions to suspend/unsuspend a channel.

Modified:
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=117366&r1=117365&r2=117366
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Tue May 20 21:20:23 2008
@@ -980,11 +980,45 @@
 
 int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
 {
+	struct ast_bridge_channel *bridge_channel;
+
+	ao2_lock(bridge);
+
+	if (!(bridge_channel = find_bridge_channel(bridge, chan))) {
+		ao2_unlock(bridge);
+		return -1;
+	}
+
+	ast_bridge_rebuild(bridge);
+
+	bridge_channel->suspended = 1;
+
+	ao2_unlock(bridge);
+
+	while (bridge->rebuild) {
+		usleep(1);
+	}
+
 	return 0;
 }
 
 int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
 {
+	struct ast_bridge_channel *bridge_channel;
+
+	ao2_lock(bridge);
+
+	if (!(bridge_channel = find_bridge_channel(bridge, chan))) {
+		ao2_unlock(bridge);
+		return -1;
+	}
+
+	ast_bridge_rebuild(bridge);
+
+	bridge_channel->suspended = 0;
+
+	ao2_unlock(bridge);
+
 	return 0;
 }
 




More information about the asterisk-commits mailing list