From 164f61d0295a3ab253d9566ba280eadf489a8820 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Fri, 20 May 2011 18:12:21 +0000 Subject: [PATCH] Fixes an imapfolder related crash imapfolders being set in the general section of voicemail would cause the inbox folder name to change. Since sound file names are made based on the names of the folders, this would cause the audio related to that folder name to change and if Asterisk attempted to play it, the channel would instantly hang up when the audio file couldn't be found. This patch searches for the name of the folder first to leave existing behavior in tact and if that fails, it uses the normal inbox name to get the sound file instead. (closes issue #16104) Reported by: blkline Review: https://reviewboard.asterisk.org/r/1215/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@320162 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 474aaf3fc4..04ff6a44bf 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6708,7 +6708,21 @@ static int get_folder(struct ast_channel *chan, int start) if (d) return d; snprintf(fn, sizeof(fn), "vm-%s", mbox(NULL, x)); /* Folder name */ - d = vm_play_folder_name(chan, fn); + + /* The inbox folder can have its name changed under certain conditions + * so this checks if the sound file exists for the inbox folder name and + * if it doesn't, plays the default name instead. */ + if (x == 0) { + if (ast_fileexists(fn, NULL, NULL)) { + d = vm_play_folder_name(chan, fn); + } else { + ast_verb(1, "failed to find %s\n", fn); + d = vm_play_folder_name(chan, "vm-INBOX"); + } + } else { + d = vm_play_folder_name(chan, fn); + } + if (d) return d; d = ast_waitfordigit(chan, 500); -- 2.47.2