Vous êtes sur la page 1sur 6

Asterisk Installation and Configuration:

Installation:

Base Install of Asterisk on an i386 CentOS/RHEL box:


For reasons detailed elsewhere, you're best not using a GUI, so do the installation from the command line ('linux-text' at the GRUB prompt). When you select the packages, the only one you need is 'server'. Disk partitioning, networking etc. is all entirely up to you! At your first login, you'll be presented with a simple administration screen. Disable SELinux and (for now) the firewall.

Dependencies
The first thing to do is to get your box up to date. If you have CentOS 5.1 or lower, you may want to upgrade to CentOS 5.2. Try: yum -y upgrade and then reboot. Otherwise, to update all the installed packages, at the shell, run yum -y update When you've done either of the above, reboot the machine when it's finished (as it'll install a new kernel) and then run yum -y update again and repeat until there are no more updates.

Quick method:
Do you trust me? If so, the line below will install all the dependencies you need (and then some!) - cut and paste from here if you're happy to install things you may or may not need. If not, then have a look at this page's history as some of the dependencies are listed separately.

yum -y install gccgcc-c++ kernel-devel bison openssl-devel \ libtermcap-develncurses-develdoxygen curl-devel newt-devel \ mlocate lynx tar wgetnmap bzip2 mod_sslcrontabsvixie-cron \ speexspeex-develunixODBCunixODBC-devellibtool-ltdl \ libtool-ltdl-develmysql-connector-odbcmysqlmysql-devel \ mysql-server php-mysqlphp-mbstringphp-mcrypt flex screen \ libxml2 libxml2-devel libtifflibtiff-develgmimegmime-devel \ net-snmp-utils net-snmp-devel neon libxml2 openssl \ openssl-develgnutls-develgnutls-utils

For Centos X86_64


The latest CentOS release doesn't appear to install any .i386 libraries, so installation should work as above. Checking whether the following code is still required:

yum -y install libidn-devel krb5-devel krb5-libs zlib-devellibidn-devel ln -sf /lib64/libcom_err.so.2 /lib64/libcom_err.so

Download and install Asterisk and components


Download
Download the latest asterisk version /usr/src/asterisk and untar the files as follows: mkdir -p /usr/src/asterisk cd /usr/src/asterisk wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linuxcomplete-current.tar.gz wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz wget http://soft-switch.org/downloads/spandsp/spandsp-0.0.5.tgz tar -zxf dahdi-linux-complete-current.tar.gz tar -zxf asterisk-1.4-current.tar.gz tar -zxf libpri-1.4-current.tar.gz tar -zxf spandsp-0.0.5.tgz
You'll end up with four tar files and four directories in the directory '/usr/src/asterisk'.

SpanDSP(optional)

cd /usr/src/asterisk/spandsp-0.0.5 make clean ./configure make make install cat > /etc/ld.so.conf.d/spandsp.conf<< EOF /usr/local /usr/local/lib EOF ldconfig v

Libpri(optional)
If you are using E1 cards you need to install LIBPRI. If you do want to use LIBPRI, make sure you compile and install it before you compile Asterisk. Replace 'VERSION' with the correct details.

cd /usr/src/asterisk/libpri-VERSION make clean make make install

DAHDI
You're pretty much going to need DAHDI. If not for any hardware then for the dummy timer anyway. Note that the stock CentOS kernels come with a 1000HZ timer and so don't need recompiling (phew!). Replace 'VERSION' with the correct details.

cd /usr/src/asterisk/dahdi-linux-complete-VERSION make all make install make config


Edit /etc/dahdi/modules.conf, /etc/dahdi/system.conf and /etc/asterisk/chan_dahdi.conf for your site. Set DAHDI to start automatically and then start it.

chkconfigdahdi on service dahdi start

Asterisk
cd /usr/src/asterisk/asterisk-VERSION make clean ./configure Choose which options to install (audio files, voicemail storage, codecs etc.) makemenuselect make make install Install sample files in /etc/asterisk, install docs/manpages and set to start on boot.

make samples make progdocs make config chkconfig asterisk on


Check Asterisk starts properly:

asterisk -vvvvvvvvvvvvvvvvvvvc stop now


If not, you've probably not been following these instructions carefully! Assuming it does start properly, you probably want to start it in the background: service asterisk start Then edit the following files in /etc/asterisk: indications.conf - Change default country modules.conf - Uncomment the line 'preload => res_odbc.so' modules.conf - Add 'noload => pbx_ael.so' to bottom of file modules.conf - Add 'noload => codec_dahdi.so' to the bottom of the file

Configuration:

Once you have asterisk installed and running you need to configure it, to be able to use it as PBX. Asterisk has a lot of features, and we will start to explore some of them here step by step, in this first post about configuring Asterisk, I will only show you how to configure a single two internals and make them be able to call each other, you may add more than one, as you will see later, and all of them will be able to call each other. So lets start: Asterisk has two main configuration files, and those are:
/etc/asterisk/sip.confand /etc/asterisk/extensions.conf

On the first one we will configure the extensions, properties, and on the second one we will configure the dial plans, and how they will be able to reach each other. Here is a simple example of /etc/asterisk/sip.conf file, with two extensions.
[5010] type=friend username=5010 secret=123456 host=dynamic context=default [5020] type=friend username=5020 secret=123456 host=dynamic context=default

This will create two extensions, 5010 and 5020, this is assuming they are not behind a nat, if that is the case, this could the configuration file instead.
[5010] type=friend nat=yes username=5010 secret=123456 host=dynamic context=default [5020] type=friend nat=yes username=5020 secret=123456 host=dynamic context=default

Well now, lets explain a little the fields in this configuration file:
y

y y y y y

type: Defines the role the extension will have, and we have three options: - peer: Where the device will only be able to receive calls from the PBX - user: Where the device will only be able to make calls to the PBX - friend: Where the device will be able to both make and receive calls through the PBX nat: Defines, if the connecting device that will use that profile, is or is not behind nat. username: Defines the username to be used to connect to the PBX secret: Is the password to be able to connect to the PBX host: The IP that the device will have, if it is set to dynamic, that device will be able to log into the PBX from any IP default: This is very important and defines the group at which that profile belongs, and it is used in the /etc/asterisk/extensions.conf file.

Now, let s configure the second file: /etc/asterisk/extensions.conf


[default] exten => 5010,1,Dial(SIP/5010) exten => 5020,1,Dial(SIP/5020)

I am keeping this as simple as possible, for now, and this will only make possible to call from one extension to the other one, this file, contains the rules about dialing, and what to do, when the PBX "sees" the numbers dialed by a remote user. What we see here, is that to reach extension 5010, the PBX should dial 5010 using SIP, and as you can see, those rules belong to the default profile, so you can create a lot of profiles, and each telephone attached to the PBX, will belong to one of them and will be able to do only what this file is allowing it to do, so is more or less like having VLANs, or in this case Virtual PBXs, and later we will see how to permit to call from one VPBX to the other. Well, with this simple configuration you now have a running and working PBX, I will show you later, how to configure Ekiga to use this asterisk configuration.

Vous aimerez peut-être aussi