summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2011-01-24 20:57:28 +0000
committerRussell Bryant <russell@russellbryant.com>2011-01-24 20:57:28 +0000
commit092134399c14b6256e1bc377951e16061dfd2331 (patch)
tree83a1ae525750fbffa01473c8475eb61d650daee2 /main/pbx.c
parentb6bb13b498f1f9c8290e840aaa441e2fbed101fc (diff)
Merged revisions 303549 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r303549 | russell | 2011-01-24 14:51:37 -0600 (Mon, 24 Jan 2011) | 45 lines Merged revisions 303548 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r303548 | russell | 2011-01-24 14:49:53 -0600 (Mon, 24 Jan 2011) | 38 lines Merged revisions 303546 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r303546 | russell | 2011-01-24 14:32:21 -0600 (Mon, 24 Jan 2011) | 31 lines Fix channel redirect out of MeetMe() and other issues with channel softhangup. Mantis issue #18585 reports that a channel redirect out of MeetMe() stopped working properly. This issue includes a patch that resolves the issue by removing a call to ast_check_hangup() from app_meetme.c. I left that in my patch, as it doesn't need to be there. However, the rest of the patch fixes this problem with or without the change to app_meetme. The key difference between what happens before and after this patch is the effect of the END_OF_Q control frame. After END_OF_Q is hit in ast_read(), ast_read() will return NULL. With the ast_check_hangup() removed, app_meetme sees this which causes it to exit as intended. Checking ast_check_hangup() caused app_meetme to exit earlier in the process, and the target of the redirect saw the condition where ast_read() returned NULL. Removing ast_check_hangup() works around the issue in app_meetme, but doesn't solve the issue if another application did the same thing. There are also other edge cases where if an application finishes at the same time that a redirect happens, the target of the redirect will think that the channel hung up. So, I made some changes in pbx.c to resolve it at a deeper level. There are already places that unset the SOFTHANGUP_ASYNCGOTO flag in an attempt to abort the hangup process. My patch extends this to remove the END_OF_Q frame from the channel's read queue, making the "abort hangup" more complete. This same technique was used in every place where a softhangup flag was cleared. (closes issue #18585) Reported by: oej Tested by: oej, wedhorn, russell Review: https://reviewboard.asterisk.org/r/1082/ ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@303551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/main/pbx.c b/main/pbx.c
index be1783f99..bceceb00f 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -4764,7 +4764,7 @@ static int collect_digits(struct ast_channel *c, int waittime, char *buf, int bu
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 &= ~AST_SOFTHANGUP_ASYNCGOTO;
+ ast_channel_clear_softhangup(c, AST_SOFTHANGUP_ASYNCGOTO);
} else {
if (!digit) /* No entry */
break;
@@ -4841,16 +4841,16 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
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;
+ ast_channel_clear_softhangup(c, 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;
+ ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
} else if (c->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
- c->_softhangup &= ~AST_SOFTHANGUP_ASYNCGOTO;
+ ast_channel_clear_softhangup(c, 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",
@@ -4898,7 +4898,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
}
if (c->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
- c->_softhangup &= ~AST_SOFTHANGUP_ASYNCGOTO;
+ ast_channel_clear_softhangup(c, AST_SOFTHANGUP_ASYNCGOTO);
continue;
} else if ((c->_softhangup & AST_SOFTHANGUP_TIMEOUT)
&& ast_exists_extension(c, c->context, "T", 1,
@@ -4906,7 +4906,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
set_ext_pri(c, "T", 1);
/* 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;
+ ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
continue;
} else {
if (c->cdr)
@@ -4948,7 +4948,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
}
} 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 &= ~AST_SOFTHANGUP_TIMEOUT;
+ ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
} else { /* keypress received, get more digits for a full extension */
int waittime = 0;
if (digit)