Remove the unsafe bridge parameter from ast_bridge_hook_callback's.

Most hook callbacks did not need the bridge parameter.  The pointer value
could become invalid if the channel is moved to another bridge while it is
executing.

* Fixed some issues in feature_attended_transfer() as a result.

* Reduce the bridge inhibit count in
attended_transfer_properties_shutdown() after it has restored the bridge
channel hooks.

* Removed basic bridge requirement on feature_blind_transfer().  It does
not require the basic bridge like feature_attended_transfer().


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395574 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2013-07-26 21:34:23 +00:00
parent 50aba6be36
commit c017d5e6a3
14 changed files with 103 additions and 93 deletions

View File

@@ -283,7 +283,7 @@ static void bridge_channel_handle_hangup(struct ast_bridge_channel *bridge_chann
if (hook->type != AST_BRIDGE_HOOK_TYPE_HANGUP) {
continue;
}
remove_me = hook->callback(bridge_channel->bridge, bridge_channel, hook->hook_pvt);
remove_me = hook->callback(bridge_channel, hook->hook_pvt);
if (remove_me) {
ast_debug(1, "Hangup hook %p is being removed from %p(%s)\n",
hook, bridge_channel, ast_channel_name(bridge_channel->chan));
@@ -916,8 +916,7 @@ static void bridge_channel_handle_interval(struct ast_bridge_channel *bridge_cha
ast_debug(1, "Executing hook %p on %p(%s)\n",
hook, bridge_channel, ast_channel_name(bridge_channel->chan));
interval = hook->generic.callback(bridge_channel->bridge, bridge_channel,
hook->generic.hook_pvt);
interval = hook->generic.callback(bridge_channel, hook->generic.hook_pvt);
ast_heap_wrlock(interval_hooks);
if (ast_heap_peek(interval_hooks, hook->timer.heap_index) != hook
@@ -1053,8 +1052,7 @@ static void bridge_channel_feature(struct ast_bridge_channel *bridge_channel)
if (hook) {
int remove_me;
remove_me = hook->generic.callback(bridge_channel->bridge, bridge_channel,
hook->generic.hook_pvt);
remove_me = hook->generic.callback(bridge_channel, hook->generic.hook_pvt);
if (remove_me) {
ast_debug(1, "DTMF hook %p is being removed from %p(%s)\n",
hook, bridge_channel, ast_channel_name(bridge_channel->chan));
@@ -1782,7 +1780,7 @@ static void bridge_channel_event_join_leave(struct ast_bridge_channel *bridge_ch
ast_indicate(bridge_channel->chan, AST_CONTROL_SRCUPDATE);
do {
if (hook->type == type) {
hook->callback(bridge_channel->bridge, bridge_channel, hook->hook_pvt);
hook->callback(bridge_channel, hook->hook_pvt);
ao2_unlink(features->other_hooks, hook);
}
ao2_ref(hook, -1);