mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
Fix greeting retrieval from IMAP
Properly check for the current voicemail state and if it doesn't exist, create it. (closes issue #14597) Reported by: wtca Patches: 14597_v2.patch uploaded by mmichelson (license 60) Tested by: jpeeler git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1526,10 +1526,17 @@ static int imap_retrieve_greeting (const char *dir, const int msgnum, struct ast
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if someone is accessing this box right now... */
|
/* check if someone is accessing this box right now... */
|
||||||
if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 1)) ||!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 0))) {
|
if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 1)) &&
|
||||||
ast_log(AST_LOG_ERROR, "Voicemail state not found!\n");
|
!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Greetings will never have a prepended message */
|
/* Greetings will never have a prepended message */
|
||||||
*vms_p->introfn = '\0';
|
*vms_p->introfn = '\0';
|
||||||
@@ -2150,7 +2157,11 @@ static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int
|
|||||||
ast_build_string(&t, &left, "/%s", imapflags);
|
ast_build_string(&t, &left, "/%s", imapflags);
|
||||||
|
|
||||||
/* End with username */
|
/* End with username */
|
||||||
|
#if 1
|
||||||
ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
|
ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
|
||||||
|
#else
|
||||||
|
ast_build_string(&t, &left, "/user=%s/novalidate-cert}", vms->imapuser);
|
||||||
|
#endif
|
||||||
if (box == NEW_FOLDER || box == OLD_FOLDER)
|
if (box == NEW_FOLDER || box == OLD_FOLDER)
|
||||||
snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
|
snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
|
||||||
else if (box == GREETINGS_FOLDER)
|
else if (box == GREETINGS_FOLDER)
|
||||||
|
Reference in New Issue
Block a user