aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-04 13:46:23 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-04 13:46:23 +0000
commit11223e1ff5c60a24489013da97ec2a5c7b5e372f (patch)
treedbbc22f9f60d441da117ee744847ec5b7a79e114 /main
parentaa7b59d65e863c8e28c7a69610dfc105e1b9bf79 (diff)
(closes issue #10476)
Reported by: mdu113 Only look for the end of a digit when waiting for a digit. This in turn disables emulation in the core. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@81437 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/main/channel.c b/main/channel.c
index 8e12e1474..03fd68f82 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2080,11 +2080,13 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data),
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
{
- int begin_digit = 0;
-
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
+
+ /* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */
+ ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+
/* Wait for a digit, no more than ms milliseconds total. */
while (ms) {
struct ast_channel *rchan;
@@ -2096,9 +2098,11 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) {
/* The FD we were watching has something waiting */
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return 1;
} else if (rchan) {
int res;
@@ -2108,18 +2112,17 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
switch(f->frametype) {
case AST_FRAME_DTMF_BEGIN:
- begin_digit = f->subclass;
break;
case AST_FRAME_DTMF_END:
- if (begin_digit != f->subclass)
- break;
res = f->subclass;
ast_frfree(f);
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return res;
case AST_FRAME_CONTROL:
switch(f->subclass) {
case AST_CONTROL_HANGUP:
ast_frfree(f);
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
@@ -2141,6 +2144,9 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
ast_frfree(f);
}
}
+
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+
return 0; /* Time is up */
}