Obtaining the Source Code

The best place to get source code for Asterisk and it’s packages is directly from the http://www.asterisk.org web site or FTP server.

Obtaining Asterisk Source Code

The easiest way to obtain the most recent release is through the use of the program wget.

Note that we will be making use of the /usr/src/ directory to extract and compile the Asterisk source, although some system administrators may prefer to use /usr/local/src. Also be aware that you will need root access to write files to the /usr/src/ directory and to install Asterisk and its associated packages.

Note

See Chapter 13 for information on running Asterisk as non-root. All security professionals will recommend that you run your daemons as a non-root user in case there are security vulnerabilities in the software. This helps to lower (but obviously does not eliminate) the risk of someone compromising the root user.

To obtain the latest release source code via wget, enter the following commands on the command line:

# cd /usr/src/# wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz
# wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz
# wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz

Note

The latest versions of the asterisk, libpri, and zaptel packages may not necessarily be the same version number.

Alternatively, during development and testing you will probably want to work with the latest branch. To check it out from SVN, run:

          # svn co http://svn.digium.com/svn/asterisk/branches/1.4 asterisk-1.4

If you retrieved the described source code via the release files on the Digium FTP server, then extract the files as described in the next section before continuing on with compiling.

Extracting the Source Code

The packages you downloaded from the FTP server are compressed archives containing the source code; thus, you will need to extract them before compiling. If you didn’t download the packages to /usr/src/, either move them there now or specify the full path to their location. We will be using the GNU tar application to extract the source code from the compressed archive. This is a simple process that can be achieved through the use of the following commands:

# cd /usr/src/
# tar zxvf zaptel-1.4-current.tar.gz
# tar zxvf libpri-1.4-current.tar.gz
#tar zxvf asterisk-1.4-current.tar.gz

Tip

In bash (and other shell systems which support it), you can use an extremely handy feature called Tab completion. This will allow you to type part of a filename and have the rest of it completed automatically. For example, if you type tar zxvf zap<tab> that will complete the full zaptel filename for you. If more than one filename matches the pattern and you hit Tab twice, it will list the files matching that pattern.

These commands will extract the packages and source code to their respective directories. When you extract the asterisk-1.4-current.tar.gz file, you will find that the file will extract to the current version of Asterisk, i.e. asterisk-1.4.4.

Tip

It’s always a good idea to keep the source code of the most recently working version of a package in case you have to “roll back” out of a new bug introduced, or some other strange behavior you can’t solve immediately.



[44] Subversion is an excellent code management system, available at http://subversion.tigris.org/. It also has an equally excellent Creative Commons released book, Version Control with Subversion, by Ben Collins Sussman et al. (O’Reilly), available online at http://svnbook.red-bean.com/.

[45] As of the release date of this book, there has been no determination that the next Asterisk release will be 1.6. It could just as easily be 2.0. Therefore, when discussing new features, you’ll see us talk about what’s in Trunk or what will be in the next release—without mentioning the specific version.

Get Asterisk: The Future of Telephony, 2nd Edition 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.