Template is not defined.

Part 1 – Asterisk Architecture: A Definitive Guide to Understanding Asterisk

What is Asterisk?

Asterisk is an open-source Telephony Enterprise software that provides a complete platform for building communication/Telephony applications. It is widely used in VoIP (Voice over Internet Protocol) applications and supports various communication protocols such as SIP (Session Initiation Protocol), H.323, and IAX (Inter-Asterisk eXchange).

Basic asterisk architecture
Figure 1 – simplified diagram intended to illustrate the relationships of some major Modules in the Asterisk Architecture to each other and to entities outside Asterisk. It is useful to understand how a component may relate to things outside Asterisk as Asterisk is not typically operating without some connectivity or interaction with other network devices or files on the local system.

The architecture of Asterisk is modular and flexible, allowing users to customize and extend the platform to fit their specific communication needs. The architecture can be divided into four main components:

  • Asterisk Core
    • Channels drivers
    • Applications
    • Add-ons

Asterisk Core

The Asterisk Core is the heart of the Asterisk architecture. It provides the fundamental functionality for processing all modules that makes asterisk functional like call handling, routing, and media processing. The Core includes the call manager, which manages incoming and outgoing calls, the media manager, which manages audio and video streams, and the channel driver interface, which provides an abstraction layer for communication protocols.

Detailed Diagram of Asterisk Architecture
Figure 2: Detailed Diagram of Asterisk Architecture showing the Core

Here are the key components included in the Asterisk Core:

  1. Channel Drivers: Asterisk Core includes a set of channel drivers that enable communication with various types of endpoints and networks. These drivers facilitate connectivity with traditional telephony interfaces (Analogue, Digital, and ISDN), Voice over IP (VoIP) protocols (SIP, IAX, H.323), and other communication technologies.
  2. Dialplan: The Dialplan is a powerful scripting language in Asterisk that defines call routing and call handling logic. It allows you to specify how calls are processed, including call routing, call manipulation, and interaction with various modules and applications.
  3. Call Control: Asterisk Core provides call control functions to manage incoming and outgoing calls, call setup, call termination, call transfer, call hold, call forwarding, call parking, and other call-related operations.
  4. Media Handling: The Asterisk Core includes media handling capabilities for audio and video streams. It supports audio Codecs for voice transmission and can handle media processing tasks such as recording, playback, conferencing, mixing, and transcoding.
  5. Application Interfaces: Asterisk Core offers APIs (Application Programming Interfaces) that allow developers to interact with the system and build custom applications. The APIs include the Asterisk Gateway Interface (AGI) for external script integration, the Asterisk Manager Interface (AMI) for remote management and control, and the Asterisk RESTful Interface (ARI) for building custom telephony applications.
  6. Resource Management: Asterisk Core manages system resources such as channels, timers, and memory to optimize performance and handle concurrent operations effectively.
  7. Logging and Debugging: Asterisk Core provides logging and debugging facilities to aid in troubleshooting and monitoring system behaviour. It allows you to configure log levels, log file locations, and gather diagnostic information for analysis.
  8. Configuration Framework: Asterisk Core includes a flexible and extensive configuration framework that allows you to customize the behaviour of the system. It provides configuration files where you can define settings for various components and modules in Asterisk.

These components collectively form the Asterisk Core, providing the essential building blocks for creating robust and feature-rich communication applications and services.

Modules

Asterisk is built on modules. A module is a loadable component that interacts with the asterisk core API to provide specific functionality; such as a channel driver (for example, chan_pjsip.so) or a resource that allows connection to an external technology (such as func_odbc.so). Asterisk modules are loaded based on the parameters defined in the /etc/asterisk/modules.conf file.

It is actually possible to start Asterisk without any modules at all, although in this state it will not be capable of doing anything.

The Types of Modules in Asterisk

We will explore the different types of modules available in Asterisk. The types of modules in Asterisk include the following:

For this article, We have labelled asterisk modules based on status, usage and popularity.

