mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-05 12:42:49 +00:00
res_stasis: Handle re-enter stasis bridge with swap channel.
We lose the fact that there is a swap channel if there is one. We currently wind up rejoining the stasis bridge as a normal join after the swap channel has already been kicked from the bridge. This patch preserves the swap channel so the AMI/ARI events can note that the channel joining the bridge is swapping with another channel. Another benefit to swaqpping in one operation is if there are any channels that get lonely (MOH, bridge playback, and bridge record channels). The lonely channels won't leave before the joining channel has a chance to come back in under stasis if the swap channel is the only reason the lonely channels are staying in the bridge. ASTERISK-25947 #close Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: If37ea508831d1fed6dbfac2f191c638fc0a850ee
This commit is contained in:
@@ -323,7 +323,7 @@ static int app_control_dial(struct stasis_app_control *control,
|
||||
AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
|
||||
ast_hangup(new_chan);
|
||||
} else {
|
||||
control_add_channel_to_bridge(control, chan, bridge);
|
||||
control_swap_channel_in_bridge(control, bridge, chan, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -982,11 +982,8 @@ static void bridge_after_cb_failed(enum ast_bridge_after_cb_reason reason,
|
||||
ast_bridge_after_cb_reason_string(reason));
|
||||
}
|
||||
|
||||
int control_add_channel_to_bridge(
|
||||
struct stasis_app_control *control,
|
||||
struct ast_channel *chan, void *data)
|
||||
int control_swap_channel_in_bridge(struct stasis_app_control *control, struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap)
|
||||
{
|
||||
struct ast_bridge *bridge = data;
|
||||
int res;
|
||||
|
||||
if (!control || !bridge) {
|
||||
@@ -1039,7 +1036,7 @@ int control_add_channel_to_bridge(
|
||||
|
||||
res = ast_bridge_impart(bridge,
|
||||
chan,
|
||||
NULL, /* swap channel */
|
||||
swap,
|
||||
NULL, /* features */
|
||||
AST_BRIDGE_IMPART_CHAN_DEPARTABLE);
|
||||
if (res != 0) {
|
||||
@@ -1055,6 +1052,11 @@ int control_add_channel_to_bridge(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int control_add_channel_to_bridge(struct stasis_app_control *control, struct ast_channel *chan, void *data)
|
||||
{
|
||||
return control_swap_channel_in_bridge(control, data, chan, NULL);
|
||||
}
|
||||
|
||||
int stasis_app_control_add_channel_to_bridge(
|
||||
struct stasis_app_control *control, struct ast_bridge *bridge)
|
||||
{
|
||||
|
Reference in New Issue
Block a user