login | register
Fri 05 of Sep, 2008 [23:45 UTC]

voip-info.org

Discuss [7] History

Asterisk voicemail database

Created by: oej,Last modification on Tue 06 of Sep, 2005 [15:17 UTC] by flobi

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
USE_MYSQL_VM_INTERFACE=1
make clean
make
make install

3. Configure in voicemail.conf

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

dbuser=username
dbpass=password
dbhost=localhost
dbname=asterisk_vm

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)

CREATE TABLE users (
   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



Comments

Comments Filter
222

333voicemail only say "beep"

by tecnoxarxa, Friday 02 of March, 2007 [15:53:16 UTC]
All work fine, but now, voicemail only say "beep"

Any option for say automatic message for busy or others status ?
222

333Realtime Voicemail and vmail.cgi

by fidiasm, Friday 17 of February, 2006 [12:19:01 UTC]
I have configured all the Realtime voicemail and it´s working fine, but I also used vmail.cgi and now it´s not accepting authentication, do I have to change anything in the cgi file or voicemail.conf so it could work ?
222

333voicemail on and off

by edwig, Wednesday 09 of February, 2005 [16:32:19 UTC]
Is there also an option to let the user switch voicemail on and off?
222

333Can this work with MWI?

by , Wednesday 02 of February, 2005 [01:48:59 UTC]
How can I use MWI with database based voicemail config and mysql sipfriends?
222

333Re: Postgresql config

by , Wednesday 21 of July, 2004 [20:26:47 UTC]
There is an error in the schema above. Please remove the NOT NULL clause from the pager column. Also, I recommend renaming the primary key index to voicemail_pk, though you may choose any name you like.
222

333Postgresql config

by , Thursday 24 of June, 2004 [17:22:16 UTC]
Here is the schema for the table in postgresql:

CREATE TABLE public.voicemail
(
 context varchar(79) NOT NULL,
 mailbox varchar(79) NOT NULL,
 password varchar(79) NOT NULL,
 fullname varchar(79) NOT NULL,
 email varchar(79) NOT NULL,
 pager varchar(79) NOT NULL,
 options varchar(159),
 stamp timestamp,
 CONSTRAINT users_pk PRIMARY KEY (context, mailbox)
) WITHOUT OIDS;

Make sure the user asterisk uses to login with has rights to read the table.

To connect to the db, use the dboption keyword in the general section:
dboption=dbname=asteriskdb user=asteriskuser password=asteriskpw host=localhost port=5432

David
dfilion@dotality.com
222

333module won't load

by , Wednesday 02 of June, 2004 [02:12:07 UTC]
I followed the instructions, however, when asterisk comes up it
can't load the voicemail app. From /var/log/asterisk/messages:
Jun 1 19:03:13 WARNING16384: app_voicemail.so: load_module failed, returning -1
Jun 1 19:03:13 WARNING16384: Loading module app_voicemail.so failed!


When someone goes to Voicemail and tries to log in, ASTERISK DIES
immediately and with no messages w/o regard to the verbose setting.

Note: I did a make clean; make; make install. The make date on the .so in question is just before the asterisk binary.

How can I debug this or fix it? I had to return to non-sql so this would stay up... since it's a production box... but I can test on evenings.

Thanks

Ehud
gavron@wetwork.net