Configuring Asterisk as an Answering Machine
Source: Tom's Guide US | Keywords: how, to, asterisk, answer
- 1. Introduction
- 2. Installing Debian Sarge
- 3. Installing the FXO and Asterisk
- 4. Configuring Asterisk
- 5. Configuring Asterisk as an Answering Machine
- 6. Finishing Touches
5. Configuring Asterisk as an Answering Machine
Now that we have a working system we'd like to create our own message and use it as the main greeting. The quickest way to do this is to let Asterisk record your message. The configuration for the menu system is stored in /etc/asterisk/extensions.conf. This file has many examples of different configurations you might want to use. For the time being we just want to add a temporary extension as a way to record our welcome message.
By the way, I recommend making a copy of this file before you started changing it so that you can refer to the original at a later time. You can do this via:
cp extensions.conf extensions.conf.bakNow you can open the file for editing
nano extensions.confAt the end of the file, create an extension by adding these three lines:
exten => 1205,1,Wait(2) exten => 1205,2,Record(/tmp/asterisk-recording:gsm) exten => 1205,3,HangupNow reload Asterisk (since you changed a configuration file, remember?) and dial back in from your outside line. Once the demo starts to explain the available extensions, dial 1205 to trigger your new extension. You should hear a beep and you can then record your greeting, which we will use instead of the demo greeting in a moment. Now that you've recorded your greeting, let's move it where Asterisk can use it:
mv /tmp/asterisk-recording.gsm /usr/share/asterisk/sounds/The extensions.conf file is very powerful and many articles could be written describing all of the functionality and flexibility it offers. But to keep things simple, we're going to just modify the demo. Once again, open the file with nano:
nano extensions.confAnd search for:
[demo]We'll first a few more seconds to give you time to answer the phone. Replace:
exten => s,1,Wait,1with
exten => s,1,Wait,7Next, comment out the default demo greetings by adding a semi-colon to the start of the lines:
;exten => s,5,BackGround(demo-congrats) ;exten => s,6,BackGround(demo-instruct)and add two new replacement instructions to play your greeting and send the caller to voicemail:
exten => s,5,BackGround(asterisk-recording) exten => s,6,Voicemail(u1234)To stay consistent with other prompts, let's add a method to hang up using the # key:
exten => #,1,HangupThere is a lot of demo functionality in the file that we don't really need, such as doing test VOIP calls and echo tests. So I added a semi-colon in front of every line down to:
; Give voicemail at extension 8500Optionally, you may also want to remove or comment out the 1205 extension we added earlier at the end of the file.
Once you've made and checked your changes, save them and exit nano and then reload the Asterisk configuration:
/etc/init.d/asterisk reloadIf you'd like to trim the extensions.conf file to a minimum here is how it would look:
[general] static=yes writeprotect=no [demo] exten => s,1,Wait,7 exten => s,2,Answer exten => s,3,DigitTimeout,5 exten => s,4,ResponseTimeout,10 exten => s,5,BackGround(asterisk-recording) exten => s,6,Voicemail(u1234) exten => #,1,Hangup exten => 8500,1,VoicemailMain exten => 8500,2,Goto(s,6) [default] include => demoAt this point your new answering machine is set up to receive calls and record voicemail. You can call in and check your messages by entering extension 8500 during the initial greeting. The default Asterisk voice will ask you for a mailbox number, which in our case is 1234. It will then ask you for a password, which is currently 4242.
- Previous page Configuring Asterisk
- Next page Finishing Touches




