What Asterisk is, and what it is not
The project describes itself as "an Open Source PBX and telephony toolkit" and, more usefully, as "middleware between Internet and telephony channels on the bottom, and Internet and telephony applications at the top".2 Its documentation puts the purpose as "being an engine for building Real Time Communication systems and applications".5
In SIP terms Asterisk is a back-to-back user agent (B2BUA). The Asterisk documentation does not use that phrase, but its own description of a call is the definition. When one phone calls another, "The inbound channel is created from Alice's phone calling Asterisk", then "Asterisk then calls the extension dialed by Alice by creating an outbound channel to talk to Bob", and the two channels are put into a bridge.7 RFC 3261 defines a B2BUA as an entity that "receives a request and processes it as a user agent server" and then "acts as a user agent client (UAC) and generates requests"; "Unlike a proxy server, it maintains dialog state and must participate in all requests sent on the dialogs it has established."1
That one fact explains most of what Asterisk is good and bad at. Because it terminates both legs, it can answer a call, play a prompt, collect digits, record, transcode, conference and put people on hold: it is a media server as much as a signalling element. Because it holds state and usually media for every call, it is not the tool for routing very large numbers of registrations or calls that it never needs to touch. That job belongs to SIP proxies such as Kamailio and OpenSIPS, and a common production pattern is a proxy at the edge with Asterisk behind it doing the media work.
Our view: if your problem is "answer calls, run a phone menu, ring people, take voicemail", Asterisk is designed for exactly that. If your problem is "route a million registrations", it is the wrong layer, and no amount of tuning changes what a B2BUA is.
Licence and stewardship
Asterisk "is distributed under the GNU General Public License version 2 and is also available under alternative licenses negotiated directly with Sangoma US Inc."3 Two consequences in the licence file matter in practice:
- Loadable modules are covered. "If you obtained Asterisk under the GPL, then the GPL applies to all loadable Asterisk modules used on your system as well", with the exceptions the file lists. Sangoma, which "holds copyright and/or sufficient licenses to all components", can grant permission for proprietary modules.3
- External applications are not. For AMI, AGI and ARI, the file says "It is our belief that applications using these protocols to manage or control an Asterisk instance do not have to be licensed under the GPL", and adds a fallback grant if a court ever disagreed.3 This is why most commercial products built on Asterisk keep their logic in an external process talking ARI or AMI rather than in a C module.
The "Asterisk" name and logos are Sangoma trademarks.3 Sangoma describes itself on asterisk.org as "the primary sponsor and developer of Asterisk", and sells support; its top support level "requires the utilization of Certified Asterisk", a separate long-lived release line.4
The core concepts: channels, bridges, dialplan
Asterisk is a small core plus many modules. "The heart of any Asterisk system is the core", which "reads the configuration files, including dialplan and loads all the other modules"; "Other than functionality provided by the core of Asterisk, modules provide all other functionality."5 Five ideas carry everything else.
Channels. "A channel is an entity inside Asterisk that acts as a channel of communication between Asterisk and another device."7 A two-party call is two channels. Each has its own variables, caller ID and state, and each can be hung up, redirected or recorded on its own.
Channel drivers. "Channel Drivers provide channels in Asterisk"7; they translate a device's signalling to the core.6 In the current source tree the drivers are chan_pjsip (SIP), chan_iax2 (IAX2), chan_dahdi (analogue and digital telephony cards), chan_websocket, chan_audiosocket, chan_rtp, chan_bridge_media, chan_motif (XMPP/Jingle), chan_unistim and chan_console.13 chan_sip, chan_skinny and chan_mgcp are gone; the section on chan_sip below has the versions.
Bridges. "In Asterisk, a bridge is the construct that shares media among Channels." There are two categories, two-party and multiparty. A core bridge is "the basic two-party bridge", where Asterisk handles the media and can transcode, record and run DTMF features. A native bridge happens "when both participants in a two-party bridge have similar channel technologies"; the remote variant sends media directly between the devices, is only possible with SIP channels, and is limited to cases where neither device is behind NAT. Mixing bridges serve conferences; holding bridges are a waiting area where participants cannot exchange media. Asterisk "will automatically choose the best mixing technology available based on the channels in the bridge" and can change it mid-call, for example when an attended transfer turns a two-party call into a three-way one.8 The implementations live in the source as bridge_simple, bridge_native_rtp, bridge_softmix and bridge_holding.16
The dialplan. "The core loads and builds the dialplan, which is the logic of any Asterisk system."5 It lives in extensions.conf and is "essentially a scripting language specific to Asterisk".10 It is organised into contexts ("the basic organizational unit"), each containing extensions ("a named set of actions"), each made of numbered priorities executed in order. You must declare priority 1 explicitly; after that n means "the previous priority number plus one", and same => saves repeating the extension.11 Patterns start with an underscore: X is any digit, Z is 1 to 9, N is 2 to 9, and the period and exclamation mark match the rest of the string. The documentation warns that those last two "match more than just digits. They match on characters", which matters for security.12
Applications and functions. Applications do things to a channel: answer it, play a prompt, dial. Functions read or set things about it, such as the outbound caller ID.6 In dialplan, Dial() is an application and ${CALLERID(num)} is a function.
Underneath sits the Stasis message bus, added in Asterisk 12: "an internal publish/subscribe message bus". Before it, core components were "responsible for updating AMI, the CDR Engine, and other modules"; afterwards, "the logic for AMI, CDRs, and other consumers of state is no longer tightly coupled with the real-time components".9 The same name appears on the Stasis dialplan application used by ARI, covered below.
Modules and the module loader
The documentation lists nine module types: channel drivers, dialplan applications, dialplan functions, resources (shared services such as music on hold and call parking), codecs, file format drivers, CDR drivers, CEL drivers (which log "what happened inside of Asterisk during a particular call") and bridge drivers.6 In the source tree the file name carries the type: chan_ files in channels/, bridge_ in bridges/, res_ in res/.131653
modules.conf controls loading. The sample ships with autoload=yes, meaning every module installed in the modules directory loads unless you say noload. It also documents require ("Asterisk will exit with a status code of 2 if a required module does not load") and says of the old preload trick: "There is no good reason left to use 'preload' anymore."17
Not every module is equally maintained. The documentation's support states are core ("supported by both Sangoma and the community"), extended ("supported by the Asterisk community, and may or may not have an active developer"; no bug-fix support from Sangoma) and deprecated ("The module will remain in the tree, but there is a better way to do it"). Deprecated modules are not built unless explicitly selected in menuselect.18
Our view: on a production box, turn autoload into an explicit list, or at least noload every channel driver and interface you do not use. Fewer loaded modules is a smaller attack surface, a faster start and fewer surprises after an upgrade. Put require = chan_pjsip.so in, so a broken build fails loudly instead of starting a PBX that cannot take calls.
PJSIP: chan_pjsip, res_pjsip and the objects
SIP in modern Asterisk is two layers. The channel driver is "chan_pjsip which depends on res_pjsip and its many associated modules"; "The res_pjsip module handles configuration", which is read from pjsip.conf.22 Features such as outbound registration, IP-based identification and ACLs are separate res_pjsip_* modules, each with its own configuration reference.22 Under both sits the PJPROJECT SIP stack; since the build uses the bundled copy by default ("Use bundled pjproject libraries (default)" in configure.ac), you normally never install it separately.60
Where chan_sip had one [peer] or [friend] section per device, PJSIP splits a device into several linked objects.35 This is the part people find confusing, and it is worth learning properly because every PJSIP problem is a problem with one of these links.
Object (type=) | What it is | Links to |
|---|---|---|
| transport | How res_pjsip "will operate at the transport layer": protocol, bind address, NAT addresses. Protocols are udp, tcp, tls, ws, wss and flow.2329 | Used by endpoints and registrations. Several may exist, but not two on the same IP and port, or IP and protocol.23 |
| endpoint | The profile of a device or provider: codecs, context, NAT and media behaviour. "Without an AOR, an endpoint can't be contacted."23 | Zero or more AORs, one inbound auth, outbound auth via outbound_auth, a transport.2327 |
| aor | Address of record: "tell Asterisk where an endpoint can be contacted", either from registrations or a static contact=.23 | Many endpoints to many AORs; each AOR holds contacts.23 |
| contact | A SIP URI where the AOR can be reached. Created by a REGISTER, or by contact= on the AOR.23 | Belongs to AORs.23 |
| auth | Credentials "related to inbound or outbound authentication".23 | Shared by any number of endpoints or registrations.23 |
| identify | Tells res_pjsip_endpoint_identifier_ip which endpoint an incoming request belongs to, by source address or header.2328 | Points at zero or one endpoint.23 |
| registration | An outbound REGISTER to a provider's registrar.2325 | Zero or one auth, at least one transport. No link to an endpoint.23 |
Scroll the table sideways to see every column.
That last row is the classic trap. The outbound registration documentation says the registration and the endpoint "are considered completely separate from each other, as far as Asterisk is concerned", and that to receive calls "you will need to set up an endpoint that represents this provider".25 A trunk that registers successfully but rejects every inbound call is almost always a registration with no matching endpoint and identify.
Smaller objects complete the set: domain_alias, acl (which "operates on all inbound SIP communication", independent of endpoints), and the system and global sections.23
How Asterisk decides who is calling
Every inbound SIP request has to be matched to an endpoint before anything else happens. The order is set by endpoint_identifier_order in the global section, and the compiled-in default is ip,username,anonymous.3031
- ip uses
identifyobjects.matchtakes "a comma-delimited list of IP addresses or hostnames", with CIDR or dotted-decimal masks; for a hostname, "Asterisk will resolve the hostname and add all A and AAAA records".match_headermatches on a SIP header value instead.28 - username matches "the username and domain in the From header", retrying on the username alone if the exact match fails. The per-endpoint
identify_byoption (defaultusername,ip) decides which methods an endpoint accepts, and also governs AOR matching for registrations: "You must list at least one method that also matches for AORs or the registration will fail."2927 - auth_username exists but carries a documented security cost: the Authorization header is absent on the first request, so the security event for an unmatched request has to be deferred, which "may result in a delay before an attack is recognized".29
- anonymous: "By default anonymous inbound calls via PJSIP are not allowed." To accept them you must define an endpoint named
anonymous, and the sample says plainly, "It is not recommended to accept anonymous calls."31
Two defaults deserve attention. An endpoint without a context lands in the context named default.27 And an AOR's max_contacts defaults to 0, so a phone cannot register at all until you raise it; the reference notes that to "stick with the older chan_sip behaviour" you set it to 1 with remove_existing=yes.29
Whatever context an endpoint lands in is everything that endpoint can dial. Give trunks a context that can only reach your inbound numbers, give phones a context that can reach the outside world, and never let either fall through to default. The security and operations guide in this section covers hardening in depth.
chan_sip is gone: deprecated in 17, removed in 21
The old SIP driver was deprecated in Asterisk 17 (released October 2019) and "officially removed in Asterisk 21", which shipped in 2023.2120 The module deprecations table records the same, along with the other removals in 21: app_macro (deprecated in 16), chan_skinny and chan_mgcp (deprecated in 19).19 You can see it in the tree: chan_sip.c is present in the channels directory on branch 20 and absent from branch 21.1415
Practically: Asterisk 20 is the last series that contains chan_sip, and it moved to security fixes only on 19 October 2026.55 A system still on chan_sip has, at most, a year of security fixes left before it is running unsupported software. The project ships a converter, sip_to_pjsip.py in contrib/scripts/sip_to_pjsip, but says it "is not intended to work for every scenario or configuration".35 Also search the dialplan for Dial(SIP/...): those become PJSIP/ dial strings, whose syntax differs (next section).
A working pjsip.conf: one trunk, one phone
The example below follows the structure of the official examples24 with the NAT settings from the NAT guide26 and a template for phones. Section names may repeat across types ([itsp] appears four times), which is how the official examples are written too.24
; /etc/asterisk/pjsip.conf -- one SIP trunk and one desk phone
; Addresses are documentation ranges (RFC 5737); numbers are fictional 555-01xx.
;================ TRANSPORT
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.10.0/24 ; the office LAN: no NAT rewriting here
external_media_address=203.0.113.10 ; public IP written into SDP for outside peers
external_signaling_address=203.0.113.10
;================ TRUNK: an ITSP that wants a REGISTER and digest auth
[itsp]
type=registration
transport=transport-udp
outbound_auth=itsp-auth
server_uri=sip:sip.example.net
client_uri=sip:[email protected]
contact_user=5145550100 ; becomes the extension calls arrive on
retry_interval=60
[itsp-auth]
type=auth
auth_type=digest ; current name; older samples say userpass
username=5145550100
password=use-a-long-random-secret
[itsp]
type=aor
contact=sip:sip.example.net:5060 ; where outbound calls are sent
qualify_frequency=60 ; check reachability; 0 (the default) never qualifies
[itsp]
type=endpoint
transport=transport-udp
context=from-itsp ; inbound calls start in this context
disallow=all
allow=ulaw
outbound_auth=itsp-auth ; answer the provider's 401 challenges
aors=itsp
direct_media=no ; keep Asterisk in the media path
[itsp]
type=identify ; requests from these addresses ARE the trunk
endpoint=itsp
match=sip.example.net ; resolved to every A/AAAA record; IPs/CIDR also accepted
;================ PHONES: a template, then one section set per phone
[phone-defaults](!)
type=endpoint
transport=transport-udp
context=internal
disallow=all
allow=ulaw
direct_media=no
rtp_symmetric=yes ; send RTP back where it came from
force_rport=yes
rewrite_contact=yes ; trust the observed source address (NAT)
[6001](phone-defaults)
auth=6001-auth
aors=6001
callerid="Front desk" <6001>
[6001-auth]
type=auth
auth_type=digest
username=6001
password=another-long-random-secret
[6001]
type=aor
max_contacts=1 ; default is 0: registrations refused
remove_existing=yes ; a re-registration replaces the old contact
Notes on the choices, each checked against the reference:
- NAT.
local_netis "the IP network that we want to consider our local network";external_media_addressandexternal_signaling_addressare the public address used for RTP and for SIP towards anything outside it.26rtp_symmetricmeans "Send RTP back to the same address/port we received it from";rewrite_contactsends requests to the observed source address rather than the advertised one.26 Their defaults are no, andforce_rportdefaults to yes.27 direct_mediadefaults to yes.27 The bridges documentation notes that media can only flow directly between devices when neither is behind NAT.8 In our experience, leaving the default on with NATed phones is the most common cause of one-way audio. Setting it to no keeps Asterisk in the media path, as the NAT guide's example does.26auth_type=digest. The current reference makesdigestthe default and lists the olderuserpassandmd5values as "Deprecated. Use digest"; the same text is on the 20 and 22 branches.29 Most examples online, including the official ones, still sayuserpass.24 It still works because it is converted, but write the current form.- Templates.
[phone-defaults](!)defines a template;[6001](phone-defaults)inherits from it, and a section may list several templates.3637 If you prefer,res_pjsip_config_wizardbuilds the same objects from a singletype=wizardsection inpjsip_wizard.conf, generating the endpoint, AOR, auth, registration and identify objects for you.33 - Codecs. Our view: one codec, G.711 μ-law, is the safe starting point for a North American trunk; add others only when both sides need them, because every extra codec is another way for negotiation to end in transcoding.
Once loaded, the troubleshooting guide's commands check each link in the table above: pjsip show endpoints confirms the endpoint loaded, pjsip show endpoint itsp shows its AOR, auth, transport and identify, pjsip show aor 6001 shows whether a phone's contact is bound, and pjsip set logger on prints the SIP traffic itself.32
A minimal extensions.conf
The dialplan that goes with it. Dial(PJSIP/6001) rings the contacts of the AOR named like the endpoint; Dial(PJSIP/number@itsp) sends the number to the contact on the itsp AOR, with the user part taken from the dial string.34 If a phone may register from several devices, ${PJSIP_DIAL_CONTACTS(6001)} rings all of them at once.34
; /etc/asterisk/extensions.conf -- the smallest useful dialplan for the config above
[from-itsp]
; Calls from the provider arrive on the contact_user set in pjsip.conf.
exten => 5145550100,1,NoOp(Inbound from ${CALLERID(num)})
same => n,Answer()
same => n,Dial(PJSIP/6001,25) ; ring the front desk for 25 seconds
same => n,Hangup()
[internal]
; Phones (context=internal) can reach each other...
exten => _6XXX,1,Dial(PJSIP/${EXTEN},20)
same => n,Hangup()
; ...can reach 911 with no prefix (47 CFR 9.16(b)(1) applies to US MLTS)...
exten => 911,1,Dial(PJSIP/911@itsp)
same => n,Hangup()
exten => 9911,1,Goto(911,1) ; habit-dialled 9 + 911 still works
; ...and can call out: NANP numbers as 10 digits or 1 + 10 digits.
; Send the number in whatever format your provider documents.
exten => _NXXNXXXXXX,1,Dial(PJSIP/1${EXTEN}@itsp)
same => n,Hangup()
exten => _1NXXNXXXXXX,1,Dial(PJSIP/${EXTEN}@itsp)
same => n,Hangup()
Reload it with dialplan reload from the CLI.10 Three things in this small file are deliberate:
- Separate contexts for trunk and phones.
from-itspcan reach exactly one extension. Nothing a caller from outside sends can reach an outbound route. - 911 without a prefix. In the United States, anyone "installing, managing, or operating multi-line telephone systems" must configure the system so a user can "directly initiate a call to 911 from any station equipped with dialing facilities, without dialing any additional digit, code, prefix, or post-fix, including any trunk-access code such as the digit 9", and must provide notification to a central location where the system can do so without new hardware or software.66 An Asterisk PBX with desk phones is such a system. The dialplan line is the easy half; the provider's 911 service and the registered location for each phone are the hard half. Our emergency calling guide sets out the US rules; Canadian 9-1-1 obligations are set by the CRTC and differ, and are not covered here.
- No
_X.catch-all. A pattern ending in a period will match far more than you meant.12 Outbound patterns should be as narrow as the numbers you actually want people to dial. Routing to international destinations deserves its own, deliberately added, pattern.
A real auto attendant (greeting, digit menu, business hours, voicemail fallback) is built from the same pieces: Background(), WaitExten(), a GotoIfTime() and some extensions. That is the subject of the auto attendant dialplan guide in this section.
CLI, AMI, AGI, ARI: which interface for which job
Asterisk exposes four ways to drive it from outside the configuration files. They overlap, and choosing the wrong one is a common source of fragile systems.
The CLI. asterisk -r attaches a console to a running Asterisk, and asterisk -x "command" runs a single command, prints the output and exits.41 The control socket it uses is asterisk.ctl in the run directory.39 core show help lists everything.2 It is for people and for shell scripts; nothing else should parse its output.
AMI (Asterisk Manager Interface). "the standard management interface into your Asterisk server", a "client/server model over TCP" on port 5038 "if you enable it in manager.conf". Clients send actions, get responses, and receive events about everything that changes.42 The sample file ships with enabled = no and a blunt warning: "you should not enable the AMI on a public IP address".43 Note also that the command permission lets a client run arbitrary CLI commands.42 Use AMI for monitoring, wallboards, click-to-call (originate) and CRM pop-ups.
AGI (Asterisk Gateway Interface). "AGI is analogous to CGI in Apache": the dialplan hands a channel to an external program.44 The AGI() application launches a script as a new process and talks to it on stdin and stdout, or connects to a FastAGI server over TCP using an agi:// URI.45 FastAGI's default port is 4573.46 It is synchronous: actions "do not return until the action is completed".44 The result lands in AGISTATUS as SUCCESS, FAILURE, NOTFOUND or HANGUP.45 Use it to add a database lookup or a decision to a dialplan that otherwise stays in charge.
ARI (Asterisk REST Interface). Three parts: a REST interface "to control resources in Asterisk", a WebSocket "that conveys events in JSON", and "The Stasis dialplan application that hands over control of a channel from Asterisk to the client". "Channels not in a Stasis dialplan application generally cannot be manipulated by ARI."47 The project's own framing is the best guide to when to use it: AMI and AGI were not "designed to let a developer build their own custom communications application"; ARI "is not about telling a channel to execute the VoiceMail dialplan application. It is about letting you build your own VoiceMail application."47 It runs on Asterisk's HTTP server (port 8088 in the getting-started guide; the demo password there is for demos only)48, which is disabled by default and bound to 127.0.0.1 in the sample http.conf.49 Asterisk can also open outbound WebSocket connections to your ARI application, persistent or per call, configured in ari.conf and websocket_client.conf; the documentation page does not say which release introduced this, so check your version's sample files.50
| You want to... | Use | Why |
|---|---|---|
| Watch calls, count queue members, originate a call | AMI | Event stream of everything; actions for control. Keep it on localhost or a VPN.43 |
| Look up a caller in a database mid-dialplan | AGI or FastAGI | Synchronous call-and-return from the dialplan, which stays in control.44 |
| Build the call logic itself in Python, Go or Node | ARI | Your application owns the channel while it is in Stasis.47 |
| Operate the box by hand or from cron | CLI (asterisk -rx) | Human-oriented output; fine for scripts you own.41 |
Scroll the table sideways to see every column.
Our view: for a phone menu with fixed options, plain dialplan is the most reliable thing you can build: no external process to crash, no network hop on every keypress. Reach for ARI when the logic genuinely belongs in application code (per-customer menus from a database, speech services, complex queues), and treat that application as part of your call path, with the same monitoring and redundancy as Asterisk itself.
Configuration files and directories
All Asterisk configuration files share one format: sections in square brackets, name = value lines, and comments starting with ;, because # is a DTMF digit.2 The default directories:39
| Setting | Default | Holds |
|---|---|---|
| astetcdir | /etc/asterisk | Configuration files |
| astmoddir | /usr/lib/asterisk/modules | Loadable .so modules |
| astvarlibdir, astdatadir | /var/lib/asterisk | Runtime data; sounds in sounds/, keys in keys/ |
| astagidir | /var/lib/asterisk/agi-bin | AGI scripts |
| astspooldir | /var/spool/asterisk | Spool, including outgoing and voicemail |
| astlogdir | /var/log/asterisk | Logs |
| astrundir | /var/run/asterisk | asterisk.ctl and asterisk.pid |
Scroll the table sideways to see every column.
The files you will touch first: asterisk.conf (directories and global options), modules.conf, pjsip.conf, extensions.conf, manager.conf, http.conf and ari.conf, plus one file per feature module (voicemail, queues, music on hold and so on). make samples installs a sample for every module.59
Three constructs keep large configurations manageable. #include filename pulls in another file; #tryinclude does the same without failing if the file is missing; #exec program inserts a program's output, but only with execincludes=yes in asterisk.conf, because it is off by default.38 Templates, shown in the pjsip.conf above, remove repetition.3637
One setting in asterisk.conf deserves to be known by name: live_dangerously. Some dialplan functions escalate privilege, for example "reading the SHELL() function can execute arbitrary commands". Since Asterisk 12 the default is no, which stops external protocols such as AMI from invoking them.40 Leave it that way.
Our view: keep /etc/asterisk in git, deploy it with whatever configuration management you already use, and make every change a commit. Asterisk's files are plain text, diff cleanly and reload per module; a PBX whose configuration exists only on the box is one disk failure from being rebuilt from memory.
Realtime: configuration from a database
Asterisk can read configuration from a database instead of files, in two modes. Static realtime loads a configuration file's contents from a table, read the same way as a file. Realtime proper "is used to dynamically load and update objects" as they are needed.51 Mappings go in extconfig.conf as <family> => <realtime driver>,<res_<driver>.conf class name>[,<table>].51
The drivers in the current tree are res_config_odbc, res_config_pgsql, res_config_curl, res_config_ldap and res_config_sqlite353; the native MySQL driver, res_config_mysql, lives in addons/.54 The realtime page itself names ODBC, MySQL and PostgreSQL, so it lags the source.51
PJSIP does not use extconfig.conf families directly. It uses sorcery, Asterisk's object-storage abstraction (res_sorcery_config, res_sorcery_realtime, res_sorcery_astdb, res_sorcery_memory_cache in the tree53), mapped in sorcery.conf. The documented setup:52
; /etc/asterisk/sorcery.conf -- PJSIP objects from the database
[res_pjsip]
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
contact=realtime,ps_contacts
[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips
; /etc/asterisk/extconfig.conf
[settings]
ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_aors => odbc,asterisk
ps_contacts => odbc,asterisk
The database schema is not hand-written: the source ships Alembic migrations in contrib/ast-db-manage/, and the documented path uses ODBC (res_odbc and res_config_odbc).52 Realtime has documented gaps, for example "realtime extensions do not support realtime hints".51
Our view: realtime earns its complexity when something else owns the data: a provisioning portal creating hundreds of endpoints, or many tenants on shared servers. For a single business, files under version control are simpler, faster and easier to debug. If you do adopt realtime, use the Alembic schema for your exact version and put res_sorcery_memory_cache in front, so a slow database does not become slow call setup.
Versions: what to run in October 2026
The release policy, from the project's versions page: a new major release "roughly once a year, alternating between standard and LTS releases". An LTS release "will be fully supported for 4 years, with one additional year of maintenance for security fixes"; a standard release gets "at least one year of full support" plus a year of security fixes. Bug-fix releases for fully supported series arrive roughly every four to six weeks, and the October releases of every supported series are cut on the third Thursday of October, after a release-candidate cycle that starts in September.55
The supported series, with the project's own dates and the state of each on the day this page was checked:
| Series | Type | Released | Security fixes only from | End of life | As at 26 Oct 2026 |
|---|---|---|---|---|---|
| 20.x | LTS | 19 Oct 2022 | 19 Oct 2026 | 19 Oct 2027 | Security fixes only. Last series with chan_sip. Latest release 20.21.0 (27 Aug); 20.22.0-rc3 published 22 Oct.5556 |
| 21.x | Standard | 18 Oct 2023 | 18 Oct 2025 | 18 Oct 2026 | End of life. Last release 21.12.3 (25 Jun 2026). It had two years of bug fixes because of what the versions page calls a scheduling mistake.5556 |
| 22.x | LTS | 16 Oct 2024 | 16 Oct 2028 | 16 Oct 2029 | Fully supported. Latest release 22.11.0 (27 Aug); 22.12.0-rc3 published 22 Oct.5556 |
| 23.x | Standard | 15 Oct 2025 | 15 Oct 2026 | 15 Oct 2027 | Security fixes only. Latest release 23.5.0 (27 Aug); 23.6.0-rc3 published 22 Oct.5556 |
| 24.x | LTS | 15 Oct 2026 (scheduled) | 15 Oct 2030 | 15 Oct 2031 | Not yet released. The versions page lists it as pre-release; the newest tag is 24.0.0-rc3, published 22 Oct 2026.5556 |
Scroll the table sideways to see every column.
Asterisk 18 reached end of life on 20 October 2025.55 Separately, Sangoma maintains Certified Asterisk branches for its top support tier4; the current ones are 22.8 and 20.7, with certified-22.8-cert5 and certified-20.7-cert12 both tagged on 19 October 2026.56
The project's own advice: "It is highly recommended that you install one of the currently supported versions", and "If you want a rock solid communications framework, choose the latest Long Term Support (LTS) release."58
Our view, for a new deployment today: install 22 LTS. It has three years of full support left and every current module. Plan to move to 24 once it is released and has had a point release or two, not on its first day. If you are on 20, you have one year of security fixes: start the move to 22 now, and if chan_sip is the reason you are still on 20, the migration is the project, not the upgrade. Standard releases (21, 23) are for trying new features, not for a phone system a business depends on.
Installing: source, distribution packages, or neither
The documentation lists three routes: FreePBX ("the easiest way to get started if you're new to Linux and/or Asterisk"), your operating system's packages, or compiling from source for "the utmost in control of your installation".57
From source. Releases are at downloads.asterisk.org/pub/telephony/asterisk/, with a -current link per supported series.58 The sequence is the one in the README and the build guide:259
# Build from a release tarball (Asterisk 22 LTS shown)
cd /usr/src
curl -LO https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
tar xzf asterisk-22-current.tar.gz && cd asterisk-22.*/
./contrib/scripts/install_prereq install # every dependency for every module
./configure # bundled pjproject is the default
make menuselect # choose modules; deprecated ones are off by default
make -j"$(nproc)"
make install
make config # init scripts
# make samples would install sample configs AND overwrite any existing ones
asterisk -vvvc # foreground, verbose, with a console
Points the README and build guide make that are easy to miss: make samples "Overwrites existing config files"; on virtual machines the default native-CPU optimisation can produce a binary that will not run elsewhere, which menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts turns off; and --prefix is the supported way to sandbox an installation.59 The README adds two operational warnings: Asterisk "is sensitive to large jumps in time", so run exactly one time-sync daemon; and with the common file-descriptor limit of 1024, "Asterisk can handle approximately 150 SIP calls simultaneously", so raise nofile for the asterisk user.2
Distribution packages. Check what you would actually get before choosing this route:
- Debian: the package search shows no
asteriskpackage in bookworm (12) or trixie (13). Bullseye (11) carries 16.28.0, a series whose upstream end of life was 9 October 2023; testing (forky) and unstable carry 22.10.1.6155 - Ubuntu: 24.04 (Noble) ships 20.6.0 and 26.04 (Resolute) ships 22.5.2, both in the universe component.62 Upstream is at 20.21.0 and 22.11.0.56 A distribution may backport security fixes without changing the upstream version number, so read the package changelog rather than judging by the version alone.
Our view: for production, build a supported LTS from source (or use a vendor repository that tracks upstream point releases), and package the result yourself if you run more than one server. Distribution packages are fine for a lab. Either way, pin the version: an unattended upgrade to a new Asterisk major is not something you want to discover from a support call.
Where FreePBX and other distributions fit
FreePBX is a web interface and module system that configures Asterisk for you. Its framework module is GPL-3.065, and it is the route the Asterisk documentation itself recommends to newcomers.57 The current release line, FreePBX 17, is "Officially Supported Only on Debian 12 “Bookworm”" and is installed by an open-source script.63 That script defaults to ASTVERSION=22, refuses to run on anything other than Debian 12, actively pins Debian 13 packages away, and installs Asterisk as asterisk22 packages from Sangoma's own deb.freepbx.org repository rather than from Debian.64 The FreePBX documentation also notes that "Asterisk 21 and later versions do not support chan_sip at all" and that FreePBX 17 uses PHP 8.2, "with security support guaranteed through until December 2026".63
When FreePBX is the right choice: an office PBX with extensions, ring groups, IVRs, voicemail and time conditions, administered by someone who would rather click than edit text, and where the GUI's model of a phone system matches yours. When raw Asterisk is: your call flow is unusual, you want configuration in version control, you are building an application on ARI, or you are deploying many identical servers from automation.
Our view: pick one owner for the configuration. A GUI that generates Asterisk's files and an engineer who also edits them by hand will eventually overwrite each other, and the GUI usually wins. If you choose FreePBX, do the work inside FreePBX; if you outgrow it, migrate deliberately rather than file by file.
Other Asterisk-based distributions and commercial PBX products exist. We have not reviewed them for this page, so we make no claim about them here.
When not to run Asterisk yourself
Asterisk is excellent, free and mature, and the people who run it well treat it as a server they own for its whole life: patched within the support window, monitored, backed up, firewalled, with a plan for the day the trunk provider changes something. That is the real cost, and it is mostly time rather than money.
If what you need is one phone number that answers with a short menu and forwards each option to a mobile or to voicemail, a hosted service is the smaller commitment. That is what this site's own service does. If you want the control, the guides in the Asterisk section are written for you, and the open-source VoIP section covers the SIP proxies that sit in front of Asterisk when one server is no longer enough.
Further reading
Longer research pieces on this topic, each with its own source list and a downloadable PDF.
Articles on this topic
Topics Auto attendant VoIP Call routing All topics
Sources
Every regulatory and pricing claim on this page links to the primary source it came from. Figures were checked on the date shown at the top of the page; rules and prices change, so verify before relying on one.
- IETF RFC 3261, SIP: Session Initiation Protocol, section 6 (definition of a back-to-back user agent). Retrieved 26 Oct 2026
https://www.rfc-editor.org/rfc/rfc3261#section-6 - Asterisk source repository, README.md (what Asterisk is, build steps, file descriptor and time-sync notes). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/README.md - Asterisk source repository, LICENSE (GPL version 2, alternative licences from Sangoma, the AMI/AGI/ARI statement, trademarks). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/LICENSE - asterisk.org, Asterisk Support (Sangoma as "the primary sponsor and developer of Asterisk"; Support Level 5 requires Certified Asterisk). Retrieved 26 Oct 2026
https://www.asterisk.org/?p=8753 - Asterisk Documentation, Asterisk Architecture, The Big Picture (core, modules, channels, dialplan). Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Architecture/Asterisk-Architecture-The-Big-Picture/ - Asterisk Documentation, Types of Asterisk Modules. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Architecture/Types-of-Asterisk-Modules/ - Asterisk Documentation, Key Concepts: Channels (inbound and outbound channels of one call). Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Key-Concepts/Channels/ - Asterisk Documentation, Key Concepts: Bridges (core, native, mixing and holding bridges). Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Key-Concepts/Bridges/ - Asterisk Documentation, Key Concepts: The Stasis Message Bus. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Key-Concepts/The-Stasis-Message-Bus/ - Asterisk Documentation, Dialplan (extensions.conf, dialplan reload). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Dialplan/ - Asterisk Documentation, Contexts, Extensions, and Priorities. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Dialplan/Contexts-Extensions-and-Priorities/ - Asterisk Documentation, Pattern Matching (X, Z, N, the period and the exclamation mark). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Dialplan/Pattern-Matching/ - Asterisk source repository, channels/ directory on the master branch (channel drivers currently in the tree). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/master/channels - Asterisk source repository, channels/ directory on branch 20 (chan_sip.c, chan_skinny.c, chan_mgcp.c still present). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/20/channels - Asterisk source repository, channels/ directory on branch 21 (chan_sip.c absent). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/21/channels - Asterisk source repository, bridges/ directory on the master branch (bridge technology modules). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/master/bridges - Asterisk source repository, configs/samples/modules.conf.sample (autoload, preload, require, noload). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/configs/samples/modules.conf.sample - Asterisk Documentation, Asterisk Module Support States (core, extended, deprecated). Retrieved 26 Oct 2026
https://docs.asterisk.org/Asterisk-Community/Asterisk-Module-Support-States/ - Asterisk Documentation, Asterisk Module Deprecations (deprecated-in and removed-in versions). Retrieved 26 Oct 2026
https://docs.asterisk.org/Development/Asterisk-Module-Deprecations/ - Asterisk Documentation, What’s New in Asterisk 21 (modules removed, including chan_sip). Retrieved 26 Oct 2026
https://docs.asterisk.org/Asterisk_21_Documentation/WhatsNew/ - Asterisk Documentation, Configuring chan_sip (note on removal in Asterisk 21). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-chan_sip/ - Asterisk Documentation, Configuring res_pjsip (chan_pjsip depends on res_pjsip; pjsip.conf). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/ - Asterisk Documentation, PJSIP Configuration Sections and Relationships. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/PJSIP-Configuration-Sections-and-Relationships/ - Asterisk Documentation, res_pjsip Configuration Examples (transport, phone, ITSP trunk). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/res_pjsip-Configuration-Examples/ - Asterisk Documentation, Configuring Outbound Registrations. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Configuring-Outbound-Registrations/ - Asterisk Documentation, Configuring res_pjsip to work through NAT. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Configuring-res_pjsip-to-work-through-NAT/ - Asterisk Documentation, Module Configuration: res_pjsip (endpoint option defaults). Retrieved 26 Oct 2026
https://docs.asterisk.org/Latest_API/API_Documentation/Module_Configuration/res_pjsip/ - Asterisk Documentation, Module Configuration: res_pjsip_endpoint_identifier_ip (identify: match, srv_lookups, match_header). Retrieved 26 Oct 2026
https://docs.asterisk.org/Latest_API/API_Documentation/Module_Configuration/res_pjsip_endpoint_identifier_ip/ - Asterisk source repository, res/res_pjsip/pjsip_config.xml (identify_by, max_contacts, remove_existing, transport protocols, auth_type; same auth_type text checked on branches 20 and 22). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/res/res_pjsip/pjsip_config.xml - Asterisk source repository, res/res_pjsip/config_global.c (DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous"). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/res/res_pjsip/config_global.c - Asterisk source repository, configs/samples/pjsip.conf.sample (anonymous calls refused by default). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/configs/samples/pjsip.conf.sample - Asterisk Documentation, Asterisk PJSIP Troubleshooting Guide (pjsip show endpoint, pjsip show aor, pjsip set logger on). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Asterisk-PJSIP-Troubleshooting-Guide/ - Asterisk Documentation, PJSIP Configuration Wizard (res_pjsip_config_wizard, pjsip_wizard.conf). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/PJSIP-Configuration-Wizard/ - Asterisk Documentation, Dialing PJSIP Channels. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Dialing-PJSIP-Channels/ - Asterisk Documentation, Migrating from chan_sip to res_pjsip (sip_to_pjsip.py). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Migrating-from-chan_sip-to-res_pjsip/ - Asterisk Documentation, Template Syntax. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Asterisk-Configuration-Files/Templates/Template-Syntax/ - Asterisk Documentation, Using Templates. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Asterisk-Configuration-Files/Templates/Using-Templates/ - Asterisk Documentation, Using the include, tryinclude and exec Constructs. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Asterisk-Configuration-Files/Using-The-include-tryinclude-and-exec-Constructs/ - Asterisk Documentation, Directory and File Structure. Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Directory-and-File-Structure/ - Asterisk Documentation, Privilege Escalations with Dialplan Functions (live_dangerously). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Dialplan/Privilege-Escalations-with-Dialplan-Functions/ - Asterisk source repository, doc/asterisk.8 manual page (-r, -x, -c options). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/doc/asterisk.8 - Asterisk Documentation, The Asterisk Manager TCP/IP API. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-Manager-Interface-AMI/The-Asterisk-Manager-TCP-IP-API/ - Asterisk source repository, configs/samples/manager.conf.sample (security note, enabled = no, port 5038). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/configs/samples/manager.conf.sample - Asterisk Documentation, Asterisk Gateway Interface (AGI). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-Gateway-Interface-AGI/ - Asterisk Documentation, Dialplan Applications: AGI (stdin/stdout, FastAGI URI, AGISTATUS). Retrieved 26 Oct 2026
https://docs.asterisk.org/Latest_API/API_Documentation/Dialplan_Applications/AGI/ - Asterisk source repository, res/res_agi.c (AGI_PORT 4573, "FastAGI defaults to port 4573"). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/res/res_agi.c - Asterisk Documentation, Asterisk REST Interface (ARI). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ - Asterisk Documentation, Getting Started with ARI (http.conf, ari.conf, Stasis(), port 8088). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/Getting-Started-with-ARI/ - Asterisk source repository, configs/samples/http.conf.sample (disabled by default, bindaddr=127.0.0.1). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/configs/samples/http.conf.sample - Asterisk Documentation, ARI Outbound Websockets. Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ARI-Outbound-Websockets/ - Asterisk Documentation, Realtime Database Configuration (extconfig.conf, static and realtime modes, caveats). Retrieved 26 Oct 2026
https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Database-Support-Configuration/Realtime-Database-Configuration/ - Asterisk Documentation, Setting up PJSIP Realtime (sorcery.conf, extconfig.conf, Alembic scripts). Retrieved 26 Oct 2026
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Setting-up-PJSIP-Realtime/ - Asterisk source repository, res/ directory on master (res_config_curl, _ldap, _odbc, _pgsql, _sqlite3; res_sorcery_*). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/master/res - Asterisk source repository, addons/ directory on master (res_config_mysql, chan_ooh323, chan_mobile, format_mp3). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/tree/master/addons - Asterisk Documentation, Asterisk Versions (release table, LTS and standard support periods, release schedule). Retrieved 26 Oct 2026
https://docs.asterisk.org/About-the-Project/Asterisk-Versions/ - Asterisk source repository, GitHub releases (24.0.0-rc3, 23.6.0-rc3, 22.12.0-rc3, 20.22.0-rc3 on 22 Oct 2026; 23.5.0, 22.11.0, 20.21.0 on 27 Aug 2026; certified-22.8-cert5 and certified-20.7-cert12 on 19 Oct 2026; 21.12.3 on 25 Jun 2026). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/releases - Asterisk Documentation, Installing Asterisk (FreePBX, distribution packages, source). Retrieved 26 Oct 2026
https://docs.asterisk.org/Getting-Started/Installing-Asterisk/ - Asterisk Documentation, What to Download (downloads.asterisk.org, choose a supported version, LTS for stability). Retrieved 26 Oct 2026
https://docs.asterisk.org/Getting-Started/Installing-Asterisk/Installing-Asterisk-From-Source/What-to-Download/ - Asterisk Documentation, Building and Installing Asterisk (make targets, --prefix, BUILD_NATIVE). Retrieved 26 Oct 2026
https://docs.asterisk.org/Getting-Started/Installing-Asterisk/Installing-Asterisk-From-Source/Building-and-Installing-Asterisk/ - Asterisk source repository, configure.ac ("Use bundled pjproject libraries (default)"). Retrieved 26 Oct 2026
https://github.com/asterisk/asterisk/blob/master/configure.ac - Debian, package search for "asterisk" in all suites (no package in bookworm or trixie; 16.28.0 in bullseye; 22.10.1 in forky and sid). Retrieved 26 Oct 2026
https://packages.debian.org/search?keywords=asterisk&searchon=names&exact=1&suite=all§ion=all - Launchpad, asterisk source package in Ubuntu (versions per series, universe component). Retrieved 26 Oct 2026
https://launchpad.net/ubuntu/+source/asterisk - Sangoma documentation, FreePBX 17 (Debian 12 only, install script, chan_sip, PHP 8.2). Retrieved 26 Oct 2026
https://sangomakb.atlassian.net/wiki/spaces/FP/pages/222101505/FreePBX+17 - FreePBX, sng_freepbx_debian_install.sh (ASTVERSION default 22, bookworm only, packages from deb.freepbx.org). Retrieved 26 Oct 2026
https://github.com/FreePBX/sng_freepbx_debian_install/blob/master/sng_freepbx_debian_install.sh - FreePBX, framework module repository (licence GPL-3.0). Retrieved 26 Oct 2026
https://github.com/FreePBX/framework - 47 CFR § 9.16, Multi-line telephone systems (direct 911 dialling, MLTS notification). Cornell Legal Information Institute. Retrieved 26 Oct 2026
https://www.law.cornell.edu/cfr/text/47/9.16
