if an Agent is redirected, the base channel should actually be redirected. This was causing multiple issues, especially issue 7706 and BE-160

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84018 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Dwayne M. Hubbard
2007-09-27 23:12:25 +00:00
parent a4dcd03dcb
commit 7c4e477fde
3 changed files with 58 additions and 1 deletions

View File

@@ -1550,7 +1550,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
const char *exten = astman_get_header(m, "Exten");
const char *context = astman_get_header(m, "Context");
const char *priority = astman_get_header(m, "Priority");
struct ast_channel *chan, *chan2 = NULL;
struct ast_channel *base, *chan, *chan2 = NULL;
int pi = 0;
int res;
@@ -1572,6 +1572,14 @@ static int action_redirect(struct mansession *s, const struct message *m)
astman_send_error(s, m, buf);
return 0;
}
if (chan->tech->get_base_channel) {
base = chan->tech->get_base_channel(chan);
if (base) {
ast_mutex_unlock(&chan->lock);
chan = base;
ast_mutex_lock(&chan->lock);
}
}
if (ast_check_hangup(chan)) {
astman_send_error(s, m, "Redirect failed, channel not up.\n");
ast_channel_unlock(chan);
@@ -1585,6 +1593,14 @@ static int action_redirect(struct mansession *s, const struct message *m)
ast_channel_unlock(chan2);
return 0;
}
if (chan2 && chan2->tech->get_base_channel) {
base = chan2->tech->get_base_channel(chan2);
if (base) {
ast_mutex_unlock(&chan2->lock);
chan2 = base;
ast_mutex_lock(&chan2->lock);
}
}
res = ast_async_goto(chan, context, exten, pi);
if (!res) {
if (!ast_strlen_zero(name2)) {