If you keep an eye on the Asterisk gitlog, you may have seen some additions to app_voicemail.
These changes include the ability to ‘show’ a mailbox in order to get a list of messages, as well as the ability to move, remove and forward a voicemail message via CLI and AMI.
This provides the same functionality as when accessing a mailbox via phone and in fact uses the same code underneath. This required exposing the ‘ID’ of the message which can be obtained via the new ‘show’ actions.
From the CLI, the following commands are now available and will auto-fill based on available contexts, users and messages:
voicemail show mailbox <mailbox> <context>
Show contents of mailbox <mailbox>@<context>
voicemail remove <mailbox> <context> <from_folder> <messageid>
Remove message <messageid> from <from_folder> in mailbox <mailbox>@<context>
voicemail move <mailbox> <context> <from_folder> <messageid> <to_folder>
Move message <messageid> in mailbox <mailbox>&<context> from <from_folder> to <to_folder>
voicemail forward <from_mailbox> <from_context> <from_folder> <messageid> <to_mailbox> <to_context> <to_folder>
Forward message <messageid> in mailbox <mailbox>@<context> <from_folder> to
mailbox <mailbox>@<context> <to_folder>
The AMI actions mirror the CLI. The mailbox is returned in a list format, similar to other requests for data.
VoicemailBoxSummary - Generate message list for a given mailbox
VoicemailRemove - Remove a message from a mailbox folder
VoicemailMove - Move a message from one folder to another within a mailbox
VoicemailForward - Copy a message from one folder in one mailbox
to another folder in another or the same mailbox.
Details on the manager action syntax can be found using the `manager show command like` command on the Asterisk CLI.
Hopefully this provides some new, useful functionality to system admins and devs out there!