Skip to main content

Understanding Key Elements of Asterisk for Building a Flexible Communication Platform

 There are several important elements in Asterisk that are essential to understand for building and managing a functional Asterisk system. Here are some of the key elements and their explanations:


Channels: Channels are the connection points between Asterisk and the outside world. They are used to handle calls, both inbound and outbound. Each channel represents a single call and can be associated with a SIP, IAX, or other protocol. For example, a SIP channel might be used to connect to a VoIP provider or to a softphone.


Dialplan: The dialplan is a set of instructions that Asterisk uses to route and process calls. It is essentially a script that tells Asterisk how to handle incoming calls, how to route them to specific endpoints, and what actions to take in certain situations. The dialplan is written in the Asterisk Extension Language (AEL) or in the Asterisk Dialplan Language (ADL). Here is an example of a simple dialplan that routes an incoming call to an extension:

Example:--  exten => 100,1,Dial(SIP/100)

In this example, the incoming call to extension "100" is routed to the SIP endpoint "100".


Applications: Applications are pre-built functions that can be used in the dialplan to perform specific tasks. They can be used to control call flow, play audio files, record calls, and perform many other functions. For example, the "Playback" application can be used to play a pre-recorded message to the caller. Here's an example of how to use the "Playback" application in the dialplan:

exten => 100,1,Answer()

same => n,Playback(hello-world)

same => n,Hangup()


In this example, when a call comes in to extension "100", Asterisk answers the call, plays the "hello-world" audio file, and then hangs up.


Modules: Modules are pieces of code that can be loaded into Asterisk to add new functionality or to extend existing features. There are many built-in modules in Asterisk, and third-party modules can also be added. For example, the "app_voicemail" module provides voicemail functionality in Asterisk.


Configuration files: Asterisk uses a set of configuration files to define how it operates. These files include "sip.conf" (for SIP configuration), "iax.conf" (for IAX configuration), "extensions.conf" (for dialplan configuration), and many others. These files are written in plain text and can be edited with a text editor. Here's an example of how to configure a SIP peer in the "sip.conf" file:

[my-sip-peer]

type=peer

host=192.168.0.100

disallow=all

allow=ulaw

In this example, a SIP peer named "my-sip-peer" is defined, with an IP address of 192.168.0.100. The "allow" directive specifies the codecs that are allowed for this peer.


Understanding these key elements is essential for building and managing an Asterisk system. By leveraging channels, dialplans, applications, modules, and configuration files, you can create a powerful, flexible, and scalable communication platform.


Comments