An introduction to Asterisk
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.
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:
||This is the base directory that contains the other configuration files. If you run the
||This file contains the base Asterisk configuration. Notably, it contains the directories that Asterisk will use for certain functions, such as sounds and logs.|
||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
||This file contains configuration for the PJSIP channel driver. You will configure phone endpoints in this file during future articles.|
||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.|
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.