[svn-commits] file: branch file/bridging r102372 - /team/file/bridging/bridges/bridge_simple.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 4 17:15:53 CST 2008


Author: file
Date: Mon Feb  4 17:15:53 2008
New Revision: 102372

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102372
Log:
Only write a frame out to the other channel if they are in the wait state.

Modified:
    team/file/bridging/bridges/bridge_simple.c

Modified: team/file/bridging/bridges/bridge_simple.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_simple.c?view=diff&rev=102372&r1=102371&r2=102372
==============================================================================
--- team/file/bridging/bridges/bridge_simple.c (original)
+++ team/file/bridging/bridges/bridge_simple.c Mon Feb  4 17:15:53 2008
@@ -58,18 +58,19 @@
 
 static enum ast_bridge_write_result simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct ast_channel *other = NULL;
+	struct ast_bridge_channel *other = NULL;
 
 	/* If this is the only channel in this bridge then immediately exit */
 	if (AST_LIST_FIRST(&bridge->channels) == AST_LIST_LAST(&bridge->channels))
 		return AST_BRIDGE_WRITE_FAILED;
 
 	/* Find the channel we actually want to write to */
-	if (!(other = (AST_LIST_FIRST(&bridge->channels) == bridge_channel ? AST_LIST_LAST(&bridge->channels)->chan : AST_LIST_FIRST(&bridge->channels)->chan)))
+	if (!(other = (AST_LIST_FIRST(&bridge->channels) == bridge_channel ? AST_LIST_LAST(&bridge->channels) : AST_LIST_FIRST(&bridge->channels))))
 		return AST_BRIDGE_WRITE_FAILED;
 
-	/* Write the frame out... don't worry about freeing it, the bridging core will take care of it */
-	ast_write(other, frame);
+	/* Write the frame out if they are in the waiting state... don't worry about freeing it, the bridging core will take care of it */
+	if (other->state == AST_BRIDGE_CHANNEL_STATE_WAIT)
+		ast_write(other->chan, frame);
 
 	return AST_BRIDGE_WRITE_SUCCESS;
 }




More information about the svn-commits mailing list