Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 180186) +++ apps/app_voicemail.c (working copy) @@ -1161,7 +1161,7 @@ ast_mutex_unlock(&vms->lock); } -static int imap_retrieve_greeting (const char *dir, const int msgnum, struct ast_vm_user *vmu) +static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_vm_user *vmu) { struct vm_state *vms_p; char *file, *filename; @@ -1185,9 +1185,14 @@ } /* check if someone is accessing this box right now... */ - if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 1)) ||!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 0))) { - ast_log(LOG_ERROR, "Voicemail state not found!\n"); - return -1; + if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 1)) && !(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 0))) { + /* Unlike when retrieving a message, it is reasonable not to be able to find a vm_state + * for a mailbox when trying to retrieve a greeting. Just create one, that's all we need to do. + */ + if (!(vms_p = create_vm_state_from_user(vmu))) { + ast_log(LOG_NOTICE, "Unable to create vm_state object!\n"); + return -1; + } } ast_mutex_lock(&vms_p->lock);