From: Jeff Peeler Date: Wed, 21 Apr 2010 21:45:36 +0000 (+0000) Subject: Fix looping forever when no input received in certain voicemail menu scenarios. X-Git-Tag: 1.4.32-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c5677868df270b5fbea2ccaed6fa574e6ee8c97;p=thirdparty%2Fasterisk.git Fix looping forever when no input received in certain voicemail menu scenarios. Specifically, prompting for an extension (when leaving or forwarding a message) or when prompting for a digit (when saving a message or changing folders). ABE-2122 SWP-1268 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@258432 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index cdb868a72f..cfd0d6528e 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -5094,10 +5094,16 @@ static int get_folder(struct ast_channel *chan, int start) static int get_folder2(struct ast_channel *chan, char *fn, int start) { int res = 0; + int loops = 0; res = ast_play_and_wait(chan, fn); /* Folder name */ while (((res < '0') || (res > '9')) && - (res != '#') && (res >= 0)) { + (res != '#') && (res >= 0) && + loops < 4) { res = get_folder(chan, 0); + loops++; + } + if (loops == 4) { /* give up */ + return '#'; } return res; } @@ -5283,6 +5289,7 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st int valid_extensions = 0; char *dir; int curmsg; + int prompt_played = 0; if (vms == NULL) return -1; dir = vms->curdir; @@ -5364,7 +5371,8 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st } else { /* Ask for an extension */ res = ast_streamfile(chan, "vm-extension", chan->language); /* "extension" */ - if (res) + prompt_played++; + if (res || prompt_played > 4) break; if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0)) break;