mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 19:38:22 +00:00
Merged revisions 295843 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r295843 | rmudgett | 2010-11-22 13:28:23 -0600 (Mon, 22 Nov 2010) | 53 lines Merged revisions 295790 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r295790 | rmudgett | 2010-11-22 12:46:26 -0600 (Mon, 22 Nov 2010) | 46 lines The channel redirect function (CLI or AMI) hangs up the call instead of redirecting the call. To recreate the problem: 1) Party A calls Party B 2) Invoke CLI "channel redirect" command to redirect channel call leg associated with A. 3) All associated channels are hung up. Note that if the CLI command were done on the channel call leg associated with B it works. This regression was a result of the fix for issue #16946 (https://reviewboard.asterisk.org/r/740/). The regression affects all features that use an async goto to execute the dialplan because of an external event: Channel redirect, AMI redirect, SIP REFER, and FAX detection. The struct ast_channel._softhangup code is a mess. The variable is used for several purposes that do not necessarily result in the call being hung up. I have added doxygen comments to describe how the various _softhangup bits are used. I have corrected all the places where the variable was tested in a non-bit oriented manner. The primary fix is the new AST_CONTROL_END_OF_Q frame. It acts as a weak hangup request so the soft hangup requests that do not normally result in a hangup do not hangup. JIRA SWP-2470 JIRA SWP-2489 (closes issue #18171) Reported by: SantaFox (closes issue #18185) Reported by: kwemheuer (closes issue #18211) Reported by: zahir_koradia (closes issue #18230) Reported by: vmarrone (closes issue #18299) Reported by: mbrevda (closes issue #18322) Reported by: nerbos Review: https://reviewboard.asterisk.org/r/1013/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@295866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
24
main/pbx.c
24
main/pbx.c
@@ -4631,8 +4631,8 @@ static int collect_digits(struct ast_channel *c, int waittime, char *buf, int bu
|
||||
/* As long as we're willing to wait, and as long as it's not defined,
|
||||
keep reading digits until we can't possibly get a right answer anymore. */
|
||||
digit = ast_waitfordigit(c, waittime);
|
||||
if (c->_softhangup == AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup = 0;
|
||||
if (c->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_ASYNCGOTO;
|
||||
} else {
|
||||
if (!digit) /* No entry */
|
||||
break;
|
||||
@@ -4703,22 +4703,22 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
|
||||
while (!(res = ast_spawn_extension(c, c->context, c->exten, c->priority,
|
||||
S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL),
|
||||
&found, 1))) {
|
||||
if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT
|
||||
if ((c->_softhangup & AST_SOFTHANGUP_TIMEOUT)
|
||||
&& ast_exists_extension(c, c->context, "T", 1,
|
||||
S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
|
||||
set_ext_pri(c, "T", 0); /* 0 will become 1 with the c->priority++; at the end */
|
||||
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
|
||||
memset(&c->whentohangup, 0, sizeof(c->whentohangup));
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT;
|
||||
} else if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT
|
||||
} else if ((c->_softhangup & AST_SOFTHANGUP_TIMEOUT)
|
||||
&& ast_exists_extension(c, c->context, "e", 1,
|
||||
S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
|
||||
pbx_builtin_raise_exception(c, "ABSOLUTETIMEOUT");
|
||||
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
|
||||
memset(&c->whentohangup, 0, sizeof(c->whentohangup));
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT;
|
||||
} else if (c->_softhangup == AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup = 0;
|
||||
} else if (c->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_ASYNCGOTO;
|
||||
continue;
|
||||
} else if (ast_check_hangup(c)) {
|
||||
ast_debug(1, "Extension %s, priority %d returned normally even though call was hung up\n",
|
||||
@@ -4765,10 +4765,10 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
|
||||
}
|
||||
}
|
||||
|
||||
if (c->_softhangup == AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup = 0;
|
||||
if (c->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_ASYNCGOTO;
|
||||
continue;
|
||||
} else if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT
|
||||
} else if ((c->_softhangup & AST_SOFTHANGUP_TIMEOUT)
|
||||
&& ast_exists_extension(c, c->context, "T", 1,
|
||||
S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
|
||||
set_ext_pri(c, "T", 1);
|
||||
@@ -4814,9 +4814,9 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
|
||||
error = 1; /* we know what to do with it */
|
||||
break;
|
||||
}
|
||||
} else if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT) {
|
||||
} else if (c->_softhangup & AST_SOFTHANGUP_TIMEOUT) {
|
||||
/* If we get this far with AST_SOFTHANGUP_TIMEOUT, then we know that the "T" extension is next. */
|
||||
c->_softhangup = 0;
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT;
|
||||
} else { /* keypress received, get more digits for a full extension */
|
||||
int waittime = 0;
|
||||
if (digit)
|
||||
@@ -9274,7 +9274,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
|
||||
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1,
|
||||
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
|
||||
ast_verb(3, "Timeout on %s, continuing...\n", chan->name);
|
||||
} else if (chan->_softhangup == AST_SOFTHANGUP_TIMEOUT) {
|
||||
} else if (chan->_softhangup & AST_SOFTHANGUP_TIMEOUT) {
|
||||
ast_verb(3, "Call timeout on %s, checking for 'T'\n", chan->name);
|
||||
res = -1;
|
||||
} else if (ast_exists_extension(chan, chan->context, "t", 1,
|
||||
|
||||
Reference in New Issue
Block a user