mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user