From: Brett Bryant Date: Wed, 1 Jun 2011 20:10:02 +0000 (+0000) Subject: This patch fixes an issue with using the wrong voicemail folders with greetings. X-Git-Tag: 1.8.5-rc1~11^2~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce51fcfb6bd712299e237d26063c23b3ce094d4d;p=thirdparty%2Fasterisk.git This patch fixes an issue with using the wrong voicemail folders with greetings. (closes issue #17871) Reported by: edhorton Patches: digium_bug_17871_2 uploaded by fhackenberger (license 592) Tested by: edhorton, fhackenberger git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@321537 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 04ff6a44bf..bd67116038 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2179,11 +2179,16 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char int ret; /* for better error checking */ char *imap_flags = NIL; int msgcount = (messagecount(vmu->context, vmu->mailbox, "INBOX") + messagecount(vmu->context, vmu->mailbox, "Old")); + int box = NEW_FOLDER; - /* Back out early if this is a greeting and we don't want to store greetings in IMAP */ - if (msgnum < 0 && !imapgreetings) { - return 0; - } + /* Back out early if this is a greeting and we don't want to store greetings in IMAP */ + if (msgnum < 0) { + if(!imapgreetings) { + return 0; + } else { + box = GREETINGS_FOLDER; + } + } if (imap_check_limits(chan, vms, vmu, msgcount)) { return -1; @@ -2266,9 +2271,9 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char } ((char *) buf)[len] = '\0'; INIT(&str, mail_string, buf, len); - ret = init_mailstream(vms, NEW_FOLDER); + ret = init_mailstream(vms, box); if (ret == 0) { - imap_mailbox_name(mailbox, sizeof(mailbox), vms, NEW_FOLDER, 1); + imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); ast_mutex_lock(&vms->lock); if(!mail_append_full(vms->mailstream, mailbox, imap_flags, NIL, &str)) ast_log(LOG_ERROR, "Error while sending the message to %s\n", mailbox);