Summary:ASTERISK-16576: [patch] IMAP with maildir formats do not handle greetings correctly
Reporter:Edwin horton (edhorton)Labels:
Date Opened:2010-08-16 12:01:21Date Closed:2011-06-01 15:11:12
Versions:Frequency of
Environment:Attachments:( 0) digium_bug_17871
( 1) digium_bug_17871_2
Description:Asterisk with dovecot imap server and greetings stored in an IMAP folder work correctly when MBOX format is used.

If the same settup is used, but maildir format is defined in dovecot.conf, voicemail messages work correctly but Asterisk will always store the greetings in the INBOX directory rather than the correct folder as defined by the "greetingfolder" variable.  For playing greetings, it does fetch from the "greeting" folder directory, so if the messages are manually moved to that folder, Asterisk serves up the correct greetings.

But if a greeting is already resident in the "greeting" folder location, the corresponding greeting is removed when a new greeting is recorded.  This leaves the new greeting in INBOX and the old one removed from "greetingfolder".

Again, when playing a greeting, Asterisk correcly fetches the greeting from the "greetingfolder" location.  It will not fetch from INBOX if this variable is set.
Comments:By: Edwin horton (edhorton) 2010-08-16 17:53:08

I think I reported this incorrectly after repeated tests.  Now, with both types of IMAP storage format (MBOX and Maildir), the greetings are always stored in the INBOX folder and not the folder pointed to by the "greetingfolder" variable.  If the greeting is already in the Greetings folder, it will be removed, but the new will be in the INBOX.

Retrieval works correctly.

By: Leif Madsen (lmadsen) 2010-08-17 16:07:00

Do you have the ability to submit a patch for this?

By: Paul Belanger (pabelanger) 2010-09-04 14:33:22


By: Edwin horton (edhorton) 2010-09-16 14:16:12

Finally back to this issue and need to clarify.  Type or location of IMAP storage does not seem to matter.  If the 'greetingfolder' is set to other than INBOX and 'imapgreetings' = 'Y', the voicemail will correctly fetch from 'greetingfoder' for playback when leaving a voicemail.  However, when in mailbox options and recording a new greeting, all greetings will be placed in the INBOX and not in the folder defined in 'greetingfolder'.  Also, older same type greetings are not replaced, just added to the INBOX.  I have attached a log file.  app_voicemail does throw an error with "No vmstate found for user:"

By: Leif Madsen (lmadsen) 2010-09-17 08:00:12

I have just reproduced this, so I'm moving this back to Acknowledged (where it should have been since the reporter gave feedback).

By: fhackenberger (fhackenberger) 2011-04-07 03:26:44

The attached patch digium_bug_17871 solves this on my asterisk-

By: Edwin horton (edhorton) 2011-04-13 14:52:16

I tried the patch logic on but the logic seems incorrect.  If imapgreetings = yes, then all voicemail messages are store in greetingfolder since the if statement fails.  I changed to the following code and it seems correct now.  If msgnum >= 0 then box is left as NEW_FOLDER.  Sorry I didn't make a patch since I was not in the same version.

       /* 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;

By: Leif Madsen (lmadsen) 2011-04-14 09:18:22

Changing to Confirmed as there is a patch, but not a fully working one.

Can someone take the note from edhorton and update the patch? Thanks!

By: fhackenberger (fhackenberger) 2011-04-22 06:02:48

Sorry for that error in the patch, I did too little testing (only tested setting the greeting). The new patch includes the fix from edhorton, thanks Ed!

By: Digium Subversion (svnbot) 2011-06-01 15:10:05

Repository: asterisk
Revision: 321537

U   branches/1.8/apps/app_voicemail.c

r321537 | bbryant | 2011-06-01 15:10:05 -0500 (Wed, 01 Jun 2011) | 8 lines

This patch fixes an issue with using the wrong voicemail folders with greetings.

(closes issue ASTERISK-16576)
Reported by: edhorton
     digium_bug_17871_2 uploaded by fhackenberger (license 592)
Tested by: edhorton, fhackenberger



By: Digium Subversion (svnbot) 2011-06-01 15:11:11

Repository: asterisk
Revision: 321538

_U  trunk/
U   trunk/apps/app_voicemail.c

r321538 | bbryant | 2011-06-01 15:11:11 -0500 (Wed, 01 Jun 2011) | 15 lines

Merged revisions 321537 via svnmerge from

 r321537 | bbryant | 2011-06-01 16:10:02 -0400 (Wed, 01 Jun 2011) | 8 lines
 This patch fixes an issue with using the wrong voicemail folders with greetings.
 (closes issue ASTERISK-16576)
 Reported by: edhorton
       digium_bug_17871_2 uploaded by fhackenberger (license 592)
 Tested by: edhorton, fhackenberger