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

@@ -118,7 +118,6 @@ struct ast_bridge_channel;
/*!
* \brief Hook callback type
*
* \param bridge The bridge that the channel is part of
* \param bridge_channel Channel executing the feature
* \param hook_pvt Private data passed in when the hook was created
*
@@ -131,7 +130,7 @@ struct ast_bridge_channel;
* \retval 0 Keep the callback hook.
* \retval -1 Remove the callback hook.
*/
typedef int (*ast_bridge_hook_callback)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
typedef int (*ast_bridge_hook_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt);
/*!
* \brief Hook pvt destructor callback
@@ -143,17 +142,19 @@ typedef void (*ast_bridge_hook_pvt_destructor)(void *hook_pvt);
/*!
* \brief Talking indicator callback
*
* \details This callback can be registered with the bridge in order
* to receive updates on when a bridge_channel has started and stopped
* talking
* \details
* This callback can be registered with the bridge channel in
* order to receive updates when the bridge_channel has started
* and stopped talking.
*
* \param bridge_channel Channel executing the feature
* \param hook_pvt Private data passed in when the hook was created
* \param talking TRUE if the channel is now talking
*
* \retval 0 Keep the callback hook.
* \retval -1 Remove the callback hook.
*/
typedef int (*ast_bridge_talking_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *pvt_data, int talking);
typedef int (*ast_bridge_talking_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking);
enum ast_bridge_hook_remove_flags {
/*! The hook is removed when the channel is pulled from the bridge. */
@@ -357,6 +358,8 @@ int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature);
* \brief Invoke a built in feature hook now.
*
* \param feature The feature to invoke
* \param bridge_channel Channel executing the feature
* \param hook_pvt Private data passed in when the hook was created
*
* \note This API call is only meant to be used by bridge
* subclasses and hook callbacks to request a builtin feature
@@ -368,10 +371,10 @@ int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature);
* Example usage:
*
* \code
* ast_bridge_features_do(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER, bridge, bridge_channel, hook_pvt);
* ast_bridge_features_do(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER, bridge_channel, hook_pvt);
* \endcode
*/
int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
/*!
* \brief Attach interval hooks to a bridge features structure

View File

@@ -111,8 +111,7 @@ void ast_bridge_channel_park(struct ast_bridge_channel *bridge_channel,
const char *parker_uuid,
const char *app_data);
typedef int (*ast_park_blind_xfer_fn)(struct ast_bridge *bridge, struct ast_bridge_channel *parker,
struct ast_exten *park_exten);
typedef int (*ast_park_blind_xfer_fn)(struct ast_bridge_channel *parker, struct ast_exten *park_exten);
/*!
* \brief install a callback for handling blind transfers to a parking extension
@@ -132,15 +131,13 @@ void ast_uninstall_park_blind_xfer_func(void);
* \brief use the installed park blind xfer func
* \since 12
*
* \param bridge Bridge being transferred from
* \param bridge_channel Bridge channel initiating the transfer
* \param app_data arguments to the park application
* \param parker Bridge channel initiating the park
* \param park_exten Exten to blind transfer part to.
*
* \retval 0 on success
* \retval -1 on failure
*/
int ast_park_blind_xfer(struct ast_bridge *bridge, struct ast_bridge_channel *parker,
struct ast_exten *park_exten);
int ast_park_blind_xfer(struct ast_bridge_channel *parker, struct ast_exten *park_exten);
typedef void (*ast_bridge_channel_park_fn)(struct ast_bridge_channel *parkee, const char *parkee_uuid,
const char *parker_uuid, const char *app_data);