How to enable voice mail option in asterisk
Enabling voicemail in Asterisk involves several steps:
Prerequisites:
- You have a working Asterisk installation.
- You have a voicemail.conf file in your Asterisk configuration directory (usually
/etc/asterisk/
). - You have a voicemail user account set up in your Asterisk database (usually
mysql
orpostgres
).
Step 1: Configure voicemail.conf
Edit the voicemail.conf
file to enable voicemail. You can do this using a text editor or a configuration management tool like asterisk-cli
.
Add the following lines to the [general]
section:
[general]
enabled=yes
This enables voicemail globally.
Step 2: Create a voicemail user account
Create a new user account in your Asterisk database using the mysql
or postgres
command-line tool. For example:
CREATE TABLE voicemail (
id int(11) NOT NULL auto_increment,
username varchar(30) NOT NULL default '',
password varchar(30) NOT NULL default '',
email varchar(50) NOT NULL default '',
PRIMARY KEY (id)
);
INSERT INTO voicemail (username, password, email) VALUES ('vmuser', 'vmuserpass', '[email protected]');
Replace vmuser
, vmuserpass
, and [email protected]
with your desired username, password, and email address.
Step 3: Configure voicemail extensions
Create a new extension in your Asterisk configuration file (extensions.conf
) to enable voicemail. For example:
[vm]
exten => 123,1,NoOp(VM Extension)
exten => 123,n,Voicemail(123,vmuser)
This creates a new extension 123
that forwards calls to the voicemail box of user vmuser
.
Step 4: Configure voicemail settings
Edit the voicemail.conf
file to configure voicemail settings, such as the maximum message length, the number of messages to store, and the email notification settings.
For example:
[general]
maxmsg=100
maxmsglen=300
emailnotify=yes
This sets the maximum number of messages to store to 100, the maximum message length to 300 seconds, and enables email notifications.
Step 5: Restart Asterisk
Restart your Asterisk service to apply the changes:
sudo service asterisk restart
Step 6: Test voicemail
Make a test call to the voicemail extension you created (e.g., 123
). You should hear a voicemail greeting, and you can leave a message. You can then check your voicemail box using the Voicemail
menu option in your Asterisk console or using a voicemail client like asterisk-cli
.
That's it! You should now have voicemail enabled in your Asterisk installation.