Asterisk file and directory structure
The directories used by Asterisk can be configured in the asterisk.conf configuration file.
Here we’ll describe what each directory is used for, and what sub-directories Asterisk will place in each by default.
Below each heading you can also see the correlating configuration line in asterisk.conf.
Asterisk Configuration Files
astetcdir => /etc/asterisk
This location is used to store and read Asterisk configuration files. That is generally files with a .conf extension, but other configuration types as well, for example .lua and .ael.
astmoddir => /usr/lib/asterisk/modules
Loadable modules in Shared Object format (.so) installed by Asterisk or the user should go here.
astvarlibdir => /var/lib/asterisk
Additional library elements and files containing data used in runtime are put here.
astdbdir => /var/lib/asterisk
This location is used to store the data file for Asterisk’s internal database. In Asterisk versions using the SQLite3 database, the file will be named astdb.sqlite3.
astkeydir => /var/lib/asterisk
When configuring key-based encryption, Asterisk will look in the keys subdirectory of this location for the necessary keys.
System Data Directory
astdatadir => /var/lib/asterisk
By default, Asterisk sounds are stored and read from the sounds subdirectory at this location.
AGI(Asterisk Gateway Interface) Directory
astagidir => /var/lib/asterisk/agi-bin
When using various AGI applications, Asterisk looks here for the AGI scripts by default.
astspooldir => /var/spool/asterisk
This directory is used for storing spool files from various core and module-provided components of Asterisk.
Most of them use their own subdirectories, such as the following:
Running Process Directory
astrundir => /var/run/asterisk
When Asterisk is running, you’ll see two files here, asterisk.ctl and asterisk.pid. That is the control socket and the PID(Process ID) files for Asterisk.
astlogdir => /var/log/asterisk
When Asterisk is configured to provide log file output, it will be stored in this directory.
System Binary Directory
astsbindir => /usr/sbin
By default, Asterisk looks in this directory for any system binaries that it uses, if you move the Asterisk binary itself or any others that it uses, you’ll need to change this location.