Asterisk RealTime Voicemail
Asterisk RealTime Voicemail
Voicemail.conf Setup
::(Move voicemail.conf to some other directory. Create an empty voicemail.conf in its place.)Attention: Doesn't seem to work with asterisk 1.2.10, had to add at least the following in voicemail.conf:
[general]
searchcontexts=yes
Extconfig.conf Setup
Add the following line, swapping your own personal values if you wish:voicemail => mysql,asterisk,voicemail_users
You can change mysql to odbc if you want to use odbc.
You can change asterisk to be the name of your database.
You can change voicemail_users to be the name of the voicemail table we will create below.
Database Table
Lets create the table we need:NOTE: You can use any table name you wish, just make sure the table name matches what you have the family name bound to.
#
# Table structure for table `voicemail_users`
#
Extended table structure
CREATE TABLE `voicemail_users` (
`uniqueid` int(11) NOT NULL auto_increment,
`customer_id` varchar(11) NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` varchar(11) NOT NULL default '0',
`password` varchar(5) NOT NULL default '0',
`fullname` varchar(150) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`tz` varchar(10) NOT NULL default 'central',
`attach` varchar(4) NOT NULL default 'yes',
`saycid` varchar(4) NOT NULL default 'yes',
`dialout` varchar(10) NOT NULL default '',
`callback` varchar(10) NOT NULL default '',
`review` varchar(4) NOT NULL default 'no',
`operator` varchar(4) NOT NULL default 'no',
`envelope` varchar(4) NOT NULL default 'no',
`sayduration` varchar(4) NOT NULL default 'no',
`saydurationm` tinyint(4) NOT NULL default '1',
`sendvoicemail` varchar(4) NOT NULL default 'no',
`delete` varchar(4) NOT NULL default 'no',
`nextaftercmd` varchar(4) NOT NULL default 'yes',
`forcename` varchar(4) NOT NULL default 'no',
`forcegreetings` varchar(4) NOT NULL default 'no',
`hidefromdir` varchar(4) NOT NULL default 'yes',
`stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`uniqueid`),
KEY `mailbox_context` (`mailbox`,`context`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
Basic table structure
CREATE TABLE `voicemail_users` (
`uniqueid` int(11) NOT NULL auto_increment,
`customer_id` int(11) NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` int(5) NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`stamp` timestamp(14) NOT NULL,
PRIMARY KEY (`uniqueid`),
KEY `mailbox_context` (`mailbox`,`context`)
) TYPE=MyISAM;
NOTE: Voicemail `options` such as "attach=yes|saycid=yes" are supported in ARA by creating separate columns in the database, one for each option that you require:
`attach` varchar(3) NOT NULL default 'no',
`saycid` varchar(3) NOT NULL default 'yes',
`hidefromdir` varchar(3) NOT NULL default 'no',
NOTE: The index created on the 2 columns `mailbox` and `context` is because RealTime does its SELECT query using those two columns every time.
Testing
Throw some data into the above table and have fun.
NOTE: 'show voicemail users' will tell you "There are no voicemail users currently defined". This is CORRECT behavior.
Cheers,
Matthew
NOTE: 'uniqueid' column MUST be 'uniqueid' NOT 'id', DO NOT CHANGE to 'id', updating voicemail passwords will not work if changed.
Hard lesson learned.
Hubguru, JR
See Also
- Asterisk gui vmail.cgi: Web interface for voicemail
- Asterisk RealTime
- Asterisk RealTime Static
- Asterisk RealTime Sip
- Asterisk RealTime IAX
- Asterisk RealTime Extensions
- Asterisk RealTime MeetMe
- Asterisk Voicemail ODBC Storage: database storage of voicemails.
- Asterisk Realtime MWI Hacks


Comments
333Re: Realtime Voicemail - Mailbox still not found despite of beeing in database
lOOk
look@inetbox.sk
333Getting MWI on Polycoms working with Asterisk 1.6 Realtime
333VPN for VoIP Blocking
Currently I am using the VGCP, a new solution to solve the VoIP Blocking issue. Following is theirs website:
http://www.speed-voip.com/index-36.html
If any of you have interested, you may try to use it to solve your VoIP Blocking problems. Thanks.
Andy
andywong-01@hotmail.com
333Voicemail msg file name
333Need of mailbox_content KEY??
I have created the table "voicemails" without the KEY `mailbox_context` (`mailbox`,`context`) and it works well. In fact, monitoring the MySQL logs I just see the following QUERY when Asterisk needs to search for a voicemail number:
<BR><BR>
6 Init DB asterisk<BR>
6 Query SELECT * FROM voicemail WHERE mailbox = '202'
333Centralized voicemail?
I'd like to set up a voicemail server to catch overflow calls for my clients with an Asterisk box. Ideally I would have their Asterisk box have the database and mine would take calls on a VoIP DID and present their same voicemail box and store new message on their server. I would maintain a VPN between Asterisk boxes to do this?
Will Realtime Voicemail work like this or will a voicemail being deposited by another Asterisk box through off the first?
333Realtime Voicemail - Mailbox still not found despite of beeing in database
<i>WARNING30148: app_voicemail.c:2384 leave_voicemail: No entry in voicemail config file for '4200'</i><br><br>
As recommended here <a href="http://astbill.com/node/389">http://astbill.com/node/389</A> I uncommented the option <i>searchcontexts=yes</i> in <i>voicemail.conf</i> and now everything works perfectly.<br>
According to the abovementioned link this is an issue with context management in realtime mode as of Asterisk 1.2.<br>
Conrad
333
CREATE TABLE `voicemail_users` (
`uniqueid` bigint NOT NULL auto_increment,
`customer_id` bigint NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` bigint NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`stamp` timestamp(14) NOT NULL,
PRIMARY KEY (`mailbox`),
KEY `mailbox_context` (`mailbox`,`context`),
KEY `uniqueid` (`uniqueid`)
) TYPE=MyISAM;
333MySLQ errors when creating table.
Here is the code I used to go around this error:
CREATE TABLE `voicemail_users` (
`id` serial NOT NULL,
`customer_id` bigint NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` bigint NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`stamp` timestamp(14) NOT NULL,
PRIMARY KEY (`mailbox`),
KEY `mailbox_context` (`mailbox`,`context`)
) TYPE=MyISAM;
333MySLQ errors when creating table.
Here is the code I used to go around this error:
CREATE TABLE `voicemail_users` (
`id` serial NOT NULL,
`customer_id` bigint NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` bigint NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`stamp` timestamp(14) NOT NULL,
PRIMARY KEY (`mailbox`),
KEY `mailbox_context` (`mailbox`,`context`)
) TYPE=MyISAM;