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

@@ -183,7 +183,7 @@ static int create_parked_subscription(struct ast_channel *chan, const char *park
/*!
* \internal
* \brief Helper function that creates an outgoing channel and returns it immediately. This function is nearly
* identical to the dial_transfer function in bridge_builtin_features.c, however it doesn't swap the
* identical to the dial_transfer function in bridge_basic.c, however it doesn't swap the
* local channel and the channel that instigated the park.
*/
static struct ast_channel *park_local_transfer(struct ast_channel *parker, const char *exten, const char *context)
@@ -242,7 +242,7 @@ static struct ast_channel *park_local_transfer(struct ast_channel *parker, const
return parkee;
}
static int park_feature_helper(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_exten *park_exten)
static int park_feature_helper(struct ast_bridge_channel *bridge_channel, struct ast_exten *park_exten)
{
RAII_VAR(struct ast_channel *, other, NULL, ao2_cleanup);
RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup);
@@ -251,7 +251,9 @@ static int park_feature_helper(struct ast_bridge *bridge, struct ast_bridge_chan
RAII_VAR(struct ao2_container *, bridge_peers, NULL, ao2_cleanup);
struct ao2_iterator iter;
bridge_peers = ast_bridge_peers(bridge);
ast_bridge_channel_lock_bridge(bridge_channel);
bridge_peers = ast_bridge_peers_nolock(bridge_channel->bridge);
ast_bridge_unlock(bridge_channel->bridge);
if (ao2_container_count(bridge_peers) < 2) {
/* There is nothing to do if there is no one to park. */
@@ -357,20 +359,19 @@ static void park_bridge_channel(struct ast_bridge_channel *bridge_channel, const
}
}
static int feature_park(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static int feature_park(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
park_feature_helper(bridge, bridge_channel, NULL);
park_feature_helper(bridge_channel, NULL);
return 0;
}
/*! \internal
* \brief Interval hook. Pulls a parked call from the parking bridge after the timeout is passed and sets the resolution to timeout.
*
* \param bridge Which bridge the channel was parked in
* \param bridge_channel bridge channel this interval hook is being executed on
* \param hook_pvt A pointer to the parked_user struct associated with the channel is stuffed in here
*/
static int parking_duration_callback(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static int parking_duration_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct parked_user *user = hook_pvt;
struct ast_channel *chan = user->chan;