asterisk
Run the Asterisk open-source PBX software
TLDR
[r]econnect to a running server, and turn on logging 3 levels of [v]erbosity
[r]econnect to a running server, run a single command, and return
Show chan_SIP clients (phones)
Show active calls and channels
Show voicemail mailboxes
Terminate a channel
Reload chan_SIP configuration
SYNOPSIS
asterisk [options]
To connect to a running instance: asterisk -r
To execute a command on a running instance: asterisk -rx "command"
To run in console mode: asterisk -c
PARAMETERS
-r
Connects to a running Asterisk daemon's console (remote console mode).
-rx "command"
Executes the specified command on a running Asterisk instance's console and then exits.
-c
Starts Asterisk in foreground console mode, displaying output directly to the terminal.
-f
Runs Asterisk in the foreground (similar to -c), keeping standard file descriptors open.
-v, -vv, -vvv...
Increases the verbose output level for logging and debugging.
-d, -dd, -ddd...
Increases the debug output level for more detailed diagnostic information.
-p
Pipes console output to stdout, useful for scripting and integration.
-U user
Runs the Asterisk daemon process as the specified system user after initialization.
-G group
Runs the Asterisk daemon process as the specified system group after initialization.
-C file
Specifies an alternate main configuration file (e.g., /etc/asterisk/asterisk.conf).
-M dir
Specifies an alternate module directory dir for loading dynamic modules.
-N
Prevents Asterisk from backgrounding itself (no backgrounding mode).
-i
Initializes modules only; does not start the PBX core engine.
-h
Displays a help message with command-line options and exits.
-V
Displays the Asterisk version information and exits.
DESCRIPTION
Asterisk is a free and open-source software framework for building communications applications. It transforms an ordinary computer into a powerful communications server, powering IP PBX systems, VoIP gateways, conference servers, and custom solutions for small businesses, large enterprises, and call centers.
It handles core telephony functions such as calls, voicemail, conferencing, and call queues, integrating with diverse telephony protocols including SIP, IAX, H.323, and traditional PRI lines.
Asterisk supports both traditional PSTN (Public Switched Telephone Network) and modern VoIP protocols, enabling it to bridge communication between them seamlessly. Users can create custom dial plans using its built-in scripting language, AEL (Asterisk Extension Language), or through external applications via AMI (Asterisk Manager Interface) or AGI (Asterisk Gateway Interface). Widely adopted globally, Asterisk is maintained by Digium (a Sangoma company) and provides a robust, flexible platform for voice, video, and messaging services.
CAVEATS
Asterisk is a sophisticated, enterprise-grade communications system, not a simple shell utility. Its effective deployment and management require a solid understanding of telecommunications concepts, networking, and its extensive configuration files.
It can be resource-intensive, particularly under heavy call loads, demanding careful planning for system resources.
Proper security configuration is absolutely critical to prevent unauthorized access, toll fraud, and other vulnerabilities inherent in a telephony system.
It typically runs as a background daemon service, managed by systemd or traditional init scripts, rather than being invoked directly for daily operations.
INTERNAL CLI COMMANDS
Once connected to the Asterisk console (typically via asterisk -r), users interact with the PBX using a rich set of internal CLI commands. These commands allow for real-time monitoring, troubleshooting, and dynamic configuration adjustments. Examples include core show channels, dialplan reload, pjsip show endpoints, and numerous others organized by module or function.
CONFIGURATION FILES
Asterisk's operational behavior is primarily defined by a collection of inter-related text-based configuration files, usually located in /etc/asterisk/. Key configuration files include asterisk.conf (global settings), sip.conf (SIP configurations), extensions.conf (the dialplan), voicemail.conf, and many others, each controlling specific aspects of the PBX functionality.
INTEGRATION INTERFACES (AGI/AMI)
Asterisk offers powerful interfaces for external application integration:
AGI (Asterisk Gateway Interface) enables external programs to control call flow within the dialplan, allowing for complex, dynamic call handling.
AMI (Asterisk Manager Interface) is a TCP-based interface used by client applications to send commands to Asterisk and receive events, facilitating remote control, monitoring, and CRM integration.
HISTORY
Asterisk was originally created by Mark Spencer in 1999 for his company, Digium. Initially developed as a proprietary software PBX system for Linux, it was quickly open-sourced, a move that significantly spurred the growth and innovation in the open-source telephony and Voice over IP (VoIP) sectors.
Its modular architecture and extensible design allowed it to rapidly evolve and support a wide range of telephony protocols and features. Asterisk became the flagship product for Digium, which was later acquired by Sangoma Technologies Corporation. Its impact on unified communications has been profound, making sophisticated telephony capabilities accessible to a broad audience and continuously adapting to new communication technologies and standards.
SEE ALSO
sipcli(1), iax(1), rtpengine(8), opensips(8), kamailio(8), freeswitch(8), sshd(8)