res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge

There is a problem when an INVITE-with-Replaces transfer targets a channel
in a ConfBridge.  The transfer will unconditionally swap out the
ConfBridge channel.  Unfortunately, the ConfBridge state will not be aware
of this change.  Unexpected behavior will happen as a result since
ConfBridge channels currently can only be replaced by a masquerade and not
normal bridge channel moves.

* We just need to pretend that the channel isn't in a bridge (like other
transfer methods already do) so the transfer channel will masquerade into
the ConfBridge channel.

Change-Id: I209beb0e748fa4f4b92a576f36afa8f495ba4c82
This commit is contained in:
Richard Mudgett
2018-04-05 18:33:40 -05:00
parent 72a8e2106e
commit 0c03eab962
4 changed files with 17 additions and 12 deletions

View File

@@ -4420,7 +4420,7 @@ static void set_transfer_variables_all(struct ast_channel *transferer, struct ao
ao2_iterator_destroy(&iter);
}
static struct ast_bridge *acquire_bridge(struct ast_channel *chan)
struct ast_bridge *ast_bridge_transfer_acquire_bridge(struct ast_channel *chan)
{
struct ast_bridge *bridge;
@@ -4461,7 +4461,7 @@ enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
return AST_BRIDGE_TRANSFER_FAIL;
}
bridge = acquire_bridge(transferer);
bridge = ast_bridge_transfer_acquire_bridge(transferer);
if (!bridge) {
transfer_result = AST_BRIDGE_TRANSFER_INVALID;
goto publish;
@@ -4708,8 +4708,8 @@ enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_tra
const char *app = NULL;
int hangup_target = 0;
to_transferee_bridge = acquire_bridge(to_transferee);
to_target_bridge = acquire_bridge(to_transfer_target);
to_transferee_bridge = ast_bridge_transfer_acquire_bridge(to_transferee);
to_target_bridge = ast_bridge_transfer_acquire_bridge(to_transfer_target);
transfer_msg = ast_attended_transfer_message_create(1, to_transferee, to_transferee_bridge,
to_transfer_target, to_target_bridge, NULL, NULL);