summaryrefslogtreecommitdiff
path: root/main/bridge_channel.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-06-26 12:43:47 +0000
committerKinsey Moore <kmoore@digium.com>2014-06-26 12:43:47 +0000
commite977b7936b02bcd33a35bf7c4e5b51f496f727e5 (patch)
tree02c6fd7d4127021f3e20f783e350da4d78123bbd /main/bridge_channel.c
parent22e62ac6f640f6442968e5ab9146d3a7fe496f95 (diff)
Bridging: Allow channels to define bridging hooks
This patch allows the current owner of a channel to define various feature hooks to be made available once the channel has entered a bridge. This includes any hooks that are setup on the ast_bridge_features struct such as DTMF hooks, bridge event hooks (join, leave, etc.), and interval hooks. Review: https://reviewboard.asterisk.org/r/3649/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridge_channel.c')
-rw-r--r--main/bridge_channel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index 9b1b5737e..7d1c65367 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -2187,6 +2187,7 @@ static void bridge_channel_event_join_leave(struct ast_bridge_channel *bridge_ch
int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel)
{
int res = 0;
+ struct ast_bridge_features *channel_features;
ast_format_copy(&bridge_channel->read_format, ast_channel_readformat(bridge_channel->chan));
ast_format_copy(&bridge_channel->write_format, ast_channel_writeformat(bridge_channel->chan));
@@ -2201,8 +2202,8 @@ int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel)
*/
ast_bridge_lock(bridge_channel->bridge);
- /* Make sure we're still good to be put into a bridge */
ast_channel_lock(bridge_channel->chan);
+ /* Make sure we're still good to be put into a bridge */
if (ast_channel_internal_bridge(bridge_channel->chan)
|| ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_ZOMBIE)) {
ast_channel_unlock(bridge_channel->chan);
@@ -2214,6 +2215,12 @@ int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel)
return -1;
}
ast_channel_internal_bridge_set(bridge_channel->chan, bridge_channel->bridge);
+
+ /* Attach features requested by the channel */
+ channel_features = ast_channel_feature_hooks_get(bridge_channel->chan);
+ if (channel_features) {
+ ast_bridge_features_merge(bridge_channel->features, channel_features);
+ }
ast_channel_unlock(bridge_channel->chan);
/* Add the jitterbuffer if the channel requires it */