diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 93ed2bd717..06eb5d35a6 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4502,7 +4502,9 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box) */ snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox); - make_dir(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox); + /* Faster to make the directory than to check if it exists. */ + create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox); + count_msg = count_messages(vmu, vms->curdir); if (count_msg < 0) return count_msg;