AMI: Check If The User Has A Mailbox

Home » Asterisk Users » AMI: Check If The User Has A Mailbox
Asterisk Users 4 Comments

Hi list!

On an Asterisk-Server I have some users. Just two of them have a Mailbox. I want to write a little Web interface to manage many things and I’d like to have a menu point for the voicemail, but just if the user has a Mailbox.

I found the AMI-Command MailboxStatus, but it does not return what I need, since it returns 0 if the user has a Mailbox but no messages and if the user has no Mailbox…

Could someone suggest me a way to get this information?

Thanks a lot!
Luca Bertoncello

4 thoughts on - AMI: Check If The User Has A Mailbox

  • I don’t think you are going to be able to get that information using the AMI. You should be able to figure it out though by looking at the voicemail directory structure in /var/spool/asterisk/voicemail// or in your database if you’re using real time. It’s probably just as easy to write a script that will look for the proper directory as it is to write a script to query the AMI. Regards;
    John V.

    —–Original Message—

  • I don’t think the directory check method is reliable; a user can have a mailbox but if no messages have been left then the directory structure may not exist. Through the AMI you can show peer/user information and I believe it shows you the mailbox associated with user/peer.


    —–Original Message—

  • Hi Luca

    Would greping for the existence of the mailbox number in /etc/voicemail.conf do the trick?