Like every other website on the planet, SmallNetBuilder uses cookies. Our cookies track login status, but we only allow admins to log in anyway, so those don't apply to you. Any other cookies you pick up during your visit come from advertisers, which we don't control.
If you continue to use the site, you agree to tolerate our use of cookies. Thank you!

Wi-Fi Router Charts

Click for Wi-Fi Router Charts

Mesh System Charts

Click for Wi-Fi Mesh System Charts

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.bak

Now you can open the file for editing

nano extensions.conf

At 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,Hangup

Now 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.conf

And search for:

[demo]

We'll first a few more seconds to give you time to answer the phone. Replace:

exten => s,1,Wait,1

with

exten => s,1,Wait,7

Next, 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,Hangup

There 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 8500

Optionally, 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 reload

If 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 => demo

At 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.

Support Us!

If you like what we do and want to thank us, just buy something on Amazon. We'll get a small commission on anything you buy. Thanks!

Don't Miss These

  • 1
  • 2