Define the mailbox identity and question first
Record the intended Asterisk node, running branch and maintenance release, manager session, voicemail backend and full mailbox@context identifier. Decide whether the consumer needs urgent, new and old message counts or only the action-specific waiting field; these are different questions.
A phone label, extension, SIP address, email address and voicemail mailbox are not interchangeable keys. Preserve the identifier sent and returned rather than reconstructing one from a display name.
Use MailboxCount for the documented count snapshot
The branch-22-generated reference defines Action: MailboxCount, an optional returned ActionID for correlation and a full mailbox identifier in mailbox@vm-context form. Its documented response fields are UrgentMessages, NewMessages and OldMessages. Retain the raw response and collection time with those values.
The action is a point-in-time aggregate. It does not identify individual messages, prove that the store is fresh, establish playback, or show that an endpoint received a message-summary notification.
Preserve MailboxStatus Waiting exactly as documented and observed
The branch-22-generated MailboxStatus reference documents the same full mailbox form and a returned ActionID. It describes Waiting as 0 when messages are waiting and 1 when no messages are waiting. Because that convention is easy to normalize incorrectly, keep the raw field, installed branch and maintenance release, and the response definition used by the collector.
Do not convert the field into a Boolean until the installed response has been checked against MailboxCount and evidence owned by the voicemail store. This guide retains the official branch-22 wording; it does not generalize an unobserved server response.
Choose detailed or folder-specific evidence separately
VoicemailBoxSummary is a separate AMI action for a detailed mailbox-content summary and uses separate Context and Mailbox fields. The VM_INFO dialplan function can return a count for a specified folder, defaulting its count query to INBOX. Neither is a synonym for the two mailbox actions.
Compare the same node, mailbox, context, backend, folder and time window. A disagreement caused by different folders or identifiers is not a parser defect.
Keep local voicemail, refresh and external MWI ownership distinct
VoicemailRefresh belongs to the IMAP voicemail path documented for externally modified mailboxes and can be scoped by mailbox and context. MWIGet and MWIUpdate belong to the external-MWI interface, while the version-sensitive MailboxStateChange action documents remote mailbox-state synchronization and explicitly excludes local mailboxes.
Do not use a write or refresh action to manufacture proof for a local app_voicemail query. Identify the module and system that owns state before issuing a bounded, authorized operation.
Accept the collector with bounded negative cases
In a controlled environment, test one authorized mailbox, a nonexistent mailbox, the same mailbox name in another context, an account without the required visibility, a reconnect and deliberately malformed numeric input downstream. Require the collector to distinguish success, empty, denied, malformed, unavailable and stale-source outcomes without widening manager permissions.
No PBX, mailbox, voicemail store, IMAP account, manager configuration, socket, session, request, response, MWI subscription, endpoint, phone, message, playback or live call was inspected or tested for this guide.
Add user-inventory evidence without flattening state
The AMI voicemail-user guide treats user information and IMAP status separately from count and waiting responses.
Keep count queries separate from control actions
The AMI MWI control guide distinguishes mailbox queries, external count mutation, remote synchronization and downstream delivery.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.