Use Voicemail accounts for other dialplan functions?


 New user of Asterisk, read through the Asterisk book, got 1.8.5 up and running in minutes on my Ubuntu 11.04 Server.  Calls are working great, using Sotel Systems Opti-Flex SIP service.  I'm looking to add a function to the extensions.conf dialplan which allows me to call system-hosted home automation commands via touch-tone control.  To prevent anyone from being able to open my garage, or turn on my lights - I need to do access control.

What I’d like to do is recycle the voicemail account access control for the new home automation functions so that users only need to manage one password - but I don’t see entries in the AsteriskDB for users/passwords, so there is nothing to compare what I can get the users to enter to. Does someone here know of a buried function in Asterisk somewhere to query if a user/password combo is valid? I don’t even need access within the dialplan to the login and password data, I just need a function to compare what I have to a group in the voicemail.conf group and give me a true/false result to act on - like:

${VMUSERAUTH(default/100/876895)} ; returns mailbox-object/null, 1/0, or True/False


default = the voicemail group
100 = the user’s mailbox number
876895 = the password

Any insight is greatly appreciated! :smiley:



Alltough a function FILE exists, allowing You to read from any File accessable by asterisk (as voicemail.conf is), this way seems to be too complicated to achieve Your goal.
A direect function for reading a config-section and interpret the results doesn’t exist in asterisk.
So what can You do? - I’Ve got two ideas:

Using Asterisk-AGI with a script (in Your favourite language) which will be able to interpret config-file-sections.

Placing the voicemail-configuration into Asterisk-Realtime (MYSQL,PostgreSQL or whatever You like) and using this in combination with func_odbc, whereas You question is just a metter of the SQL-statement to be used within func_odbc.

Hmmm… :open_mouth:

Where’s the smiley that slaps it’s forehead? You’re a genius - I’ll do option “A” since that’ll get me running without major changes to the Asterisk system software collection. Thanks! :smiley:


There is one more option:

Store the username/password pairs in AstDB and use those entrys for username and password checking.

CLI> core show application vmauthenticate

Hi As David said is the correct way of doing this

Authenticate with Voicemail passwords

VMAuthenticate([mailbox][@context][|options]): This application behaves the
same way as the Authenticate application, but the passwords are taken from
If the mailbox is specified, only that mailbox’s password will be considered
valid. If the mailbox is not specified, the channel variable AUTH_MAILBOX will
be set with the authenticated mailbox.

s - Skip playing the initial prompts.

Most things are possible in the Dialplan , using an AGI for a simple task that the dialplan is not the way to build a fast reliable and scalable system