Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Sign In

Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

You must login to add post.

How to enable realtime voice messages in Asterisk?

Introduction

This is blog is to introduce realtime voice messages in your existing Asterisk setup.

The main benefits of using realtime voice messages is as following:

  • Easy management of voice messages and voicemail greetings from centralized location i.e. database.
  • If there are multiple nodes of Asterisk serving as failing over or load balancing, then same voice messages and greetings will be available from every Asterisk node.
  • No syncing of voice messages and greetings will required for multiple Asterisk nodes.
  • Easy to remove old messages with just a single DB query.

Step # 1:

First of all enable odbc storage of voicemails from asterisk menuselect command.

# make menuselect 

Voicemail Build Options -> ODBC_Storage


# make && make install  

An asterisk service restart will be required after this change.

Step # 2:

Create following table in your MySQL database:
 CREATE TABLE `voicemessages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`msgnum` int(11) NOT NULL DEFAULT '0',
`dir` varchar(80) DEFAULT '',
`context` varchar(80) DEFAULT '',
`macrocontext` varchar(80) DEFAULT '',
`callerid` varchar(40) DEFAULT '',
`origtime` varchar(40) DEFAULT '',
`duration` varchar(20) DEFAULT '',
`mailboxuser` varchar(80) DEFAULT '',
`mailboxcontext` varchar(80) DEFAULT '',
`recording` longblob,
`flag` varchar(128) DEFAULT '',
`msg_id` varchar(40) DEFAULT '',
PRIMARY KEY (`id`),
KEY `uniqueid` (`uniqueid`),
KEY `msg_id` (`msg_id`),
KEY `origtime` (`origtime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Step # 3:

Secondly, add following DSN settings in odbc configurations (if not already added).


# /etc/odbc.ini 

[asteriskrvms]
Description = MySQL Asterisk Database
Driver = /usr/lib64/libmyodbc5.so
Server = <hostname>
User = <username>
Password = <username>
Database = asterisk
Port = 3306
Socket = /var/lib/mysql/mysql.sock

Step # 4:

Then, add relevant settings of DSN in ODBC resource configurations of asterisk.

# /etc/asterisk/res_odbc.conf

[voicemails]
enabled => yes
dsn => asteriskrvms
pre-connect => yes



$ asterisk -rx "module reload res_odbc.so"

Step # 5:

Then, add relevant settings of database table configurations in voicemail.conf of asterisk.

# /etc/asterisk/voicemail.conf

...
odbcstorage=voicemails
odbctable=voicemessage
...


$ asterisk -rx "voicemail reload"

Step # 6:

Following configurations will be required to redirect asterisk to enable logging voice messages in database.


# /etc/asterisk/extconfig.conf

[settings]
voicemessages =>odbc,
voicemails,voicemessages

$ asterisk -rx "core reload"

admin

admin

Enlightened

I like to receive and deal with challenging tasks. I am a very enthusiastic person and I think this is a strong point of mine. My friends say that I am a very funny with a good sense of humor. As soon as I meet new people who are happy to meet me, I feel extremely comfortable with them.

Leave a comment

You must login to add a new comment.