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;
}
int curmsg;
char urgent_str[7] = "";
char tmptxtfile[PATH_MAX];
+ int prompt_played = 0;
#ifndef IMAP_STORAGE
char msgfile[PATH_MAX], textfile[PATH_MAX], backup[PATH_MAX], backup_textfile[PATH_MAX];
#endif
} 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;