The top level 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
Loadable modules in Shared Object format (.so) installed by Asterisk or the user should go here.
Additional library elements and files containing data used in runtime are put here.
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.
When configuring key-based encryption, Asterisk will look in the keys subdirectory of this location for the necessary keys.
System Data Directory
By default, Asterisk sounds are stored and read from the sounds subdirectory at this location.
AGI(Asterisk Gateway Interface) Directory
When using various AGI applications, Asterisk looks here for the AGI scripts by default.
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
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.
When Asterisk is configured to provide log file output, it will be stored in this directory.
System Binary Directory
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.