Summary:ASTERISK-15912: [patch] Message count incorrect
Reporter:Edwin horton (edhorton)Labels:
Date Opened:2010-04-03 14:12:53Date Closed:2010-05-17 14:37:13
Versions:Frequency of
Environment:Attachments:( 0) 17135_2.diff
( 1) 20100513__issue17135.diff.txt
Description:Version and Dovecot IMAP Server for Voicemail storage.  All works perfectly except for message counts displayed on Polycom phones.  New message count is always 2 times the correct count which is reported corectly in voicemailmain.  Old message count is always zero, but again, reported correctly in voicemailmain.  The following sip notify was sent after a voicemail was left when previously empty.

NOTIFY sip:3001@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK6fc1522a;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@>;tag=as3bbf24be
To: <sip:3001@>
Contact: <sip:asterisk@>
Call-ID: 0b0abc554d1721e6231d8257714dd021@
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX
Event: message-summary
Content-Type: application/simple-message-summary
Content-Length: 94

Messages-Waiting: yes
Message-Account: sip:asterisk@
Voice-Message: 2/0 (0/0)


Polycom phones.  Centos 5.4 32 bit/OS.  
Comments:By: Leif Madsen (lmadsen) 2010-04-06 09:43:45

Please test the latest 1.6.2 release candidate ( as several changes were made after related to IMAP voicemail counting I believe. This may already be resolved.

By: Edwin horton (edhorton) 2010-04-06 19:12:33

Just tested and it acts the same.  If no messages, either new or old, I leave a message, the alert lamp lights, but the count on the display shows 2 new.  This is confirmed by message-waiting SIP notify as before. If I listen to the message, to mark it as read, it will never show up in old, on the phone, unless I restart Asterisk and the phone registers.  In all cases, Voicemailmain reports the correct counts.

By: Leif Madsen (lmadsen) 2010-05-10 11:24:39

Just to note that I think the two related issues can also be closed upon resolution of this issue since I believe all are based on the same bug.

By: SplatNIX (uxbod) 2010-05-10 14:03:05

ASTERISK-16069 has a huge amount of debug information now as to where the issue resides.

By: Edwin horton (edhorton) 2010-05-14 08:50:27

Test patch with release ans but no change in message count.  Still with no previous messages, a new messages sends a voice-message count of 2.  As before, voicemailmain correctly reports 1 message.

By: Elazar Broad (ebroad) 2010-05-14 10:55:21

Can you try the patch from https://issues.asterisk.org/view.php?id=17306?

By: Edwin horton (edhorton) 2010-05-14 12:02:25

I tried the patch from 17306 and the message count is now correct.  I tried with and without this patch.  Without this patch, once, I did NOT get a new message count of zero when I deleted the new message.  The phone still displayed message waiting until I selected messages again.  But, with both patches, it seemed to work great.

By: Elazar Broad (ebroad) 2010-05-14 12:53:33

The attached patch is a better version of part of the patch that is attached to 17306, but the code in both accomplishes the same thing. The problem is twofold:

A. folder_int() is missing a case for the "Urgent" folder, so INBOX actually gets counted twice (the attached patch does not contain this part)
B. pgm->flagged, unflagged, seen and unseen may be uninitialized, which could lead to regular and urgent messages being counted twice, the attached patch by tilghman explicitly sets these flags depending on which folder and what type of messages are being requested.

By: Tilghman Lesher (tilghman) 2010-05-17 11:08:51

edhorton:  are you deleting the message from within VoicemailMain?  Or from within another IMAP client?  If the latter, that might explain why you're not getting an update after deletion.  You can turn pollmailboxes on in voicemail.conf, if you want to continue to delete messages this way.

By: Edwin horton (edhorton) 2010-05-17 11:16:11

I was deleting from the VoiceMailMain app, in this case.  But, I have not seen any miss-operations since the two patches were applied.  As to the deletion via IMAP client, I do have pollmailboxes turned on, and it works correctly.

By: Digium Subversion (svnbot) 2010-05-17 14:31:15

Repository: asterisk
Revision: 263589

U   trunk/apps/app_voicemail.c

r263589 | tilghman | 2010-05-17 14:31:15 -0500 (Mon, 17 May 2010) | 9 lines

With IMAP backend, messages in INBOX were counted twice for MWI.

(closes issue ASTERISK-15912)
Reported by: edhorton
      20100513__issue17135.diff.txt uploaded by tilghman (license 14)
      17135_2.diff uploaded by ebroad (license 878)
Tested by: edhorton, ebroad



By: Digium Subversion (svnbot) 2010-05-17 14:37:12

Repository: asterisk
Revision: 263590

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_voicemail.c

r263590 | tilghman | 2010-05-17 14:37:11 -0500 (Mon, 17 May 2010) | 16 lines

Merged revisions 263589 via svnmerge from

 r263589 | tilghman | 2010-05-17 14:31:15 -0500 (Mon, 17 May 2010) | 9 lines
 With IMAP backend, messages in INBOX were counted twice for MWI.
 (closes issue ASTERISK-15912)
  Reported by: edhorton
        20100513__issue17135.diff.txt uploaded by tilghman (license 14)
        17135_2.diff uploaded by ebroad (license 878)
  Tested by: edhorton, ebroad