<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Directories Used by Asterisk</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /><link rel="start" href="index.html" title="Asterisk™: The Future of Telephony" /><link rel="up" href="asterisk-CHP-3.html" title="Chapter 3. Installing Asterisk" /><link rel="prev" href="asterisk-CHP-3-SECT-11.html" title="Starting Asterisk Without Scripts" /><link rel="next" href="asterisk-CHP-3-SECT-14.html" title="AsteriskNOW™" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Directories Used by Asterisk</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="asterisk-CHP-3-SECT-11.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Installing Asterisk</th><td width="20%" align="right"> <a accesskey="n" href="asterisk-CHP-3-SECT-14.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="asterisk-CHP-3-SECT-12"></a>Directories Used by Asterisk</h2></div></div></div><p>Asterisk uses <a id="ch03_dirused" class="indexterm"></a>several directories on a Linux system to manage the various aspects of the system, such as voicemail recordings, voice prompts, and configuration files. This section discusses the necessary directories, all of which are created during installation and configured in the <span class="emphasis"><em>asterisk.conf</em></span> file.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.1"></a>/etc/asterisk/</h3></div></div></div><p>The <span class="emphasis"><em>/etc/asterisk/</em></span> directory <a id="I_indexterm3_tt375" class="indexterm"></a>contains the Asterisk configuration files. One file, however—<span class="emphasis"><em>zaptel.conf—</em></span>is located in the <span class="emphasis"><em>/etc/</em></span> directory. The Zaptel hardware was originally designed by Jim Dixon of the Zapata Telephony Group as a way of bringing reasonable and affordable computer telephony equipment to the world. Asterisk makes use of this hardware, but any other software can also make use of the Zaptel hardware and drivers. Consequently, the <span class="emphasis"><em>zaptel.conf</em></span> configuration file is not directly located in the <span class="keep-together"><span class="emphasis"><em>/etc/asterisk/</em></span></span>directory.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.2"></a>/usr/lib/asterisk/modules/</h3></div></div></div><p>The <span class="emphasis"><em>/usr/lib/asterisk/modules/</em></span> directory<a id="I_indexterm3_tt376" class="indexterm"></a> contains all of the Asterisk loadable modules. Within this directory are the various applications, codecs, formats, and channels used by Asterisk. By default, Asterisk loads all of these modules at startup. You can disable any modules you are not using in the<a id="I_indexterm3_tt377" class="indexterm"></a> <span class="emphasis"><em>modules.conf</em></span> file, but be aware that certain modules are required by Asterisk or are dependencies of other modules. Attempting to load Asterisk without these modules will cause an error at startup.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.3"></a>/var/lib/asterisk</h3></div></div></div><p>The <span class="emphasis"><em>/var/lib/asterisk/</em></span> directory<a id="I_indexterm3_tt378" class="indexterm"></a> contains the <span class="emphasis"><em>astdb</em></span> file and a number of subdirectories. The <span class="emphasis"><em>astdb</em></span> file contains the local Asterisk database information, which is somewhat like the Microsoft Windows Registry. The Asterisk database is a simple implementation based on v1 of the Berkeley database. The <span class="emphasis"><em>db.c</em></span> file in the Asterisk source states that this version was chosen for the following reason: “DB3 implementation is released under an alternative license incompatible with the GPL. Thus, in order to keep Asterisk licensing simplistic, it was decided to use version 1 as it is released under the BSD license.”</p><p>The subdirectories within <span class="emphasis"><em>/var/lib/asterisk/</em></span> include:</p><div class="variablelist"><dl><dt><span class="term"> <span class="emphasis"><em>agi-bin/</em></span> </span></dt><dd><p>The <span class="emphasis"><em>agi-bin/</em></span> directory<a id="I_indexterm3_tt379" class="indexterm"></a> contains your custom scripts, which can interface with Asterisk via the various built-in AGI applications. For more information about AGI, see <a href="asterisk-CHP-8.html" title="Chapter 8. Protocols for VoIP">Chapter 8, <i>Protocols for VoIP</i></a>.</p></dd><dt><span class="term"> <span class="emphasis"><em>firmware/</em></span> </span></dt><dd><p>The <span class="emphasis"><em>firmware/</em></span> directory<a id="I_indexterm3_tt380" class="indexterm"></a> contains firmware for various Asterisk-compatible devices. It currently contains only the <span class="emphasis"><em>iax/</em></span> subdirectory,<a id="I_indexterm3_tt381" class="indexterm"></a> which holds the binary firmware image for Digium’s IAXy.</p></dd><dt><span class="term"> <span class="emphasis"><em>images/</em></span> </span></dt><dd><p>Applications<a id="I_indexterm3_tt382" class="indexterm"></a> that communicate with channels supporting graphical images look in the <span class="emphasis"><em>images/</em></span> directory. Most channels do not support the transmission of images, so this directory is rarely used. However, if more devices that support and make use of graphical images are released, this directory will become more relevant.</p></dd><dt><span class="term"> <span class="emphasis"><em>keys/</em></span> </span></dt><dd><p>Asterisk <a id="I_indexterm3_tt383" class="indexterm"></a>can use a public/private key system to authenticate peers connecting to your box via an RSA digital signature. If you place a peer’s public key in your <span class="emphasis"><em>keys/</em></span> directory, that peer can be authenticated by channels supporting this method (such as the IAX2 channels). The private key is never distributed to the public. The reverse is also true: you can distribute your public key to your peers, allowing you to be authenticated with the use of your private key. Both the public and private keys—ending in the <span class="emphasis"><em>.pub</em></span> and <span class="emphasis"><em>.key</em></span> file extensions, respectively—are stored in the <span class="emphasis"><em>keys/</em></span> directory.</p></dd><dt><span class="term"> <span class="emphasis"><em>mohmp3/</em></span> </span></dt><dd><p>When you configure<a id="I_indexterm3_tt384" class="indexterm"></a> Asterisk for Music on Hold, applications utilizing this feature look for their MP3 files in the <span class="emphasis"><em>mohmp3/</em></span> directory. Asterisk is a bit picky about how the MP3 files are formatted, so you should use constant bitrate (CBR) encoding and strip the ID3 tags from your files.</p></dd><dt><span class="term"> <span class="emphasis"><em>sounds/</em></span> </span></dt><dd><p>All of the available voice<a id="I_indexterm3_tt385" class="indexterm"></a> prompts for Asterisk reside in the <span class="emphasis"><em>sounds/</em></span> directory. The contents of the basic prompts included with Asterisk are in the <span class="emphasis"><em>sounds.txt</em></span> file located in your Asterisk source code directory. Contents of the additional prompts are located in the <span class="emphasis"><em>sounds-extra.txt</em></span> file in the directory to which you extracted the <span class="emphasis"><em>asterisk-sounds</em></span> package earlier in this chapter.</p></dd></dl></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.4"></a>/var/spool/asterisk/</h3></div></div></div><p>The Asterisk spool<a id="I_indexterm3_tt386" class="indexterm"></a> directory contains several subdirectories,<a id="I_indexterm3_tt387" class="indexterm"></a> including<a id="I_indexterm3_tt388" class="indexterm"></a><a id="I_indexterm3_tt389" class="indexterm"></a><a id="I_indexterm3_tt390" class="indexterm"></a><a id="I_indexterm3_tt391" class="indexterm"></a><a id="I_indexterm3_tt392" class="indexterm"></a><a id="I_indexterm3_tt393" class="indexterm"></a><a id="I_indexterm3_tt394" class="indexterm"></a> <span class="emphasis"><em>dictate/, meetme/, monitor/, outgoing/</em></span>, <span class="emphasis"><em>system/</em></span>, <span class="emphasis"><em>tmp/</em></span>, and <span class="emphasis"><em>voicemail/</em></span> (see <a href="asterisk-CHP-3-SECT-12.html#asterisk-CHP-3-FIG-5" title="Figure 3.4. /var/spool/asterisk/ directory structure">Figure 3.4, “/var/spool/asterisk/ directory structure”</a>). Asterisk monitors the <span class="emphasis"><em>outgoing</em></span> directory for text files containing call request information. These files allow you to generate a call simply by moving the correctly structured file into the <span class="emphasis"><em>outgoing/</em></span> directory.</p><div class="figure"><a id="asterisk-CHP-3-FIG-5"></a><p class="title"><b>Figure 3.4. /var/spool/asterisk/ directory structure</b></p><div class="mediaobject"><a id="I_mediaobject3_tt395"></a><img src="figs/web/ast2_0305.png" alt="/var/spool/asterisk/ directory structure" /></div></div><p>Call files being placed into the <span class="emphasis"><em>outgoing/</em></span> directory can contain useful information, such as the Context, Extension, and Priority where the answered call should start, or simply the application and its arguments. You can also set variables and specify an account code for Call Detail Records. More information about the use of call files is presented in <a href="asterisk-CHP-9.html" title="Chapter 9. The Asterisk Gateway Interface (AGI)">Chapter 9, <i>The Asterisk Gateway Interface (AGI)</i></a>.</p><p>The <span class="emphasis"><em>dictate/</em></span> directory is the default location where the <code class="literal">Dictate()</code> application looks for files.</p><p>The <span class="emphasis"><em>meetme/</em></span> directory is the location where <code class="literal">MeetMe()</code> conference recordings are saved.</p><p>Recordings from either one-touch recording (the <code class="literal">w</code> and <code class="literal">W</code> flags to the <code class="literal">Dial()</code> application), the <code class="literal">MixMonitor()</code>, or <code class="literal">Monitor()</code> applications are stored in the <span class="emphasis"><em>monitor/</em></span> directory.</p><p><span class="emphasis"><em>system/</em></span> is used by the <code class="literal">System()</code> application for temporary storage of data.</p><p>The <span class="emphasis"><em>tmp/</em></span> directory is used, funny enough, to hold temporary information. Certain applications may require a place to write files to before copying the complete files to their final destinations. This prevents two processes from trying to write to and read from a file at the same time.</p><p>All voicemail and user greetings are contained within the <span class="emphasis"><em>voicemail/</em></span> directory. Extensions configured in <span class="emphasis"><em>voicemail.conf</em></span> that have been logged in to at least once are created as subdirectories of <span class="emphasis"><em>voicemail/</em></span>.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.5"></a>/var/run/</h3></div></div></div><p>The <span class="emphasis"><em>/var/run/</em></span> directory<a id="I_indexterm3_tt396" class="indexterm"></a> contains the process ID (PID) information for all active processes on the system, including Asterisk (as specified in the <span class="emphasis"><em>asterisk.conf</em></span> file). Note that <span class="emphasis"><em>/var/run/</em></span> is OS-dependent and may differ.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.6"></a>/var/log/asterisk/</h3></div></div></div><p>The <span class="emphasis"><em>/var/log/asterisk/</em></span> directory<a id="I_indexterm3_tt397" class="indexterm"></a> is where Asterisk logs information. You can control the type of information being logged to the various files by editing the <span class="emphasis"><em>logger.conf</em></span> file located in the <span class="emphasis"><em>/etc/asterisk/</em></span> directory. Basic configuration of the <span class="emphasis"><em>logger.conf</em></span> file is covered in <a href="asterisk-APP-D.html" title="Appendix D. Configuration Files">Appendix D, <i>Configuration Files</i></a>.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="asterisk-CHP-3-SECT-12.7"></a>/var/log/asterisk/cdr-csv</h3></div></div></div><p>The <span class="emphasis"><em>/var/log/asterisk/cdr-csv</em></span> directory<a id="I_indexterm3_tt398" class="indexterm"></a> is used to store the CDRs in comma-separated value (CSV) format. By default information is stored in the<a id="I_indexterm3_tt399" class="indexterm"></a> <span class="emphasis"><em>Master.csv</em></span> file, but individual accounts can store their own CDRs in separate files with the use of the <code class="literal">accountcode</code> option (see <a href="asterisk-APP-A.html" title="Appendix A. VoIP Channels">Appendix A, <i>VoIP Channels</i></a> for more<a id="I_indexterm3_tt400" class="indexterm"></a> information).</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="asterisk-CHP-3-SECT-11.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="asterisk-CHP-3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="asterisk-CHP-3-SECT-14.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Starting Asterisk Without Scripts </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> AsteriskNOW<sup>™</sup></td></tr></table></div><div xmlns="" id="svn-footer"><hr /><p>You are reading <em>Asterisk: The Future of Telephony</em> (2nd Edition for Asterisk 1.4), by Jim van Meggelen, Jared Smith, and Leif Madsen.<br /> This work is licensed under the <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works License v3.0</a>.<br /> To submit comments, corrections, or other contributions to the text, please visit <a href="http://oreilly.com/catalog/9780596510480/">http://www.oreilly.com/</a>.</p></div></body></html>