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

@@ -2675,7 +2675,7 @@ int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature)
return 0;
}
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)
{
ast_bridge_hook_callback callback;
@@ -2687,7 +2687,7 @@ int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_b
if (!callback) {
return -1;
}
callback(bridge, bridge_channel, hook_pvt);
callback(bridge_channel, hook_pvt);
return 0;
}
@@ -3777,8 +3777,7 @@ enum try_parking_result {
PARKING_NOT_APPLICABLE,
};
static enum try_parking_result try_parking(struct ast_bridge *bridge, struct ast_channel *transferer,
const char *exten, const char *context)
static enum try_parking_result try_parking(struct ast_channel *transferer, const char *exten, const char *context)
{
RAII_VAR(struct ast_bridge_channel *, transferer_bridge_channel, NULL, ao2_cleanup);
struct ast_exten *parking_exten;
@@ -3793,7 +3792,7 @@ static enum try_parking_result try_parking(struct ast_bridge *bridge, struct ast
parking_exten = ast_get_parking_exten(exten, NULL, context);
if (parking_exten) {
return ast_park_blind_xfer(bridge, transferer_bridge_channel, parking_exten) == 0 ?
return ast_park_blind_xfer(transferer_bridge_channel, parking_exten) == 0 ?
PARKING_SUCCESS : PARKING_FAILURE;
}
@@ -3871,7 +3870,7 @@ enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, channels, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel *, transferee, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel *, transferee, NULL, ast_channel_cleanup);
int do_bridge_transfer;
int transfer_prohibited;
enum try_parking_result parking_result;
@@ -3893,7 +3892,7 @@ enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
/* Take off hold if they are on hold. */
ast_bridge_channel_write_unhold(bridge_channel);
parking_result = try_parking(bridge, transferer, exten, context);
parking_result = try_parking(transferer, exten, context);
switch (parking_result) {
case PARKING_SUCCESS:
transfer_result = AST_BRIDGE_TRANSFER_SUCCESS;