VMware ESXi and vSphere Cluster Management

What Is Asterisk? An Introduction to Open-Source PBX and VoIP

Learn what Asterisk is, how it works as an open-source PBX, its VoIP protocols and features, deployment options, security requirements, and beginner learning path.

What Is Asterisk?

Asterisk is open-source communications software used to build private branch exchanges (PBXs), VoIP systems, contact centers, automated phone services, and custom communications applications. It is software that runs on a server; it is not a telephone appliance and it is not, by itself, a hosted phone service.

Asterisk connects telephone users and applications. Depending on its configuration, it can connect IP phones, softphones, analog phones, telephone providers, gateways, voicemail, queues, interactive voice response (IVR) menus, databases, and customer relationship management (CRM) systems.

Asterisk can support a small office with a few extensions, an enterprise deployment with many users, a support center, or a specialized application such as an appointment reminder system. The software provides the communications engine, while administrators choose the endpoints, network, telephone provider, dialplan, integrations, and management tools.

PBX Fundamentals

A private branch exchange (PBX) is an organization's private telephone system. Instead of giving every employee a separate telephone line connected directly to the public telephone network, the PBX manages internal extensions and shares external telephone connections.

  • An extension is an internal dialing destination, such as an employee's phone, a department, a voicemail box, or an application.
  • An internal call travels between extensions inside the organization.
  • An outbound call travels from an extension through a trunk or gateway to an outside number.
  • An inbound call arrives from a provider and is routed to an extension, ring group, queue, IVR, or voicemail.

With direct individual telephone lines, each user or device generally has an independent external service. A PBX centralizes call control, allowing an organization to use shared numbers and features such as transfers, extensions, voicemail, queues, and restrictions.

A software PBX such as Asterisk can replace a traditional hardware PBX, supplement an existing telephone system, or provide a gradual migration path from older telephone circuits to IP phones and SIP trunks.

How Asterisk Fits into a VoIP System

VoIP, or Voice over Internet Protocol, carries voice across IP networks. A typical Asterisk system contains these components:

ComponentPurposeTypical examples
Asterisk serverProcesses calls and applies routing rulesLinux server, virtual machine, cloud instance
EndpointsDevices or clients used by people or applicationsIP phone, softphone, browser client, analog telephone adapter
SIP trunk or gatewayConnects Asterisk to an external telephone serviceProvider SIP trunk, analog gateway, digital telephony interface
LAN and firewallCarries signaling and media while controlling accessSwitches, routers, firewall, VPN
DialplanDefines how numbers, events, and menu choices are handledInternal, inbound, outbound, and restricted contexts
Storage and backupsStores voicemail, recordings, configuration, and call dataLocal storage, backup server, encrypted object storage
Monitoring and loggingHelps identify failures, abuse, and call-quality problemsSystem metrics, CDR, log collection, alerting

Two different kinds of traffic are involved in a call:

  • Signaling sets up, changes, and ends a call. SIP messages, for example, can register an endpoint, negotiate a session, ring a destination, and terminate the call.
  • Media is the voice or video stream itself. RTP commonly carries this media after signaling establishes the session.

Signaling can succeed while media fails. This explains symptoms such as a call that rings and connects but has one-way audio. NAT, firewall rules, advertised addresses, RTP ports, and codecs must be considered separately from call signaling.

See the Asterisk overview as a starting point before moving to detailed configuration topics.

Protocols, Trunks, and Media

ItemPrimary roleNotes
SIPSignaling for VoIP sessionsThe most common protocol for modern IP phones, softphones, and provider trunks.
H.323Signaling and multimedia communicationA historically important protocol that may appear in older or specialized environments.
RTPMedia transportCommonly carries audio or video after signaling establishes a session.
TLSProtection for signaling connectionsEncrypts supported signaling traffic between compatible participants.
SRTPProtection for mediaEncrypts supported RTP media when endpoints and trunks are configured for it.
Audio codecsEncode and decode mediaExamples include G.711 variants and other codecs with different quality, bandwidth, and processing characteristics.

A codec describes how audio or video is encoded and decoded. It is not a signaling protocol. For two devices to exchange media, they need a compatible codec and a usable media path.

Asterisk can connect internal endpoints to external services through a SIP trunk, which carries calls over IP between the PBX and a provider. A gateway connects IP telephony to analog, digital, mobile, or PSTN circuits. The PSTN, or public switched telephone network, is the conventional public telephone infrastructure.

