Skip to main content

An introduction to Asterisk

Interested in setting up a VoIP system? You might want to use Asterisk.
Introduction to Asterisk
"*see attached" by debaird™ is licensed under CC BY-SA 2.0

Asterisk is an open-source platform for building real-time communications applications. It is an extremely powerful tool. You can build a simple office network with a few phones, or you can create rich applications that perform external database lookups and make intelligent call routing decisions. Asterisk provides nearly limitless possibilities when it comes to building applications that use voice, video, and even SMS. Whether you want to build a simple phone system that allows internal users to place and receive calls, or you want to write a complex voice-driven application that integrates with your business, Asterisk has you covered.

Like any powerful tool, Asterisk has many moving pieces. In a previous article, you learned about Voice over IP, or VoIP. In this article, we will investigate these pieces to develop an understanding of how Asterisk works. Doing so will make it easy to install and configure an Asterisk-based phone system in future articles.

Asterisk’s architecture

One of the best parts about Asterisk is its extremely modular architecture. Not every VoIP system needs to leverage every feature that Asterisk can provide. The modular design of Asterisk allows you to only enable those modules that you need. It also means that you can independently configure and restart parts of your VoIP system without causing problems elsewhere.

I recommend that you read the official Asterisk architecture documentation before proceeding further. While I will touch on some of the high-level architectural components below, I recommend that you familiarize yourself by reviewing the official docs. It will only take a few minutes, and you’ll be better positioned to understand, install, and configure Asterisk.

The Asterisk core provides basic and essential functionality. It reads and parses configuration files, allows you to selectively load modules, and builds the dialplan, which you will learn about later.

Asterisk modules enable all other functionality in the system. Modules exist for many different functions, such as handling voicemail, connecting to external databases, and handling various media encoding types. We will mostly focus on the PJSIP Channel Driver module throughout this series of articles. A channel driver allows Asterisk to interact with external endpoints, such as the SIP (VoIP) phone that you will configure in future articles. Channels are powerful, and they can be bridged together to create voice applications. For example, Asterisk can bridge a SIP channel driver and a public switched telephone network (PSTN) channel driver to allow your VoIP phones to call traditional telephones.

The dialplan is the heart of an Asterisk system. It lets you tie everything else together: You can receive a call on a SIP channel module, connect it with an interactive voice response (IVR) application that you wrote, and potentially connect that back to a SIP channel module to route the call accordingly (e.g., to a human operator for further assistance). The dialplan is extremely powerful, and it effectively has its own programming language. The examples that you will see in this series should give you a small idea of what you can do with the dialplan, but I strongly recommend jumping into the official dialplan documentation if you want a more thorough idea of what you can do with your Asterisk system.

Important configuration files

Before you dive into configuring your new Asterisk system, you should be aware of a few important configuration files and directories. You will explore some of these further in future articles:

File Description
/etc/asterisk This is the base directory that contains the other configuration files. If you run the make samples command during installation (I’ll cover installation in the next article), then this directory will be populated with sample configuration files for many components of Asterisk.
/etc/asterisk/asterisk.conf This file contains the base Asterisk configuration. Notably, it contains the directories that Asterisk will use for certain functions, such as sounds and logs.
/etc/asterisk/modules.conf This file tells Asterisk which modules to load. Remember that Asterisk is modular, and you can turn off modules that you aren’t using. By default, all modules in /usr/lib/asterisk/modules are loaded (via the autoload=yes directive).
/etc/asterisk/pjsip.conf This file contains configuration for the PJSIP channel driver. You will configure phone endpoints in this file during future articles.
/etc/asterisk/extensions.conf This file is the dialplan that you learned about earlier. Asterisk considers an "extension" to be a collection of dialplan instructions. Extensions aren’t tied to physical phones. They’re just a place in the dialplan that contains code that you want to execute.


Wrapping up

This article built on your previous VoIP knowledge to introduce the basics of the Asterisk open source private branch exchange (PBX)—PBX is just a fancy way of describing a phone system. You learned about the general architecture of Asterisk and found helpful documentation resources to further explore. You also learned about the main configuration files that you will be using to build a basic VoIP system. The next article in this series will introduce you to building and installing Asterisk.

Want more on networking topics? Check out the Linux networking cheat sheet.

Topics:   Networking  
Author’s photo

Anthony Critelli

Anthony Critelli is a Linux systems engineer with interests in automation, containerization, tracing, and performance. He started his professional career as a network engineer and eventually made the switch to the Linux systems side of IT. He holds a B.S. and an M.S. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.