diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-09-13 22:19:23 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-09-13 22:19:23 +0000 |
commit | 2a371cd80bfb88552d2f42545718da2489e1a5ba (patch) | |
tree | 188cc0f08f5ef185f215cf2d07ea59f5164311f0 /main/bridge.c | |
parent | 03c7857375b475883a81141da05ca2d2376bf066 (diff) |
Restore Dial, Queue, and FollowMe 'I' option support.
The Dial, Queue, and FollowMe applications need to inhibit the bridging
initial connected line exchange in order to support the 'I' option.
* Replaced the pass_reference flag on ast_bridge_join() with a flags
parameter to pass other flags defined by enum ast_bridge_join_flags.
* Replaced the independent flag on ast_bridge_impart() with a flags
parameter to pass other flags defined by enum ast_bridge_impart_flags.
* Since the Dial, Queue, and FollowMe applications are now the only
callers of ast_bridge_call() and ast_bridge_call_with_flags(), changed the
calling contract to require the initial COLP exchange to already have been
done by the caller.
* Made all callers of ast_bridge_impart() check the return value. It is
important. As a precaution, I also made the compiler complain now if it
is not checked.
* Did some cleanup in parking_tests.c as a result of checking the
ast_bridge_impart() return value.
An independent, but associated change is:
* Reduce stack usage in ast_indicate_data() and add a dropping redundant
connected line verbose message.
(closes issue ASTERISK-22072)
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/2845/
........
Merged revisions 399136 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridge.c')
-rw-r--r-- | main/bridge.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/main/bridge.c b/main/bridge.c index 45820c3fa..19350ed84 100644 --- a/main/bridge.c +++ b/main/bridge.c @@ -1433,13 +1433,13 @@ int ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *swap, struct ast_bridge_features *features, struct ast_bridge_tech_optimizations *tech_args, - int pass_reference) + enum ast_bridge_join_flags flags) { struct ast_bridge_channel *bridge_channel; int res = 0; bridge_channel = bridge_channel_internal_alloc(bridge); - if (pass_reference) { + if (flags & AST_BRIDGE_JOIN_PASS_REFERENCE) { ao2_ref(bridge, -1); } if (!bridge_channel) { @@ -1468,6 +1468,7 @@ int ast_bridge_join(struct ast_bridge *bridge, bridge_channel->chan = chan; bridge_channel->swap = swap; bridge_channel->features = features; + bridge_channel->inhibit_colp = !!(flags & AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP); if (!res) { res = bridge_channel_internal_join(bridge_channel); @@ -1546,7 +1547,11 @@ static void *bridge_channel_ind_thread(void *data) return NULL; } -int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, int independent) +int ast_bridge_impart(struct ast_bridge *bridge, + struct ast_channel *chan, + struct ast_channel *swap, + struct ast_bridge_features *features, + enum ast_bridge_impart_flags flags) { int res = 0; struct ast_bridge_channel *bridge_channel; @@ -1585,12 +1590,14 @@ int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struc bridge_channel->chan = chan; bridge_channel->swap = swap; bridge_channel->features = features; - bridge_channel->depart_wait = independent ? 0 : 1; + bridge_channel->inhibit_colp = !!(flags & AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP); + bridge_channel->depart_wait = + (flags & AST_BRIDGE_IMPART_CHAN_MASK) == AST_BRIDGE_IMPART_CHAN_DEPARTABLE; bridge_channel->callid = ast_read_threadstorage_callid(); /* Actually create the thread that will handle the channel */ if (!res) { - if (independent) { + if ((flags & AST_BRIDGE_IMPART_CHAN_MASK) == AST_BRIDGE_IMPART_CHAN_INDEPENDENT) { res = ast_pthread_create_detached(&bridge_channel->thread, NULL, bridge_channel_ind_thread, bridge_channel); } else { @@ -2191,7 +2198,8 @@ int ast_bridge_add_channel(struct ast_bridge *bridge, struct ast_channel *chan, ast_answer(yanked_chan); } ast_channel_ref(yanked_chan); - if (ast_bridge_impart(bridge, yanked_chan, NULL, features, 1)) { + if (ast_bridge_impart(bridge, yanked_chan, NULL, features, + AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { /* It is possible for us to yank a channel and have some other * thread start a PBX on the channl after we yanked it. In particular, * this can theoretically happen on the ;2 of a Local channel if we @@ -3638,7 +3646,8 @@ static enum ast_transfer_result blind_transfer_bridge(struct ast_channel *transf ast_hangup(local); return AST_BRIDGE_TRANSFER_FAIL; } - if (ast_bridge_impart(bridge, local, transferer, NULL, 1)) { + if (ast_bridge_impart(bridge, local, transferer, NULL, + AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { ast_hangup(local); return AST_BRIDGE_TRANSFER_FAIL; } @@ -3808,7 +3817,8 @@ static enum ast_transfer_result attended_transfer_bridge(struct ast_channel *cha return AST_BRIDGE_TRANSFER_FAIL; } - if (ast_bridge_impart(bridge1, local_chan, chan1, NULL, 1)) { + if (ast_bridge_impart(bridge1, local_chan, chan1, NULL, + AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { ast_hangup(local_chan); return AST_BRIDGE_TRANSFER_FAIL; } |