Getting Started


One thing that daunts new Asterisk users (and often times compells them to start using a GUI front-end like FreePBX) is the number of config files they see after installing -- over 100 of them in Asterisk 11.

Don't despair!  It's not actually that complicated.  As mentioned in the build section, Asterisk is highly modularized, and all of these modules tend to have their own config files.  Most of them you need not concern yourself with - in fact, most of them you will likely never even use.

Starting from scratch

To prove that it's not as bad as it looks, we're going to start blank and make most of our own configurations from scratch (with a few exceptions.)  Let's start by moving all of the sample configs into a separate directory where we can still have them around for future reference.

cd /etc/asterisk
mkdir samples
mv ./*.* samples/

Don't "make samples" again in the future

If you recompile Asterisk (like updating to a newer version) don't do "make samples" again.  Doing so will overwrite your existing configs!  If you want a fresh set of samples for reference, copy them yourself out of the "configs" directory of the source into your /etc/asterisk/samples directory.

There's a few config files we need but can steal from the samples without modification:

cp samples/asterisk.conf ./
cp samples/modules.conf ./
cp samples/rtp.conf ./
cp samples/indications.conf ./
cp samples/logger.conf ./

asterisk.conf mostly defines filesystem paths for various things, and sets a few global defaults and options we don't need to worry about for now.

modules.conf controls what modules are automatically loaded (or prevented from being loaded) when Asterisk starts.  The default option "autoload=yes" will cause Asterisk to automatically load modules it needs, partly based on which config files it sees in /etc/asterisk.

rtp.conf is a very simple config that defines a range of ports Asterisk should use for incoming audio streams.  We'll get into this more later.

indications.conf defines progress tones (dialtones, busy signals, ringing, etc.) used in many different countries, and sets the default country to the US.

logger.conf sets up a general log file for Asterisk, as well as what gets logged to the console.

That's all we minimally need to get Asterisk running, even though it won't actually do anything interesting.  But let's start it up anyway:

/etc/init.d/asterisk start

This should run an Asterisk process in the background.  To connect to the main server in a console where we can interact with it, we run an Asterisk process using the -r switch, and turn up the console verbosity to 3 with vvv:

asterisk -rvvv

This should result in something like:

Connected to Asterisk 11.5.1 currently running on primer (pid = 27157)

Congratulations, you've built and run a PBX that doesn't do anything!

Now let's continue on by configuring SIP and getting a device working that we can play with.