Loading Asterisk

Asterisk can be loaded in a variety of ways. The easiest way is to start Asterisk by running the binary file directly from the Linux command-line interface. If you are running a system that uses the init.d scripts, you can easily start and restart Asterisk that way as well. However, the preferred way of starting Asterisk is via the safe_asterisk script.

CLI Commands

The Asterisk binary is, by default, located at /usr/sbin/asterisk. If you run /usr/sbin/asterisk, it will be loaded as a daemon. There are also a few switches you should be aware of that allow you to (re)connect to the Asterisk CLI, set the verbosity of CLI output, and allow core dumps if Asterisk crashes (for debugging with gdb). To explore the full range of options, run Asterisk with the -h switch:

    # /usr/sbin/asterisk -h

Here is a list of the most commonly used options:

-c

Console. This allows you to connect to the Asterisk CLI.

-v

Verbosity. This is used to set the amount of output for CLI debugging.

-g

Core dump. If Asterisk were to crash unexpectedly, this would cause a core file to be created for later tracing with gdb.

-r

Remote. This is used to reconnect remotely to an already running Asterisk process. (The process is remote from the standpoint of the console connecting to it but is actually a local process on the machine. This has nothing to do with connecting to a remote process over a network using a protocol such as IP, as this is not supported.)

-rx "restart now"

Execute. Using this command in combination ...

Get Asterisk: The Future of Telephony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.