bridge_channel: Don't settle owed events on an optimization.

Local channel optimization could cause DTMF digits to be duplicated.
Pending DTMF end events would be posted to a bridge when the local channel
optimizes out and is replaced by the channel further down the chain.  When
the real digit ends, the channel would get another DTMF end posted to the
bridge.

A -- LocalA;1/n -- LocalA;2/n -- LocalB;1 -- LocalB;2 -- B

1) LocalA has the /n flag to prevent optimization.
2) B is sending DTMF to A through the local channel chain.
3) When LocalB optimizes out it can move B to the position of LocalB;1
4) Without this patch, when B swaps with LocalB;1 then LocalB;1 would
settle an owed DTMF end to the bridge toward LocalA;2.
5) When B finally ends its DTMF it sends the DTMF end down the chain.
6) Without this patch, A would hear the DTMF digit end when LocalB
optimizes out and when B ends the original digit.

ASTERISK-25582

Change-Id: I1bbd28b8b399c0fb54985a5747f330a4cd2aa251
This commit is contained in:
Richard Mudgett
2016-02-19 19:06:14 -06:00
parent 128c96456c
commit 86f7336c91
3 changed files with 49 additions and 5 deletions

View File

@@ -84,7 +84,7 @@ struct ast_bridge_channel *bridge_channel_internal_alloc(struct ast_bridge *brid
/*!
* \internal
* \brief Clear owed events by the channel to the original bridge.
* \brief Settle owed events by the channel to the original bridge.
* \since 12.0.0
*
* \param orig_bridge Original bridge the channel was in before leaving.
@@ -116,6 +116,27 @@ void bridge_channel_settle_owed_events(struct ast_bridge *orig_bridge, struct as
*/
int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
* \brief Push the bridge channel into its specified bridge.
* \since 13.8.0
*
* \param bridge_channel Channel to push.
* \param optimized non-zero if the push with swap is for an optimization.
*
* \note A ref is not held by bridge_channel->swap when calling because the
* push with swap happens immediately.
*
* \note On entry, bridge_channel->bridge is already locked.
*
* \retval 0 on success.
* \retval -1 on failure. The channel did not get pushed.
*
* \note On failure the caller must call
* ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
*/
int bridge_channel_internal_push_full(struct ast_bridge_channel *bridge_channel, int optimized);
/*!
* \internal
* \brief Pull the bridge channel out of its current bridge.