From 3d63833bd6c869b7efa383e8dea14be1a6eff998 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Tue, 21 May 2013 18:00:22 +0000 Subject: Merge in the bridge_construction branch to make the system use the Bridging API. Breaks many things until they can be reworked. A partial list: chan_agent chan_dahdi, chan_misdn, chan_iax2 native bridging app_queue COLP updates DTMF attended transfers Protocol attended transfers git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389378 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_simple.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'bridges/bridge_simple.c') diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c index 947983bae..3e53b31c0 100644 --- a/bridges/bridge_simple.c +++ b/bridges/bridge_simple.c @@ -66,32 +66,26 @@ static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chann return ast_channel_make_compatible(c0, c1); } -static enum ast_bridge_write_result simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) +static int simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) { struct ast_bridge_channel *other; - /* 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) : AST_LIST_FIRST(&bridge->channels)))) { - return AST_BRIDGE_WRITE_FAILED; + other = ast_bridge_channel_peer(bridge_channel); + if (!other) { + return -1; } - /* 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); - } + /* The bridging core takes care of freeing the passed in frame. */ + ast_bridge_channel_queue_frame(other, frame); - return AST_BRIDGE_WRITE_SUCCESS; + return 0; } static struct ast_bridge_technology simple_bridge = { .name = "simple_bridge", - .capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_THREAD, - .preference = AST_BRIDGE_PREFERENCE_MEDIUM, + .capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX, + .preference = AST_BRIDGE_PREFERENCE_BASE_1TO1MIX, .join = simple_bridge_join, .write = simple_bridge_write, }; -- cgit v1.2.3