Running Asterisk from the Command Line¶
- By default, starting Asterisk will run it in the background:
-R option will also attach a remote console - however, it will attempt to automatically reconnect to Asterisk if for some reason the connection is broken. This is particularly useful if your remote console restarts Asterisk.
On this Page* To disconnect from a connected remote console, simply hit Ctrl+C:
core stop gracefully:
You can stop/restart Asterisk in many ways. See Stopping and Restarting Asterisk From The CLI for more information.
- You can start Asterisk in the foreground, with an attached root console, using the
Asterisk provides a number of mechanisms to control the verbosity of its logging. One way in which this can be controlled is through the command line parameter
-v. For each
-v specified, Asterisk will increase the level of
VERBOSE messages by 1. The following will create a console and set the
VERBOSE message level to 2:
Command line parameters can be combined. The previous command can also be invoked in the following way:
VERBOSE message level set via the command line is only applicable if the
verbose setting is not set.
Remote Console Verbosity¶
!!! tip ** **This feature is only available in Asterisk 11 and later versions. ---
The verboseness of a remote console is set independently of the verboseness of other consoles and the core. A root console can be created with no verboseness:
While a remote console can be attached to that Asterisk process with a different verbosity:
Multiple remote consoles can be attached, each with their own verbosity:
Executing as another User¶
Running Asterisk as
root or as a user with super user permissions is dangerous and not recommended. There are many ways Asterisk can affect the system on which it operates, and running as
root can increase the cost of small configuration mistakes.
For more information, see the README-SERIOUSLY.bestpractices.md file delivered with Asterisk.
Asterisk can be run as another user using the
Often, this option is specified in conjunction with the
-G option, which specifies the group to run under:
When running Asterisk as another user, make sure that user owns the various directories that Asterisk will access:
There are many more command line options available. For more information, use the
Running Asterisk as a Service¶
The most common way to run Asterisk in a production environment is as a service. Asterisk includes both a
make target for installing Asterisk as a service, as well as a script -
live_asterisk - that will manage the service and automatically restart Asterisk in case of errors.
- Asterisk can be installed as a service using the
Not all distributions of Linux/Unix are supported by the
make config target. The following distributions are supported - if not using one of these distributions, the
make config target may or may not work for you.