[asterisk-commits] file: branch file/bridging r65641 -
/team/file/bridging/bridges/bridge_simple.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 23 08:47:34 MST 2007
Author: file
Date: Wed May 23 10:47:33 2007
New Revision: 65641
URL: http://svn.digium.com/view/asterisk?view=rev&rev=65641
Log:
Make the simple bridge make the two bridged channels compatible upon the second one joining the bridge.
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=65641&r1=65640&r2=65641
==============================================================================
--- team/file/bridging/bridges/bridge_simple.c (original)
+++ team/file/bridging/bridges/bridge_simple.c Wed May 23 10:47:33 2007
@@ -40,6 +40,22 @@
#include "asterisk/bridging.h"
#include "asterisk/frame.h"
+static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ struct ast_channel *c0 = AST_LIST_FIRST(&bridge->channels)->chan, *c1 = AST_LIST_LAST(&bridge->channels)->chan;
+
+ /* If this is the first channel we can't make it compatible... unless we make it compatible with itself O.o */
+ if (AST_LIST_FIRST(&bridge->channels) == AST_LIST_LAST(&bridge->channels))
+ return 0;
+
+ /* See if we need to make these compatible */
+ if (((c0->writeformat == c1->readformat) && (c0->readformat == c1->writeformat) && (c0->nativeformats == c1->nativeformats)))
+ return 0;
+
+ /* BOOM! We do. */
+ return ast_channel_make_compatible(c0, c1);
+}
+
static int simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
{
struct ast_channel *other = NULL;
@@ -62,6 +78,7 @@
.name = "simple_bridge",
.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE,
.formats = AST_FORMAT_AUDIO_MASK | AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK,
+ .join = simple_bridge_join,
.write = simple_bridge_write,
};
More information about the asterisk-commits
mailing list