Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Building Telephony Systems With Asterisk (2005).pdf
Скачиваний:
45
Добавлен:
17.08.2013
Размер:
1.82 Mб
Скачать

Making a Plan for Deployment

Summary

Now that we have decided to use Asterisk, we must make a plan. This chapter has looked at the different types of hardware that an Asterisk system needs, namely:

What technology we use to connect to the PSTN

What technology or technologies we use to connect our handsets to Asterisk

What server hardware we will use

How we will architect our extensions to be easy to use while also allowing for the growth we can realistically expect

As we draw up our plan, we must address each of these options, before moving on to the next stage, the installation of the Asterisk software itself, which we cover in the next chapter.

32

3

Installing Asterisk

We're making great time! Together, we have selected Asterisk to meet our needs, created a plan to define how our phone system will act, and we are ready to begin installing Asterisk.

Preparing to Install Asterisk

In order to install Asterisk, we will need a computer with Linux installed. It's a good idea to ensure your system is up to date, for instance using the APT tool. Once we have installed our distribution of choice, we need to make sure we have a few additional packages installed. The required extra packages over a base installation are:

bison

gcc

kernel-source

libtermcap-devel

ncurses-devel

openssl096b

openssl-devel

For versions before 1.2, we must also install mpg123. There is a current security issue with mpg123. If an attacker were to correctly craft an MP2 or MP3 file, and then trick someone into playing back that file, arbitrary code could be executed. While it is preferable not to use packages with known vulnerabilities, the exposure here is minimal, as we should be the only ones creating music on hold for our system. To work around this issue, developers have implemented a native MP3 playing facility within Asterisk starting with version 1.2.

Installing Asterisk

To install mpg123, enter the command wget http://www.mpg123.de/mpg123/mpg123- 0.59r.tar.gz to download the tarball. Once you've got it, unpack it and navigate to the mpg123-0.59r directory, and then type make linux to compile the program, and make install to install it.

Once we have installed these packages, we are ready to install Asterisk. We should not run an X Server or any windowing software on our Asterisk machine, as the resources it consumes are almost guaranteed to delay our voice processing, and therefore negatively impact our sound quality. So you may save a little time and disk space by choosing not to install any such front end.

One note here: we should prepare to manage our server. We must keep in mind that we will not be able to rely on graphical tools on the server to manage users, file systems, and other aspects of the day-to-day maintenance all systems will need. Unless particularly comfortable with command-line configuration, you should probably consider installing a web-based set of tools to configure Linux, such as Webmin, available from www.webmin.com. The graphical configuration options for Asterisk that are available are mostly web based, so we may at some point decide to install these under a web server too, to enable graphical configuration.

Obtaining the Source Files

The very first step we must undertake is to obtain the source files. Two major versions of Asterisk are available: a development version and a stable version. Since the development version may not even compile at any given time, we will be using the stable version. We will be focusing on the version 1.0 branch.

When obtaining the source code, we have two major choices. We can either download the latest version via FTP from ftp://ftp.asterisk.org/pub/asterisk/, or use svn to obtain the latest stable release. The maintainers of Asterisk have been doing a good job of keeping the stable releases available on the FTP servers, so we will use this method.

The commands we issue to download Asterisk's source files are:

#cd /usr/src

#wget ftp://ftp.digium.com/pub/asterisk/asterisk-1.2.1.tar.gz

#wget ftp://ftp.digium.com/pub/asterisk/asterisk-addons-1.2.1.tar.gz

#wget ftp://ftp.digium.com/pub/asterisk/asterisk-sounds-1.2.1.tar.gz

#wget http://ftp.digium.com/pub/zaptel/zaptel-1.2.1.tar.gz

#wget http://ftp.digium.com/pub/libpri/libpri-1.2.1.tar.gz

The download may take anywhere from about one minute on an extremely fast connection to a couple of hours on a slow connection. When the download is complete, we will need to unpack the tarballs. We should also create a link by typing ln –s /usr/src/asterisk-1.2.1 /usr/src/asterisk. This will ensure the "addons" package compiles correctly.

34

Chapter 3

In the next three sections, we'll compile and install the source distributions we've just downloaded. Note that we should install Zaptel first, then libpri, and finally Asterisk.

Installing Zaptel

The Zaptel sources are contained in /usr/src/zaptel. Type the following to install:

#cd /usr/src/zaptel

#make clean; make install

This will take about one to two minutes, depending on the speed of your machine. When it is finished, it should drop us back at the command prompt. If the last message states that there is a failure, we will have to do some detective work to determine the cause. The most common issues experienced will be resolved by meeting the dependencies listed earlier in this chapter.

Zaptel, containing the Zapata drivers created for Asterisk, is necessary to use Digium's telephony hardware, but also includes a number of libraries that Asterisk depends on, whether we use Digium's hardware or not.

If we want to have Asterisk start up at boot time, we should issue the command:

# make config

This command creates a script to insert the Zaptel module in the kernel and run ztconfig at boot time. In Red Hat, this script is then copied into /etc/init.d and configured to run at boot time for the current run level (which should be 3).

Installing libpri

Next, we will compile and install the sources contained in /usr/src/libpri. We do this by typing:

#cd /usr/src/libpri

#make clean; make install

This process should take less than a minute. Again, we know it is complete when we are dropped back at the command prompt.

Libpri provides the libraries required for using Primary Rate ISDN (PRI) trunks, as well as a number of other telephony interfaces. Even if we do not have a PRI line at this time, it is a good idea to install it, as it will not create any conflicts.

Parts of the Asterisk code depend on the libraries included in the libpri package. Therefore, any time we install libpri, we should recompile Asterisk.

35