Interoperability depends on more than choosing SIP. The endpoint and provider must agree on signaling behavior, authentication, transports, codecs, number formats, NAT handling, and dialplan rules. Available protocol features also depend on installed Asterisk modules, endpoint configuration, and provider compatibility.

Core Asterisk Capabilities

FeatureWhat it doesExample use case
VoicemailRecords, stores, and retrieves messages through mailboxesSend unanswered calls to a user's mailbox and notify the user through an integration.
IVR and auto attendantAnswers callers and responds to keypad or speech choices“Press 1 for sales, 2 for support.”
Call queueHolds calls and distributes them among available agentsSupport or sales teams handling a shared number.
Call parkingPlaces a call in a retrievable parking slotAnnounce a parked call so another employee can retrieve it.
Paging and intercomSends announcements to selected devicesWarehouse, school, or office announcements.
Call recordingRecords calls when configured and legally permittedTraining, quality review, or regulated workflows.
SIP trunkingRoutes calls between Asterisk and an external providerUse business numbers without a separate physical line per employee.
Database integrationReads or writes business data during call handlingLook up an account based on caller ID.
Fax capabilitySupports fax workflows with compatible configurationsReceive or send faxes through an appropriate gateway or provider.

Other common functions include extension-to-extension calling, transfers, call pickup, ring groups, follow-me behavior, call forwarding, time conditions, conference calling, caller ID handling, and custom notifications. Fax over IP requires particular care: traditional fax tones are sensitive to packet loss, jitter, transcoding, and network delay, so a suitable protocol, gateway, provider, and tested configuration may be necessary.

The Dialplan: Asterisk's Call-Processing Logic

The dialplan tells Asterisk what to do when it receives an extension number, telephone number, menu selection, or other event. It can route calls, apply business hours, restrict destinations, send callers to voicemail, and invoke applications or integrations.

  • A context groups dialplan rules and controls which destinations are available.
  • An extension is a matching destination or pattern. It can represent a user extension, an external number, or an IVR choice.
  • A priority determines the order in which instructions run.
  • An application performs an action such as dialing a device, playing audio, recording a message, or hanging up.
  • Variables hold values such as caller ID, destination numbers, or results from earlier steps.
  • Branching selects different paths based on time, caller input, account data, or call state.

A basic internal extension can try a phone for 20 seconds and then send the caller to voicemail:

[internal]
exten => 1001,1,Dial(PJSIP/1001,20)
 same => n,VoiceMail(1001@default,u)
 same => n,Hangup()

This example matches extension 1001, uses Dial to call the endpoint, uses VoiceMail if the call is not answered, and then ends the call with Hangup. The endpoint and mailbox names must match the actual deployment.

Contexts are also a security boundary. Internal users, inbound trunks, outbound users, and privileged applications should not all share the same dialing permissions. A carefully separated dialplan can prevent unauthorized international, premium-rate, or administrative calls.

Worked Examples

Small Office Phone System

Suppose an office has five SIP phones or softphones, extensions 1001 through 1005, one SIP trunk, and voicemail. An internal call from 1001 to 1002 stays within Asterisk and normally does not use the provider trunk. An external call matches an outbound dialplan rule, is formatted as required by the provider, and is sent through the SIP trunk. An unanswered call can fall back to the destination's mailbox.

Automated Receptionist

A main business number can enter an inbound context, play a greeting, and send the caller to an IVR. A choice for sales can dial a sales ring group, a choice for support can enter a queue, and a directory option can search extensions. Invalid input, closed hours, or a timeout can lead to an operator or voicemail.

Support Queue

A support number can route to a queue with several agents. Asterisk places callers on hold, plays announcements, and distributes calls according to the queue strategy. If the wait exceeds a threshold, the call can overflow to voicemail, an emergency answering service, or another team. Queue events and call detail records can later support reports about wait time, abandoned calls, and agent activity.

Legacy-Line Migration

An organization with an existing analog or digital telephone line can connect that service to Asterisk through compatible gateway or telephony interface hardware. Asterisk can then route calls between the legacy circuit and new SIP endpoints. This allows a gradual migration: the old line remains available while phones, trunks, and routing rules are tested and moved in stages.

CRM Integration

For a CRM integration, an inbound call can provide caller ID to a database lookup. The result may identify the customer and trigger a screen-pop for an agent. Asterisk can expose call events through AMI or ARI, while dialplan logic, AGI scripts, or database connections can participate in custom workflows.

Administration and Customization

Asterisk can be administered with text configuration files, command-line tools, APIs, and third-party graphical interfaces. Common configuration areas include endpoints, authentication, transports, dialplan contexts, voicemail, queues, and trunks.

