Download - ADV Module03
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 1/27
Installing Asterisk
Module 3
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 2/27
2Copyright 2009 Digium, Inc.
Module Goals:
Learn about Asterisk version numbers and howAsterisk releases work
Talk about various ways of installing Asterisk
Learn to download, compile, and install
Asterisk and related components from sourcecode
Learn the various methods of starting andstopping Asterisk
Learn to connect with the Asterisk command-line interface
Learn how to set Asterisk to automatically start when Linux boots
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 3/27
3Copyright 2009 Digium, Inc.
Asterisk developers use a source codecontrol tool known as Subversion
This allows them to keep track of thesource code – who, when, where, and why
Subversion uses a model of a trunk andbranches
Different release versions of Asterisk arebranches on the development tree
Source Code Control
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 4/27
4Copyright 2009 Digium, Inc.
1.6.1 Branch
TRUNK
Asterisk Development Tree
1.6.0 Branch
1.6.2 Branch
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 5/27
5Copyright 2009 Digium, Inc.
Development version (trunk): –This is where new features are added –Changes daily, always in a state of flux
Release versions:
–For use in production environments –Asterisk 1.6.2 is current release branch –Bug fixes are the only changes that happen in
release branches. Any new features are added to
trunk.
Versions & Releases
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 6/27
6Copyright 2009 Digium, Inc.
libpri –PRI ISDN library for T1/E1/J1 interfaces –Really only needed for PRI connections, but usually
installed for completeness
DAHDI –Kernel drivers for analog and digital cards –Also provides system timing in the absence of a
hardware card
Asterisk –source code of Asterisk itself
Asterisk Components
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 7/277Copyright 2009 Digium, Inc.
Sound prompts by Allison Smith, thevoice of Asterisk
Over 1,000 words and phrases, many of which where donated by the community
Including phrases like: –Please enter the extension of the person you'd like
to reach –Will you marry me? Press 1 for yes or 2 for no. –To dial by name, press... –Weasels have eaten our phone system
You can choose which sound packages
to install
Asterisk Sound Prompts
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 8/278Copyright 2009 Digium, Inc.
Make sure your system is ready to installAsterisk
You'll need the GCC compiler
System Libraries and Applications –OpenSSL and its development libraries –ncurses and ncurses-devel (for the CLI) –Zlib (compression library) –newt and newt-devel libraries (for DAHDI utilities)
Other considerations: –Curl (for allowing Asterisk to interact with web sites) –Sendmail or Postfix (for sending voicemail to your
email)
Getting ready to install Asterisk
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 9/279Copyright 2009 Digium, Inc.
Ways of Installing Asterisk
From packages –Packages make installation easy, and help withdependency resolution, and are available for mostmajor Linux distributions
From source –More complicated than installing from packages, butgives you complete control of which modules areincluded
–We'll install from source in the next lab
As part of an Asterisk-based distribution –There are many Linux distributions built around
Asterisk, which take care of installing Linux,Asterisk, and other tools all at once
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 10/2710Copyright 2009 Digium, Inc.
Two methods: –HTTP http://downloads.digium.com/pub/telephony/ Gives you a file browser with all dowloadable files Current releases, as well as past releases in the old-releases or
releases subdirectories
–SVN Point the Subversion utility at http://svn.digium.com/svn/ View the web interface at http://svn.digium.com/view/ any version or revision or branch, including developer branches
How to get the Source Code
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 11/2711Copyright 2009 Digium, Inc.
libpri-1.4.X.Y.tar.gzdahdi-linux-complete-2.X.Y.tar.gz
asterisk-1.6.X.Y.tar.gz
(replace the .X.Y with the current version)
What Source Code to Get
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 12/2712Copyright 2009 Digium, Inc.
Compile in the following order: – libpri, DAHDI, then Asterisk
Compiling will follow the following steps: –Extract the source code
–Run the configure script This will check your system for any missing items
–Run the menuselect script This allows you to choose which modules to compile, and which
other options to set
–Compile the code – Install the program – Install any sample files or initscripts (if necessary)
Compile the Code
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 13/2713Copyright 2009 Digium, Inc.
If you get the code via HTTP you will bedownloading tarballs – .tar.gz or .tgz files are called tarballs – They're similar to zip files
To extract the source code from the tarball: – Don't forget to replace the X with the current version
tar -zxvf libpri-1.4.X.tar.gz
tar -zxvf dahdi-linux-complete-2.X.tar.gz
tar -zxvf asterisk-1.6.X.tar.gz
Each tarball will create a directory with thesource code inside that directory
Extracting the source code
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 14/2714Copyright 2009 Digium, Inc.
Steps for compiling
Most of the components follow this sameformat:# tar -zxvf tarball.tar.gz
# cd directory
# ./configure (not needed for libpri)
# make menuselect (not needed for libpri)
# make
# make install
# make samples (only needed for asterisk)
# make config (not needed for libpri)
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 15/2715Copyright 2009 Digium, Inc.
If you’re missing a vital system library,the build system will complain
Some modules may depend on librariesyou're missing from your system
You can always install the missinglibrary and then recompile, and the buildsystem will adjust accordingly
Requirements: Missing Items
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 16/27
16Copyright 2009 Digium, Inc.
/usr/sbin/asterisk –The Asterisk binary
/etc/asterisk/ –contains the Asterisk configuration files
/usr/lib/asterisk/modules/ –has the Asterisk loadable modules
/var/lib/asterisk/sounds/ –Asterisk sound prompts
/var/lib/asterisk/moh/ –Contains hold music –Asterisk comes with hold music under license from
Freeplay Music Corporation for use in conjunction
with Asterisk only.
Asterisk Files and Directories
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 17/27
17Copyright 2009 Digium, Inc.
/var/lib/asterisk/ –The AstDB database
/var/spool/asterisk/ –call information as well as voicemail and user
greetings /var/log/asterisk/
–Asterisk logs
/var/log/asterisk/cdr-csv/ –Call Detail Records in comma-separated valueformat
What you get: Asterisk
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 18/27
18Copyright 2009 Digium, Inc.
Initialization scripts are installed if youdo the “make config”
On CentOS, simply type: –service dahdi start|stop|restart
–service asterisk start|stop|restart
You will be using these commands tostop and start Asterisk during some ofthe labs in this course
Always start DAHDI before Asterisk, andalways stop Asterisk before DAHDI
Starting Asterisk & DAHDI on Boot
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 19/27
19Copyright 2009 Digium, Inc.
Starting the daemon directly: –# /usr/sbin/asterisk –Runs as a daemon in the background
Start in console mode –# asterisk -c –normally used only for debugging startup problems
Using Linux startup scripts: –# service asterisk start
Automatically restarts if it fails: –# safe_asterisk –Note that the initscripts run Asterisk from the
“safe_asterisk” script so that Asterisk will
automatically restart on most error conditions
Starting Asterisk Manually
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 20/27
20Copyright 2009 Digium, Inc.
When Asterisk is already running, you mustconnect to the CLI to issue commands
To connect to the Asterisk CLI:# asterisk -vvvr
The “-r” is the option which actually connectsto the CLI.
Typing “-vvvr” is a good habit to get into,because it ensures that the verbosity level is at
least 3 You will get an Asterisk CLI prompt
CLI>
Connecting to Asterisk's CLI
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 21/27
21Copyright 2009 Digium, Inc.
# /usr/sbin/asterisk -h List all options.
-r – Re-connect to the running daemon
-c –Start in console mode instead of as a daemon
-v –Set the verbosity level
-d –Set the debug level
-rx “restart now” –Execute the “restart now” command
Starting Asterisk: Other Options
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 22/27
22Copyright 2009 Digium, Inc.
help
quit
core stop now
core set verbose 5 Almost the same as # asterisk -rvvvvv
core set debug 5 Almost the same as # asterisk -rddddd
! spawn to the Unix shell. Use CTRL-D or “exit” to return to the Asterisk
CLI
! unix command execute a single Unix shell command and return to the Asterisk CLI
Common CLI> Commands
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 23/27
23Copyright 2009 Digium, Inc.
From the CLI> prompt try: –help –help core stop –core show applications –core show application dial –core show functions –core show function LEN – ! ls
Help
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 24/27
24Copyright 2009 Digium, Inc.
Asterisk version numbers and releases
Requirements for installing Asterisk
Compiling libpri, DAHDI, Asterisk
Starting AsteriskConnecting to the Asterisk CLI
Getting help from the CLI
Module 3 Recap:
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 25/27
25Copyright 2009 Digium, Inc.
Installing Asterisk
Now we're going to do our first Asterisklab – Installing LibPRI, DAHDI, and Asterisk
This is discovery learning
–You might be seeing some things for the first time –Be sure to read all the text, not just type the
commands –Ask the trainer, or discuss with other participants
We will review after you have Asterisk upand running
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 26/27
26Copyright 2009 Digium, Inc.
Installing LibOpenR2 (depois de DAHDI)
# cd /usr/src
Descargar con wget “DAHDI Complete 2.4.1.2+2.4.1Source Tarball” de sitio de asterisk,descomprimir, ingresar al directorio y ejecutarlocon make y make install. Lo mismo para libpri.“LibPRI 1.4.11.5 Source Tarball”
# wget http://openr2.googlecode.com/files/openr2-1.3.0.tar.gz
# tar -zxvf openr2-1.3.0.tar.gz
# cd openr2-1.3.0# ./configure -–prefix=/usr
# make
# make install
8/6/2019 ADV Module03
http://slidepdf.com/reader/full/adv-module03 27/27
27
LabLab: Installing Asterisk
Lab 3-1: Installing Asterisk
Time Limit: 40 Minutes
Requirements: –Linux installed on your workstation
–Connection to the training network