Asterisk voicemail database

Database support in voicemail

NOTE: This is the old way of configuring voicemail users via a database, and will soon be obsoleted by the new asterisk realtime architecture (ARA) - see Asterisk RealTime. As of cvs stable release 1.0.7, realtime configuration is not available, it is currently only found in CVS-Head. This does not store the voicemail files, only the voicemail configuration. See also Asterisk Voicemail ODBC storage

The Asterisk voicemail system, comedian mail, supports configuration of mailboxes in a database. Voicemail supports both Postgres and MySQL databases. Work is going on to make it support UnixODBC.

This means:
  • All voicemail user configurations will be read dynamically from database
  • Users can change their voicemail passwords from inside voicemail or using a simple web-based UI

1. Download

Note that the MySQL support has been moved to asterisk-addons due to MySQL changing the licensing of their libraries to full GPL.

cd /usr/src
export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot
cvs login - the password is anoncvs.
cvs checkout asterisk-addons

2. Compile

cp asterisk-addons/mysql-vm-routines.h asterisk-0.7.2/apps
cd asterisk-0.7.2
vi apps/Makefile +14
make clean
make install

3. Configure in voicemail.conf

for mysql use:
In the [general] section in voicemail.conf specify


for postgresql use:
in [general]:

dboption=dbname=asterisk user=USERNAME password=PASSWORD

4. Configure database

Create a database (e.g. 'asterisk_vm') & a user which can access it (needs to have write access for password changes from inside VM).

For mysql table has to be called 'users' (hardcoded in .h file)

context char(79) DEFAULT '' NOT NULL,
mailbox char(79) DEFAULT '' NOT NULL,
password char(79) DEFAULT '' NOT NULL,
fullname char(79) DEFAULT '' NOT NULL,
email char(79) DEFAULT '' NOT NULL,
pager char(79) DEFAULT '' NOT NULL,
options char(159) DEFAULT '' NOT NULL,
stamp timestamp,
PRIMARY KEY (context,mailbox)

For postgres table has to be called 'voicemail'

CREATE TABLE voicemail (
context varchar(79) DEFAULT '' NOT NULL,
mailbox varchar(79) DEFAULT '' NOT NULL,
password varchar(79) DEFAULT '' NOT NULL,
fullname varchar(79) DEFAULT '' NOT NULL,
email varchar(79) DEFAULT '' NOT NULL,
pager varchar(79) DEFAULT '' NOT NULL,
options varchar(159) DEFAULT '' NOT NULL,
stamp timestamp,
PRIMARY KEY (context,mailbox)

Note that context refers to the Mailbox context, not extension context)
Note that the password is stored in plain text

See also

Created by: oej, Last modification: Tue 06 of Sep, 2005 (15:17 UTC) by flobi
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+