diff options
author | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-20 21:50:53 +0000 |
---|---|---|
committer | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-20 21:50:53 +0000 |
commit | b4e12351dd04d2310eef6c5cdfb4bd9b0aa21aed (patch) | |
tree | 6a2d5978be302762c1e5824422411ae2430d347a /apps | |
parent | 2711ff6d77de35c18f16c98fd5f148161eb85013 (diff) |
Merged revisions 213404 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r213404 | jpeeler | 2009-08-20 16:33:11 -0500 (Thu, 20 Aug 2009) | 12 lines
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: http://svn.digium.com/svn/asterisk/branches/1.6.2@213413 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index e82a2e63b..89a7383de 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1495,7 +1495,7 @@ static void vm_imap_delete(int msgnum, struct ast_vm_user *vmu) 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; @@ -1519,9 +1519,16 @@ static int imap_retrieve_greeting (const char *dir, const int msgnum, struct ast } /* 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))) { - ast_log(AST_LOG_ERROR, "Voicemail state not found!\n"); - return -1; + 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))) { + /* 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; + } } /* Greetings will never have a prepended message */ @@ -2147,7 +2154,11 @@ static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int ast_build_string(&t, &left, "/%s", imapflags); /* End with username */ +#if 1 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) snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX"); else if (box == GREETINGS_FOLDER) |