summaryrefslogtreecommitdiff
path: root/main/features.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-04-30 21:40:16 +0000
committerJoshua Colp <jcolp@digium.com>2017-05-04 21:39:22 +0000
commit7ffd80cc044130ef334f7a356f5c57d699082e95 (patch)
tree1cd7f9a9d8b80808e7ad10ac814eb6be0816fb8e /main/features.c
parentbf7cf10d1522092bc099a1f9a2e28ba23685e8f6 (diff)
bridge: Fix returning to dialplan when executing Bridge() from AMI.
When using the Bridge AMI action on the same channel multiple times it was possible for the channel to return to the wrong location in the dialplan if the other party hung up. This happened because the priority of the channel was not preserved across each action invocation and it would fail to move on to the next priority in other cases. This change makes it so that the priority of a channel is preserved when taking control of it from another thread and it is incremented as appropriate such that the priority reflects where the channel should next be executed in the dialplan, not where it may or may not currently be. The Bridge AMI action was also changed to ensure that it too starts the channels at the next location in the dialplan. ASTERISK-24529 Change-Id: I52406669cf64208aef7252a65b63ade31fbf7a5a
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/features.c b/main/features.c
index ea4a55baa..a4d406811 100644
--- a/main/features.c
+++ b/main/features.c
@@ -785,7 +785,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
chana_exten = ast_strdupa(ast_channel_exten(chana));
chana_context = ast_strdupa(ast_channel_context(chana));
chana_priority = ast_channel_priority(chana);
- if (!ast_test_flag(ast_channel_flags(chana), AST_FLAG_IN_AUTOLOOP)) {
+ if (ast_test_flag(ast_channel_flags(chana), AST_FLAG_IN_AUTOLOOP)) {
chana_priority++;
}
ast_channel_unlock(chana);
@@ -801,7 +801,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
chanb_exten = ast_strdupa(ast_channel_exten(chanb));
chanb_context = ast_strdupa(ast_channel_context(chanb));
chanb_priority = ast_channel_priority(chanb);
- if (!ast_test_flag(ast_channel_flags(chanb), AST_FLAG_IN_AUTOLOOP)) {
+ if (ast_test_flag(ast_channel_flags(chanb), AST_FLAG_IN_AUTOLOOP)) {
chanb_priority++;
}
ast_channel_unlock(chanb);
@@ -812,7 +812,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
return 0;
}
- ast_bridge_set_after_go_on(chana, chana_context, chana_exten, chana_priority, NULL);
+ ast_bridge_set_after_goto(chana, chana_context, chana_exten, chana_priority);
if (ast_bridge_add_channel(bridge, chana, NULL, playtone & PLAYTONE_CHANNEL1, xfer_cfg_a ? xfer_cfg_a->xfersound : NULL)) {
snprintf(buf, sizeof(buf), "Unable to add Channel1 to bridge: %s", ast_channel_name(chana));
astman_send_error(s, m, buf);
@@ -820,7 +820,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
return 0;
}
- ast_bridge_set_after_go_on(chanb, chanb_context, chanb_exten, chanb_priority, NULL);
+ ast_bridge_set_after_goto(chanb, chanb_context, chanb_exten, chanb_priority);
if (ast_bridge_add_channel(bridge, chanb, NULL, playtone & PLAYTONE_CHANNEL2, xfer_cfg_b ? xfer_cfg_b->xfersound : NULL)) {
snprintf(buf, sizeof(buf), "Unable to add Channel2 to bridge: %s", ast_channel_name(chanb));
astman_send_error(s, m, buf);