Popularity Legend
  • Essential: This module is one you’ll never want to be without.
  • Useful: This module is current, maintained, popular, and recommended.
  • Usable: The module works but may be incomplete and/or is not recommended
  • New: This module is new, it works but its completeness is unknown.
  • Insignificant: Very Old modules. May be incompatible & has no community support.
  • Unreliable: The module is new and is in testing. Not recommended for Production
  • Deprecated: This module has been replaced by something considered superior.
  • Limited: This module has limitations that may make it unsuitable to your requirements.

Channel Driver Modules

Without channel drivers, Asterisk would have no way to make or receive calls. Asterisk Core includes a set of channel drivers that enable communication with various types of endpoints and networks. These drivers facilitate connectivity with traditional telephony interfaces (Analogue, Digital, and ISDN), Voice over IP (VoIP) protocols (SIP, IAX, H.323), and other communication technologies. These modules are responsible for managing communication between the Asterisk server and the outside world.

Some examples of channel modules and their magnitude of importance include:

NamePurposeStatus
chan_sipThe SIP (Session Initiation Protocol) channel driver for VoIP communication using the SIP protocol. (For newer asterisk installations, use chan_pjsipEssential
chan_pjsipThe PJSIP channel driver, a more modern and flexible replacement for chan_sip, supporting SIP and additional protocols. See also: chan_sip vs chan_pjsipEssential (for newer Installs)
chan_dahdiDigium Asterisk Hardware Device Interface (DAHDI)Provides support for DAHDI (Digium Asterisk Hardware Device Interface), which is used to connect Asterisk to analogue and digital telephony networks. It consists of two parts.

1. The DAHDI-Linux project contains the individual board drivers for the supported hardware.
2. The DAHDI-Tools project contains an assortment of user space utilities that are used to set up and test the drivers.

Image Source: Asterisk Wiki
Useful
chan_iax2The IAX2 (Inter-Asterisk eXchange version 2) channel driver for communication between Asterisk servers and IAX-compatible endpoints.Useful
chan_skinnySkinny or SCCP (Skinny Client Control Protocol), is a channel driver in Asterisk that provides support for Cisco IP phones. It allows Asterisk to communicate and interact with Cisco Unified Communications Manager (formerly known as Cisco CallManager) using the Skinny protocol.Useful
Table 3.1. Channel Driver Modules
For Popularity comments meaning, See also Popularity/Status Legend

Call Detail Recording Modules

SIP (Session Initiation Protocol) is a protocol used to initiate, manage, and terminate real-time communication sessions over the Internet. SIP records provide more detailed information about a call, such as the codecs used, the quality of service, and the network information.

While the CDR is produced after the call ends, the SIP record is created when the call begins. CDRs are transferred to other systems for use in various business cases like billing and reporting.

While CDRs are focused on call management and analysis, SIP records provide a more comprehensive picture of the technical aspects of a call. Both types of records are valuable in their own right and can be used together to gain a complete understanding of your communications system.

The CDR modules, listed in Table 3.2., “Call detail recording modules”, are designed to facilitate as many methods of storing call detail records as possible. You can store CDRs in a file (default), a database, RADIUS, or Syslog.

Call detail records are not intended to be used in complex billing applications. If you require more control over billing and call reporting, you will want to look at channel event logging. The advantage of CDR is that it just works.

NamePurposePopularity/Status
cdr_adaptive_odbcAllows writing of CDRs through ODBC framework with ability to add custom fieldsUseful
cdr_csvWrites CDRs to disk as a comma-separated values fileUsable
cdr_customAs above, but allows for the addition of custom fieldsUseful
cdr_managerOutputs CDRs to Asterisk Manager Interface (AMI)Useful
cdr_odbcWrites CDRs through ODBC frameworkUsable
cdr_pgsqlWrites CDRs to PostgreSQLUseful
cdr_radiusWrites CDRs to RADIUSUsable—does not support custom fields
cdr_sqliteWrites CDRs to SQLite2 databaseDeprecated—use sqlite3_custom
cdr_sqlite3_customWrites CDRs to SQLite3 with custom fieldsUseful
cdr_syslogWrites CDRs to syslogUseful
cdr_tdsWrites CDRs to Microsoft SQL or SybaseUsable—requires an old version of libtds
Table 3.2. Call detail recording modules

Channel Event Logging Modules

Channel event logging provides much more powerful control over reporting of call activity. By the same token, it requires more careful planning of your dialplan, and by no means will it work automatically. Asterisk’s CEL modules are listed in Table 3.3, “Channel event logging modules”.

NamePurposePopularity/Status
cel_customCEL to disk/fileUseful
cel_managerCEL to AMIUseful
cel_odbcCEL to ODBCUseful
cel_pgsqlCEL to PostgreSQLUseful
cel_radiusCEL to RADIUSUsable—does not support custom fields
cel_sqlite3_customCEL to Sqlite3Useful
cel_tdsCEL to Microsoft SQL or SybaseUsable—requires an old version of libtds
Table 3.3. Channel event logging modules

Codec modules

When two endpoints (such as phones or softphones) communicate over a VoIP system, they need to agree on the same codec to use for the call. A codec is a method of encoding and decoding audio or video data, and different codecs have different levels of compression and quality. Asterisk Codec modules are responsible for encoding and decoding audio and video signals. Asterisk supports a wide range of codecs, including G.711, G.729, and H.264. Codec modules are used to ensure that audio and video signals are transmitted in the most efficient and effective manner possible. Some examples of codec modules include:

NamePurposePopularity
codec_alawA-law Pulse Code Modulated (PCM) codec is used all over the world on the PSTN (except Canada/USA). This codec (along with ulaw) should be enabled on all your channelsEssential
(Excellent Quality)
codec_ulawMu-law PCM codec used on PSTN in Canada/USA. It’s more formally written as μ-law, but not many people have the Greek letter μ on their keyboard, so it’s popularly written as ulaw. This is often the default codec and should be enabled on all your channelsEssential (Excellent Quality)
codec_dahdiUtilizes proprietary Digium hardware transcoding cardEssential
codec_a_muA-law to mu-law direct converterUseful
codec_opusBitrates from 6 kb/s to 510 kb/s (Narrowband to Wideband). Opus is unmatched for interactive speech and music transmission over the Internet but is also intended for storage and streaming applications.Useful
codec_g722Wideband audio codec ITU standard codec that provides 7 kHz wideband audio at data rates from 48, 56 and 64 kb/s.Useful (High Definition)
codec_gsmGlobal System for Mobile Communications (GSM) codec. Compress 3.1 kHz audio into between 6.5 and 13 kb/sUsable
codec_resampleFor SLIN Codec. Resamples between 8-bit and 16-bit signed linear. Usable
codec_h264provides support for the H.264 video codec, which is commonly used in video conferencing applications.Useful
Table 1: Asterisk Channels. Learn more about Supported Channel Drivers in Asterisk

Format Interpreter modules

Format modules are responsible for converting audio and video signals from one format to another. Asterisk supports a wide range of audio and video formats, including WAV, MP3, and AVI. Format modules are used to ensure that audio and video signals are compatible with the receiving device. Some examples of format modules include:

NamePlays files stored inDistributed with AsterisksPopularity
format_g722G.722 .g722YesUseful
format_wav.wavYesUseful
format_g729Support G.729 .g729 which is commonly used for VoIP callsCodec (NO) / Format (YES)Useful
format_sln8-bit signed linear .sln .rawYesUseful
format_sln1616-bit signed linear .sln16YesUseful
format_pcmVarious Pulse-Coded Modulation formats:  .alaw,  .al,  .alw, .pcm,  .ulaw,  .ul,  .mu, .ulw,  .g722,  .au YesUseful
format_siren14G.722.1 Annex C (14 kHz) .siren14YesNew
format_siren7G.722.1 (7 kHz) .siren7YesNew
format_h264H.264—video .h264YesUsable
format_h263H.263—video .h263YesUsable
format_ogg_vorbisOgg container .oggCodec (NO) / Format (YES)Usable
format_gsmRPE-LTP (original GSM codec) .gsmYesUsable
format_wav_gsmGSM audio in a WAV container .WAV, .wav49YesUsable
Table 2: Asterisk Format interpreters. Learn more about Supported Format interpreters
For Popularity comments meaning, See also Popularity/Status Legend

Application modules

Application modules provide the core functionality for Asterisk applications. These modules allow developers to create custom applications that can interact with the Asterisk server. Some examples of application modules includes:

NamePurposePopularity/Status
app_adsiprogLoads Analog Display Services Interface (ADSI) scripts into compatible analog phonesInsignificant
app_alarmreceiverSupports receipt of reports from alarm equipmentInsignificant
app_amdDetects answering machinesUnreliable
app_authenticateCompares dual-tone multi-frequency (DTMF) input against a provided string (password)Useful
app_cdrWrites ad hoc record to CDRUseful
app_celgenusereventGenerates user-defined events for CELNew
app_chanisavailChecks the status of a channelUnreliable
app_channelredirectForces another channel into a different part of the dialplanUseful
app_chanspyLoads Analog Display Services Interface (ADSI) scripts into compatible analogue phonesUseful
app_confbridgeProvides conferencing (new version)New— not fully featured yet
app_controlplaybackPlays back a prompt and offers fast forward and rewind functionsUseful
app_dahdibargeAllows barging in on a DAHDI channel.
Deprecated—see app_chanspy
Deprecated
app_dahdirasCreates a RAS server over a DAHDI channel (no modem emulation)Insignificant
app_dbUsed to add/change/delete records in Asterisk’s built-in Berkeley database
Deprecated—see  func_db
Deprecated
app_dialUsed to connect channels together (i.e., allow users to make phone calls)Essential
app_dictatePlays back a recording and offers start/stop functionsUseful
app_directed_pickupAnswers a call for another extensionUseful
app_directoryPresents the list of names from  voicemail.confUseful
app_disaProvides dialtone and accepts DTMF inputUseful
app_dumpchanDumps channel variables to Asterisk command-line interface (CLI)Useful
app_echoLoops received audio back to source channelUseful
app_execContains Exec()TryExec(), and ExecIf(); executes a dialplan application based on conditionsUseful
app_externalivrControls Asterisk as with an AGI, only asynchronouslyUseful
app_faxProvides SendFax()  and ReceiveFax()Useful
app_festivalEnables basic text to speech using Festival TTS engineUsable
app_flashPerforms a hook-switch flash on channels (primarily analog)Useful
app_followmePerforms find me/follow me functionality based on followme.confUseful
app_forkcdrStarts new CDR record on current callUsable
app_getcpeidGets the ADSI CPE IDInsignificant
app_icesSends audio to an Icecast serverUsable
app_imageTransmits an image to supported devicesLimited
app_ivrdemoSample application for developersInsignificant
app_jackWorks with JACK Audio Connection Kit to share audio between compatible applicationsUseful
app_macroTriggers dialplan macros. Useful up to Asterisk 16.
Deprecated—see  GoSub() for newer installs
Deprecated
app_meetmeProvides multiparty conferencingUseful— fully featured
app_milliwattGenerates 1004-Hz tone for testing loss on analog circuitsUseful
app_minivmProvides primitive functions to allow you to build your own voicemail application in dialplanUsable
app_mixmonitorRecords both sides of a call and mixes them togetherUseful
app_morsecodeGenerates Morse codeUsable
app_mp3Uses mpg123 to play an MP3Insignificant
app_nbscatStreams audio from Network Broadcast Stream (NBS)Insignificant
app_originateAllows origination of a callUseful
app_osplookupPerforms Open Settlement Protocol (OSP) lookupUsable
app_pageCreates multiple audio connections to specified devices for public address (paging)Useful
app_parkandannounceEnables automated announcing of parked callsUsable
app_playbackPlays a file to the channel (does not accept input). plays back audio files or recorded messages.Useful
app_playtonesPlays pairs of tones of specified frequenciesUseful
app_privacyRequests input of caller’s phone number if no CallerID is receivedInsignificant
app_queueProvides Automatic Call Distribution (ACD)Useful
app_readRequests input of digits from callers and assigns input to a variableUseful
app_readextenRequests input of digits from callers and passes call to a designated extension and contextUsable
app_readfileLoads contents of a text file into a channel variable
Deprecated—see the FILE() function in func_env
Deprecated
app_recordRecords received audio to a file, i.e. records audio messages or phone calls.Useful
app_rptProvides a method to interface with an audio board for the app_rpt projectLimited
app_sayunixtimePlays back time in specified formatUseful
app_senddtmfTransmits DTMF to calling partyUseful
app_sendtextSends a text string to compatible channelsInsignificant
app_setcalleridSets CallerID on a channel
Deprecated—see  func_callerid
Deprecated
app_skelSample application for developersUseful
app_smsSends SMS message in compatible countriesLimited
app_softhangupRequests hangup of channelUseful
app_speech_utilsProvides utilities relating to speech recognitionUseful
app_stackProvides Gosub(),  GoSubIf()Return()StackPop()LOCAL(), and  LOCAL_PEEK()Essential
app_systemExecutes commands in a Linux shellUseful
app_talkdetectSimilar to app_background, but allows for any received audio to interrupt playbackUseful
app_testClient/server testing applicationUsable
app_transferPerforms a transfer on the current channelUseful
app_urlPasses a URI to the called channelLimited
app_usereventGenerates a custom event in the Asterisk Manager Interface (AMI)Useful
app_verboseGenerates a custom event in the Asterisk CLIUseful
app_voicemailProvides voicemail functionality for users.Essential
app_waitforringWaits for a RING signalling event (not to be confused with RINGING); most likely unnecessary, as only chan_dahdi with analogue channels where ringing is received (such as an FXO port) generates the RING signalling eventInsignificant
app_waitforsilenceIncludes WaitForSilence()  and  WaitForNoise(); listens to the incoming channel for a specified number of milliseconds of noise/silenceUseful
app_waituntilWaits until the current Linux epoch matches the specified epochUseful
app_whileIncludes While()EndWhile(), ExitWhile(), and  ContinueWhile(); provides while-loop functionality in the dialplanUseful
app_zapatellerGenerates SIT tone to discourage telemarketersUsable

Bridging Modules

Bridging modules perform the actual bridging of channels in the bridging API. When a bridge is created, it acts as a central hub, handling the media streams between multiple participating channels and allowing for seamless communication between endpoints. The Bridge module supports various bridge technologies, including mixing, forwarding, and handling different media types (e.g., voice, video). It enables the establishment of conference calls, calls transfers, call forwarding, and other advanced call routing functionalities.

Each bridge module provides different features, which get used in different situations depending on what a bridge needs. The modules listed in the Table below, “Bridging modules”, is currently only used for (and are essential to) app_confbridge.

Note: The ConfBridge module is specifically designed to facilitate conference calls within Asterisk. It allows multiple participants to join a conference bridge and engage in real-time audio and optionally video communication. ConfBridge supports features like participant muting, moderation controls, dynamic conference creation, and customizable conference layouts. It provides a robust and scalable solution for hosting audio and video conferences.

NamePurposePopularity/Status
bridge_builtin_featuresPerforms bridging when utilizing built-in user features (such as those found in features.conf).New
bridge_multiplexedPerforms complex multiplexing, as would be required in a large conference room (multiple participants). Currently only used by app_confbridge.New
bridge_simplePerforms simple channel-to-channel bridging.New
bridge_softmixPerforms simple multiplexing, as would be required in a large conference room (multiple participants). Currently only used by app_confbridge.New
Asterisk Bridging modules

Some other important Asterisk Bridge modules

Module NameFilenameDescription
Bridgebridge.soThe core bridging module responsible for creating bridges and managing media streams between channels.
ConfBridgeres_conf_bridge.soEnables conference call functionality, allowing multiple participants to join a conference bridge.
ChanSpychan_spy.soProvides call monitoring and eavesdropping capabilities, allowing authorized users to listen in on active calls.
Transferapp_transfer.soEnables call transfer functionality, allowing users to transfer ongoing calls to different destinations.
Local Bridgingres_local.soSupports local bridging of channels within the same Asterisk server for internal calls.
Remote Bridgingres_rtp_asterisk.soEnables bridging of channels across multiple Asterisk servers, facilitating communication between instances.
A concise overview of the bridging modules available in Asterisk, including their module names, corresponding filenames, and brief descriptions of their functionalities.

DialPlan Function modules

Function modules provide additional functionality for Asterisk applications. These modules allow developers to create custom functions that can be used in dialplan scripts. Some examples of function modules include:

NamePurposePopularity/Status
func_aesEncrypts/decrypts an AES stringUseful
func_audiohookinheritConverts supplied string to a SHA1 hashUseful
func_base64Encodes/decodes a base-64 stringUsable
func_blacklistWrites/reads blacklist in astdbUseful
func_callcompletionGets/sets call completion configuration parameters for the channelNew
func_calleridGets/sets CallerID. allows users to modify or manipulate the caller ID information that is displayed on the receiving device.Useful
func_cdrGets/sets CDR variableUseful
func_channelGets/sets channel informationUseful
func_configIncludes AST_CONFIG(); reads variables from config fileUsable
func_connectedlineChanges connected line information on supported handsetsNew
func_curlUses cURL to obtain data from a URIUseful
func_cutSlices and dices stringsUseful
func_dbProvides astdb functions. allows users to store and retrieve data fromUseful
func_devstateIncludes AST_CONFIG(); reads variables from the config fileUseful
func_dialgroupCreates a group for simultaneous dialingUseful
func_dialplanValidates that designated target exists in dialplanUseful
func_enumPerforms ENUM lookupUseful
func_envGets the state of deviceUseful
func_extstateReturns status of a hinted extensionUseful
func_globalGets/sets global variablesUseful
func_groupcountGets/sets channel count for members of a groupUseful
func_iconvConverts between character setsUsable
func_lockIncludes LOCK()UNLOCK(), and TRYLOCK(); sets a lock that can be used to avoid race conditions in the dialplanUseful
func_logicIncludes ISNULL(),  SET()EXISTS()IF()IFTIME(), and IMPORT(); performs various logical functionsUseful
func_mathIncludes MATH()INC(), and DEC(); performs mathematical functionsUseful
func_md5Converts supplied string to an MD5 hashUseful
func_moduleChecks to see if supplied module is loaded into memoryUsable
func_odbcAllows dialplan integration with ODBC resourcesUseful
func_pitchshiftShifts the pitch of an audio streamUseful
func_randReturns a random number within a given rangeUseful
func_realtimePerforms lookups within the Asterisk Realtime Architecture (ARA)Useful
func_redirectingProvides access to information about where this call was redirected fromUseful
func_sha1Performs string format functions similar to C function of the same nameUseful
func_shellPerforms Linux shell operations and returns resultsUseful
func_speexReduces noise and performs dB gain/loss on an audio streamUseful
func_sprintfPerforms string format functions similar to C function of same nameUseful
func_srvPerform SRV lookups in the dialplanUseful
func_stringsIncludes over a dozen string manipulation functionsUseful
func_sysinfoGets system information such as RAM, swap, load average, etc.Useful
func_timeoutGets/sets timeouts on channelUseful
func_uriConverts strings to URI-safe encodingUseful
func_versionReturns Asterisk version informationUsable
func_vmcountReturns count of messages in a voicemail folder for a particular userUseful
func_volumeSets volume on a channelUseful
Table Dialplan functions
For Popularity comments meaning, See also Popularity/Status Legend

Resource Modules

Resource modules integrate Asterisk with external resources. For example, res_odbc allows Asterisk to interoperate with ODBC database connections. Below is a table for the currently available resource modules in asterisk

NamePurposePopularity/Status
res_adsiProvides ADSIEssential
res_ael_shareProvides shared routines for use with pbx_aelEssential if you’re using AEL
res_agiProvides Asterisk Gateway InterfaceUseful
res_aisProvides distributed message waiting for the indication (MWI) and device state notifications via an implementation of the AIS standard, such as OpenAISUseful
res_calendarEnables base integration to calendaring systemsUseful
res_calendar_caldavProvides CalDAV-specific capabilitiesUseful
res_calendar_exchangeProvides MS Exchange capabilitiesUseful
res_calendar_icalendarProvides Apple/Google iCalendar capabilitiesUseful
res_clialiasesCreates CLI aliasesUseful
res_clioriginateOriginates a call from the CLIUsable
res_config_curlPulls configuration information using cURLUseful
res_config_ldapPulls configuration information using LDAPUsable
res_config_odbcPulls configuration information using ODBCUseful
res_config_pgsqlPulls configuration information using PostgreSQLUsable
res_config_sqlitePulls configuration information using SQLiteUsable
res_convertUses the CLI to perform file conversionsUsable
res_cryptoProvides cryptographic capabilitiesUseful
res_curlProvides common subroutines for other cURL modulesUseful
res_faxProvides common subroutines for other fax modulesUseful
res_fax_spandspPlug-in for fax using the spandsp packageUseful
res_http_postProvides POST upload support for the Asterisk HTTP serverUsable
res_jabberProvides Jabber/XMPP resourcesUseful
res_limitEnables adjusting of system limits on the Asterisk processUsable
res_monitorProvides call recording resourcesUseful
res_musiconholdProvides music on hold (MOH) resourcesEssential
res_mutestreamAllows muting/unmuting of audio streamsNew
res_odbcProvides common subroutines for other ODBC modulesUseful
res_phoneprovProvisions phones from Asterisk HTTP serverNew
res_pktccopsProvides PacketCable COPS resourcesNew
res_realtimeProvides CLI commands for the Asterisk Realtime Architecture (ARA)Useful
res_rtp_asteriskProvides RTPEssential
res_rtp_multicastProvides multicast-RTPNew
res_security_logEnables security loggingNew
res_smdiProvides voicemail notification using the SMDI protocolLimited
res_snmpProvides system status information to an SNMP-managed networkUsable
res_speechGeneric speech recognition APILimited
res_timing_dahdiProvides timing using the DAHDI kernel interfaceUseful
res_timing_kqueueProvides timing using a kernel feature in some BSDs, including Mac OS XNew
res_timing_pthreadProvides timing using only parts of the standard pthread API; is less efficient but more portable than other timing modules.Useful
res_timing_timerfdProvides timing using the timerfd API provided by newer versions of the Linux kernelUseful
Asterisk Resouce Moduless
For Popularity comments meaning, See also Popularity/Status Legend

PBX Modules

The PBX modules are peripheral modules that provide enhanced control and configuration mechanisms. For example, pbx_config is the module that loads the traditional Asterisk dialplan. The currently available PBX modules are listed below:

NamePurposePopularity/Status
pbx_aelAsterisk Extension Logic (AEL) offers a dialplan scripting language that looks like a modern programming language.Usable
pbx_configThis is the traditional, and most popular, dialplan language for Asterisk. Without this module, Asterisk cannot read extensions.conf.Useful
pbx_dundiPerforms data lookups on remote Asterisk systems.Useful
pbx_loopbackPerforms something similar to a dialplan include, but in a deprecated manner.Insignificant
pbx_luaAllows creation of a dialplan using the Lua scripting language.Useful
pbx_realtimeProvides functionality related to the Asterisk Realtime Architecture.Useful
pbx_spoolProvides outgoing spool support relating to Asterisk call files.Useful
PBX modules
For Popularity comments meaning, See also Popularity/Status Legend

Addon Modules

Addon modules are community-developed modules with different usage or distribution rights from those of the main code. They are kept in a separate directory and are not compiled and installed by default. To enable these modules, use the menuselect build configuration utility. Currently available addon modules are listed in the Table Below:

Table 2.11. Addon modules

NamePurposePopularity/Status
app_mysqlExecutes MySQL queries with a dialplan applicationDeprecated—see func_odbc
app_saycountplSays Polish counting wordsDeprecated—now integrated in  say.conf
cdr_mysqlLogs call detail records to a MySQL databaseUsable—we recommend  cdr_adaptive_odbc instead
chan_mobileEnables making and receiving phone calls using cell phones over BluetoothLimited
chan_ooh323Enables making and receiving VoIP calls using the H.323 protocolUsable
format_mp3Allows Asterisk to play MP3 filesUsable
res_config_mysqlUses a MySQL database as a real-time configuration backendUseful
Addon Modules

Asterisks File Structure

Asterisk file structure may differ based on the Operating system of choice. After installing Asterisk on Ubuntu, the file structure follows a standard layout. Here is an overview of the important directories and files in the Asterisk installation on Ubuntu:

  1. Configuration Files
    • /etc/asterisk/: This directory contains the main configuration files for Asterisk, such as asterisk.conf, extensions.conf, pjsip.conf, and voicemail.conf. It also includes subdirectories for additional configuration files related to specific modules or functionalities.
  2. Binaries and Scripts:
    • /usr/sbin/asterisk: The main Asterisk binary, responsible for running the Asterisk service and handling call processing.
    • /usr/sbin/asterisk_start: A script used to start the Asterisk service.
    • /usr/sbin/asterisk_stop: A script used to stop the Asterisk service.
    • /usr/sbin/safe_asterisk: A script that provides a safe wrapper for starting Asterisk and automatically restarts it if it crashes.
  3. Libraries
    • /usr/lib/asterisk/: This directory contains shared libraries used by Asterisk.
  4. Module Configuration
    • /etc/asterisk/modules.conf: This file specifies which modules should be loaded by Asterisk during startup. It defines the list of modules and their configuration options.

      Asterisk modules are usually installed to the /usr/lib/asterisk/modules folder. You will not normally have to interact with this folder; however, it will be occasionally helpful to know where the modules are located. For example, if you upgrade Asterisk and select different modules during the menu select phase of the installation, the old (incompatible) modules from the previous Asterisk version will not be deleted, and you will get a warning from the install script. Those old files will need to be deleted from the modules folder. This can be done manually or with the “uninstall” make (make uninstall) target.
  5. Log Files
    • /var/log/asterisk/: This directory contains log files generated by Asterisk. It includes files such as messages, full, debug, and cdr-csv.
  6. Temporary and Runtime Files:
    • /var/run/asterisk/: This directory stores temporary and runtime files used by Asterisk, including the PID (Process ID) file.
  7. Sounds and Prompts:
    • /var/lib/asterisk/sounds/: This directory stores various sound files used by Asterisk for prompts, IVR menus, and voicemail recordings. It typically contains subdirectories for different languages and categories of sounds.
  8. Voicemail and Recording:
    The spool is where files that change frequently are stored in Linux. For Asterisk, the spool stores transient items such as voice messages, call recordings, call files, etcetera.
    • /var/spool/asterisk/voicemail/: This directory is used to store voicemail messages recorded by Asterisk users.
    • /var/spool/asterisk/monitor/: This directory is used to store call recordings made by Asterisk.
  9. Sample Configurations:
    • /usr/share/doc/asterisk/: This directory contains documentation and sample configuration files for Asterisk.
  10. Web Interfaces
    • /var/www/html/: Web interfaces for Asterisk typically reside in the /var/www/html/ directory on Ubuntu systems. This is the default web root directory where web-based applications, including Asterisk web interfaces, are placed.
      When installing a web interface for Asterisk, it often involves copying the necessary files and directories to the /var/www/html/ directory. This allows the webserver to serve the interface to users accessing the appropriate URL.

Please note that the exact file structure may vary depending on the specific version of Asterisk and the installation options chosen. Always refer to the actual file system on your Ubuntu system to ensure accuracy.

Table of Contents