diff options
author | David Vossel <dvossel@digium.com> | 2009-03-03 23:21:18 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2009-03-03 23:21:18 +0000 |
commit | 979eb709ae4b597ca85115f2597969355f962e52 (patch) | |
tree | 2fd0a6b4707320506831b0594014dd1a8fa27e25 /apps/app_read.c | |
parent | 0b01444ab79f68413e6ae8bc17fd1babe10ea814 (diff) |
app_read does not break from prompt loop with user terminated empty string
In app.c, ast_app_getdata is called to stream the prompts and receive DTMF input. If ast_app_getdata() receives an empty string caused by the user inputing the end of string character, in this case '#', it should break from the prompt loop and return to app_read, but instead it cycles through all the prompts. I've added a return value for this special case in ast_readstring() which uses an enum I've delcared in apps.h. This enum is now used as a return value for ast_app_getdata().
(closes issue #14279)
Reported by: Marquis
Patches:
fix_app_read.patch uploaded by Marquis (license 32)
read-ampersanmd.patch2 uploaded by dvossel (license 671)
Tested by: Marquis, dvossel
Review: http://reviewboard.digium.com/r/177/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_read.c')
-rw-r--r-- | apps/app_read.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/app_read.c b/apps/app_read.c index 6b4088cb7..d845c5900 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -231,11 +231,11 @@ static int read_exec(struct ast_channel *chan, void *data) } } else { res = ast_app_getdata(chan, arglist.filename, tmp, maxdigits, to); - if (res == 0) + if (res == AST_GETDATA_COMPLETE || res == AST_GETDATA_EMPTY_END_TERMINATED) status = "OK"; - else if (res == 1) + else if (res == AST_GETDATA_TIMEOUT) status = "TIMEOUT"; - else if (res == 2) + else if (res == AST_GETDATA_INTERRUPTED) status = "INTERRUPTED"; } if (res > -1) { |