Asterisk VoiceMail RealTime

From open-voip.org

Jump to: navigation, search

After having VoiceMail & MWI for our Asterisk Simple Realtime example we will move the voicemail.conf file to our RealTime MySql DB (Asterisk 1.6.1):

first we should add the following to the extconfig.conf file: voicemail => mysql,general,voicemail_users file will look now:

 [settings]
 sippeers => mysql,general,sip_buddies
 extensions => mysql,general,extensions
 voicemail => mysql,general,voicemail_users

add the voicemail table to the asteriskrealtime database:

 CREATE TABLE `voicemail_users` (
 `uniqueid` int(11) NOT NULL auto_increment,
 `customer_id` varchar(11) NOT NULL default '0',
 `context` varchar(50) NOT NULL,
 `mailbox` varchar(11) NOT NULL default '0',
 `password` varchar(5) NOT NULL default '0',
 `fullname` varchar(150) NOT NULL,
 `email` varchar(50) NOT NULL,
 `pager` varchar(50) NOT NULL,
 `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,
 `callback` varchar(10) NOT NULL,
 `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=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;

add the mailbox of 1000 and 2000 (do not forget to remove the old configuration from the voicemail.conf)

 INSERT INTO asteriskrealtime.voicemail_users 
 (customer_id, 	context, 	mailbox, 	PASSWORD, 	fullname, 	email )	
 VALUES	
 ('1000', 	'from-sip', 	'1000', '1234' , 	'User-A', 'UserA@myemail.com');
 INSERT INTO asteriskrealtime.voicemail_users 
 (customer_id, 	context, 	mailbox, 	PASSWORD, 	fullname, 	email )	
 VALUES	
 ('2000', 	'from-sip', 	'2000', '1234' , 	'User-B', 'UserB@myemail.com');

from asterisk cli (asterisk -r) check the realtim users:

 voicemail show users for from-sip
 =============================================================
 === Configured Voicemail Users ==============================
 =============================================================
 ===
 === Mailbox ...
 ===
 === ==> uniqueid: 16
 === ==> customer_id: 1000
 === ==> context: from-sip
 === ==> mailbox: 1000@from-s
 === ==> password: 1234
 === ==> fullname: User-A
 === ==> email: UserA@myemail.com
 === ==> tz: central
 === ==> attach: yes
 === ==> saycid: yes
 === ==> review: no
 === ==> operator: no
 === ==> envelope: no
 === ==> sayduration: no
 === ==> saydurationm: 1
 === ==> sendvoicemail: no
 === ==> delete: no
 === ==> nextaftercmd: yes
 === ==> forcename: no
 === ==> forcegreetings: no
 === ==> hidefromdir: yes
 === ==> stamp: 2009-08-30 19:41:03
 ===
 === ---------------------------------------------------------
 ===
 === Mailbox ...
 ===
 === ==> uniqueid: 17
 === ==> customer_id: 2000
 === ==> context: from-sip
 === ==> mailbox: 2000@from-s
 === ==> password: 1234
 === ==> fullname: User-B
 === ==> email: UserB@myemail.com
 === ==> tz: central
 === ==> attach: yes
 === ==> saycid: yes
 === ==> review: no
 === ==> operator: no
 === ==> envelope: no
 === ==> sayduration: no
 === ==> saydurationm: 1
 === ==> sendvoicemail: no
 === ==> delete: no
 === ==> nextaftercmd: yes
 === ==> forcename: no
 === ==> forcegreetings: no
 === ==> hidefromdir: yes
 === ==> stamp: 2009-08-30 19:41:03
 ===
 === ---------------------------------------------------------

Thats all!

Personal tools