The Asterisk CLI is useful for inspecting live behavior and diagnosing registrations, routing, channels, and logs:

asterisk -rvvv
pjsip show endpoints
pjsip show contacts
dialplan show
core show channels
core show channel <channel-name>
logger show channels
  • asterisk -rvvv attaches to the running service with increased command verbosity.
  • pjsip show endpoints displays configured PJSIP endpoints.
  • pjsip show contacts helps inspect registered contacts and reachability.
  • dialplan show displays loaded dialplan rules.
  • core show channels lists active channels and calls.
  • core show channel provides details about one channel.
  • logger show channels displays configured logging channels.

Command names, output, permissions, and service-management procedures vary by Asterisk release and installation method.

A simplified PJSIP endpoint example looks like this:

[1001-endpoint]
type=endpoint
context=internal
disallow=all
allow=ulaw
aors=1001-aor
auth=1001-auth

[1001-auth]
type=auth
auth_type=userpass
username=1001
password=use-a-strong-unique-secret

[1001-aor]
type=aor
max_contacts=1

The endpoint describes how Asterisk handles the device, the authentication object verifies its credentials, and the address-of-record (AOR) tracks where the device can be reached. The endpoint's context determines which dialplan rules it enters, while allow controls an allowed codec in this simplified example. This is a teaching example, not production-ready configuration; use unique secrets and restrict network access.

For deeper customization, AGI can run external scripts during call handling, AMI provides management and event access, and ARI provides a REST-oriented interface for building custom communications applications. Database connections can supply routing or customer information. Graphical PBX distributions may hide or generate some text configuration while adding user management, provisioning, reporting, and web administration.

Deployment Environments and Network Requirements

Linux is the most common server platform for Asterisk. Available packages, modules, documentation, and support differ by operating system and Asterisk release, so confirm compatibility before selecting a platform.

Asterisk may run on physical hardware, a virtual machine, a cloud server, or in a container-related environment. Virtual and cloud deployments require attention to clock stability, network paths, security groups, persistent storage, RTP exposure, and resource contention. Containers can simplify repeatable deployment but do not remove the need to design networking, storage, monitoring, and upgrades correctly.

  • Use reliable LAN and WAN connectivity with predictable routing.
  • Provide working DNS and accurate time synchronization.
  • Define firewall rules for signaling, RTP media, administration, and provider addresses.
  • Design NAT deliberately; incorrect public and private address information is a common cause of one-way audio.
  • Use QoS where appropriate to prioritize voice traffic over congested links.
  • Add telephony hardware only when analog, digital, or legacy PSTN connectivity requires it.

Licensing, Origin, and Ecosystem

Asterisk began in 1999 and was created by Mark Spencer. The core project is generally distributed under GNU General Public License version 2 (GPLv2) terms, with licensing notices and exceptions that should be reviewed for the particular release and files being used.

In practical terms, GPLv2 allows people to use, study, modify, and redistribute covered software under the license's conditions. Distribution can create obligations such as preserving copyright and license notices and providing corresponding source when required. Asterisk's licensing information may include a special exception relevant to linking certain non-GPL modules, but an exception is not a blanket permission for every proprietary component or distribution model.

Third-party modules, codecs, drivers, management interfaces, fonts, operating-system packages, and commercial products can have separate licenses. Organizations distributing a modified system or combining it with proprietary components should review the applicable license texts and obtain legal advice when necessary. The ecosystem includes maintainers, contributors, community users, commercial support providers, hardware vendors, trunk providers, and companies that build graphical products around Asterisk.

Asterisk Compared with Other PBX Choices

CharacteristicAsterisk deploymentTraditional hardware PBXHosted PBX service
Ownership and controlOrganization controls the software and infrastructure it operatesOrganization owns or leases dedicated telephony equipmentProvider operates the service
CustomizationVery high through dialplan, modules, and APIsDepends on the vendor and hardware platformLimited to provider features and exposed integrations
Upfront infrastructureServer, endpoints, networking, trunks, and implementationPBX hardware, cards, phones, and maintenance contractsUsually lower local infrastructure requirements
Operational responsibilityOrganization handles updates, security, backups, and monitoringOrganization or vendor maintains hardware and softwareProvider handles most platform operations
Integration flexibilityStrong options for databases, CRM, and custom applicationsOften limited to vendor-supported interfacesDepends on APIs and provider integrations
Scaling approachAdd resources, endpoints, trunks, or servers as neededMay require hardware expansion or replacementUsually adjusted through a service plan
Support modelInternal expertise, community, or commercial supportEquipment vendor or specialistHosted provider and its support channels
Security responsibilityPrimarily the operator's responsibilityShared with equipment vendor or administratorPrimarily provider-managed, but account and endpoint security remain important

