3.2. Obtaining the Source Code
The Asterisk source code can be obtained either
through FTP or CVS. We will show you how to acquire the source with
both methods, although you only need to use one of them to retrieve
the packages (FTP is the preferred method).
3.2.1. Obtaining Asterisk Source Code
from FTP
The Asterisk source code can be obtained from
the Digium FTP server, located at ftp://ftp.digium.com. The
easiest way to obtain the stable release is through the use of the
program wget.
Asterisk comes in two different flavors,
generally referred to as stable
and head. Stable, as the name
implies, is the established branch of Asterisk for use in
production systems. The head branch is what the developers use to
test new features and bug fixes .
Bug fixes (not features) are merged over to the
stable branch after a reasonable period of testing. It is entirely
possible that the development branch may be broken at certain
points during testing; thus, the stable branch is what you will
want to run your production system on, and it is what we will be
using throughout this book.
You can obtain stable releases via FTP. Both the
stable and head branches of Asterisk can also be obtained from CVS,
as explained later in this chapter. However, it is important to
note the difference between releases and CVS. Releases are snapshots from the stable
CVS tree, tagged with a version number and released via the FTP
server when a new stable release is deemed ready. Note that the
stable CVS branch is not a
releaseit's a work in a progress, and it may be buggy (i.e., not so
stable after all). The FTP tarballs are the actual releases.
To summarize, use only stable releases obtained
via the FTP server for production systems.
|
Note that we will be making use of the
/usr/src/ directory to extract and
compile the Asterisk source. 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.
To obtain the latest stable source code via
wget, enter the following commands
on the command line:
# cd /usr/src/
# wget --passive-ftp ftp.digium.com/pub/asterisk/asterisk-1.*.tar.gz
# wget --passive-ftp ftp.digium.com/pub/asterisk/asterisk-sounds-*.tar.gz
# wget --passive-ftp ftp.digium.com/pub/zaptel/zaptel-*.tar.gz
# wget --passive-ftp ftp.digium.com/pub/libpri/libpri-*.tar.gz
|
As long as Digium doesn't change the way they
put things on the FTP site, the wget command will
automagically get the latest version. You may also replace the
wildcard mask (*) with the
currently available software version.
|
|
Now that you've retrieved the files for Asterisk
and the Digium hardware, you are ready to extract the code.
3.2.2. Extracting the Source Code
If you use wget to obtain the source
code from the FTP server, you will need to extract it 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-*.tar.gz
# tar zxvf libpri-*.tar.gz
# tar zxvf asterisk-*.tar.gz
# tar zxvf asterisk-sounds*.tar.gz
These commands will extract the packages and
source code to their respective directories.
3.2.3. Obtaining Asterisk Source Code
from CVS
The Concurrent Versioning System (CVS) is a tool
that provides a central repository that large (and diverse)
development teams can use to manage the multitude of files
associated with a development project. When a change is made, it is
committed to the CVS server, where it is immediately available for
download and compilation. Another added benefit of using CVS is
that the version for any particular file can be rolled back to a
certain instance, so that if something was working at one point but
a change causes it to break, you can easily revert to the working
version. This is true for the entire tree as well. If you find that
installing the latest version of Asterisk causes any part of the
system to break, you can "roll back" to an earlier point in time
and investigate the cause of the problem.
If you are a developer looking to obtain the
latest updates to the source code, you will need to get them from
the CVS servers. You can also download the stable branch via
CVS:
-
Export the CVSROOT path:
# cd /usr/src/
# export CVSROOT=:pserver:anoncvs:anoncvs@cvs.digium.com:/usr/cvsroot
-
Download HEAD
from CVS:
# cvs checkout zaptel libpri asterisk
-
Download STABLE
1.0 from CVS:
# cvs checkout -r v1-0 zaptel libpri asterisk
-
Download STABLE
1.2 from CVS:
# cvs checkout -r v1-2 zaptel libpri asterisk
-
Download optional modules from CVS:
# cvs checkout asterisk-sounds asterisk-addons
Again, note that the stable branch available
from CVS is not a release and should not be used for production
systems.
|