summaryrefslogtreecommitdiff
path: root/bridges/bridge_simple.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-05-21 18:00:22 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-05-21 18:00:22 +0000
commit3d63833bd6c869b7efa383e8dea14be1a6eff998 (patch)
tree34957dd051b8f67c7cc58a510e24ee3873a61ad4 /bridges/bridge_simple.c
parente1e1cc2deefb92f8b43825f1f34e619354737842 (diff)
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
Diffstat (limited to 'bridges/bridge_simple.c')
-rw-r--r--bridges/bridge_simple.c24
1 files changed, 9 insertions, 15 deletions
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,
};