Asterisk is a strong fit when an organization needs control, custom call logic, integrations, unusual routing, or the ability to choose infrastructure. A hosted PBX may be better when a business wants predictable recurring service with minimal platform administration. A turnkey appliance can suit teams that want local ownership with a guided management interface.

Open-source availability does not make telephony free. Costs can include servers, storage, phones, headsets, trunks, gateways, implementation, monitoring, security work, support, backups, compliance, and staff time.

Security and Reliability Basics

Internet-facing telephony systems are frequent targets for scanning and credential attacks. Major risks include toll fraud, which is unauthorized use of telephony resources for expensive outbound calls, weak endpoint passwords, exposed management interfaces, unauthorized international dialing, and SIP scanning.

  • Use long, unique endpoint and trunk credentials.
  • Restrict SIP and management access with firewalls, VPNs, trusted networks, or provider address lists where practical.
  • Separate internal, inbound, outbound, and privileged dialplan contexts.
  • Disable destinations and features that are not required.
  • Patch the operating system, Asterisk, modules, phones, gateways, and management software.
  • Back up configuration, voicemail, recordings, certificates, and relevant databases; test restoration.
  • Monitor authentication events, call detail records, unusual destinations, resource use, and registration changes.
  • Use TLS for signaling and SRTP for media where supported, compatible, and correctly configured.

Reliability also requires power protection, redundant network paths where justified, tested backup and restore procedures, capacity planning, and a high-availability design for critical services. Emergency calling needs explicit planning: verify provider support, caller-location behavior, failover, local address records, and procedures for outages.

Common Troubleshooting Patterns

A Phone Cannot Register

Check the server address, transport, username, password, endpoint, authentication object, and AOR. Then inspect endpoint and contact status in the CLI, review SIP or PJSIP logs at appropriate verbosity, and verify firewall and NAT reachability. With TLS, also check certificates and synchronized system time.

Calls Connect but Have One-Way or No Audio

Separate signaling from RTP media. Verify NAT settings, advertised addresses, RTP port-range rules, codec negotiation, and the network addresses exchanged by the endpoints. A successful call setup does not prove that RTP can travel in both directions.

Inbound Calls Reach Asterisk but Not the Intended Destination

Inspect the incoming destination in CLI logs. Confirm the trunk's context, the number pattern, the expected provider number format, and the matching dialplan extension. Providers may send a destination in a format different from the one used in local rules.

Outbound Calls Fail

Trace the dialplan path and check whether a matching outbound rule exists. Confirm trunk registration or authentication, provider response codes, number formatting, destination permissions, and account authorization.

Call Quality Is Poor

Measure packet loss, latency, jitter, bandwidth, and server CPU use. Congested links, unstable Wi-Fi, missing QoS, and resource contention can all affect voice quality. Use stable wired connectivity for critical endpoints where possible.

Unexpected Expensive Outbound Calls Appear

Treat this as a security incident. Restrict affected routes and credentials, review call detail records and authentication logs, rotate secrets, and apply destination controls, rate limits, firewall restrictions, and least-privilege dialplan rules.

Beginner Learning Path

  1. Learn PBX terms, extensions, trunks, caller ID, inbound routing, and outbound routing.
  2. Review IP addresses, subnets, DNS, routing, firewalls, NAT, and basic Linux administration.
  3. Study SIP signaling, RTP media, registration, codecs, and the difference between signaling and media.
  4. Build a small lab with an Asterisk server and two endpoints. Test extension-to-extension calls first.
  5. Add voicemail and inspect registrations, channels, logs, and the dialplan through the CLI.
  6. Add a SIP trunk, then configure and test inbound and outbound routing in restricted contexts.
  7. Build a basic IVR, ring group, or support queue with timeout and voicemail fallback.
  8. Practice backups, updates, firewalling, credential management, packet captures, monitoring, and toll-fraud prevention before production use.

Summary

Asterisk is open-source software for creating PBXs and programmable communications systems. It can connect internal endpoints, external telephone providers, legacy circuits, business applications, and call-handling features through a configurable dialplan. Its flexibility is valuable, but it also makes administration, security, compatibility testing, maintenance, and support planning the operator's responsibility.