Goal (short description)

Asterisk is an open source/free softwareimplementation of a telephone private branch exchange (PBX). Like any PBX, it allows a number of attached telephones(or softphones) to make calls to one another, and to connect to other telephone services including the public switched telephone network(PSTN) if gateway hardware is installed.

Applicability

Prerequisites (OS, dependencies on other software)

You must install these packages before proceeding with the installation of Asterisk.

Download & build:

wget [http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.1.tar.gz]
wget [http://ftp.digium.com/pub/zaptel/zaptel-1.2.15.tar.gz]
wget [http://ftp.digium.com/pub/libpri/libpri-1.4.0.tar.gz]

tar zxvf zaptel-1.2.15.tar.gz

cd zaptel-1.2.15/

make

make install

cd ..

tar zxvf libpri-1.4.0.tar.gz

cd libpri-1.4.0/

make

make install

cd ..

tar zxvf asterisk-1.4.1.tar.gz

cd asterisk-1.4.1/

./configure

make menuconfig


 
                                                                 Asterisk Module Selection

                                                                     Press 'h' for help.
                                                              \---> 1.  Applications
                                                                    2.  Call Detail Recording
                                                                    3.  Channel Drivers
                                                                    4.  Codec Translato
                                                                    5.  Format Interpreters
                                                                    6.  Dialplan Functions
                                                                    7.  PBX Modules
                                                                    8.  Resource Modues
                                                                    9.  Voicemail Build Options
                                                                   10. Compiler Flags
                                                                   11. Module Embedding
                                                                   12. Core Sound Packages
                                                                   13. Music On Hold File Packages
                                                                   14. Extras Sound Packages
\\
\---------------------------------------------------------------------------------------------------------Navigate with these commands:
scroll        => up/down arrows
(de)select    => Enter
select all    => F8
deselect all  => F7
back          => left arrow
quit          => q
save and quit => x
Most of the *make menuconfig* options are self-explanatory, provided you know what the various applications or modules are for. When in doubt, accept the defaults. At worst you'll install something you don't need, or have to go back and add something later

In the bottom of menu you will see the dependences of the module you are selecting.
\\

Exit and save with x and write:
\\

make
\\

If you want samples and documentation:
\\

make samples

make progdocs
\\

And finally installation:
\\

make install
\\
\\

 
 

Configuration

The directory with all configuration files is by default /etc/asterisk/

The basic configuration files if we are going to use sip protocol are: sip.conf and extensions.conf

CHANNELS

Asterisk support several types of channels, examples are: h.323, sip, iax, zap, etc

In this document we are going to implement sip channels and for this we use sip.conf configuration file.

SIP.CONF

This file follows the general syntax in configuration files. They are composed by sections, variables and values in this way:

[SECTION1]

Variable1=value1

Variable2=value2

....

[SECTION2]

Variable1=value1

Variable2=value2

....

There is a [general] section where you can define the general parameters of sip channels. For example:
general
port = 5060 ; Port to bind to
bindaddr = 0.0.0.0 ; Address to bind to
context = sip ;default 'sip' context for incoming calls

You have to define one section for each sip telephone so:

[phone1]
type=friend
host=dynamic
defaultip=192.168.1.4
;username=blah
;secret=blah
dtmfmode=rfc2833 ; Choices are inband, rfc2833, or info
mailbox=1000 ; Mailbox for message waiting indicator
context=sip
callerid="Me" <2124>

 
[phone2]
type=friend
;secret=blah
host=dynamic
defaultip=192.168.1.3
dtmfmode=rfc2833 ; Choices are inband, rfc2833, or info
mailbox=1000 ; Mailbox for message waiting indicator
context=sip
callerid="Mini Me" <2123>

 
sip.conf only define sip channels, not the dialing plan that is defined  in extensions.conf. Each sip channel belongs to one context

DIALPLAN

EXTENSIONS.CONF

One of the most important ideas behind Asterisk is: an extension is a program that defines what will happen when a number is called. And this is done in extensions.conf that implements the dialing plan.

The syntax is similar to sip.conf with several sections:

[general]

[globals]

Contexts and Extensions

Extension Patterns

The general syntax of extensions is:

exten => extension number, command priority, command

Example:exten => 1,1,Dial(SIP/phone1,20,tr)
exten => 2,1,Dial(SIP/phone2,20,tr)
exten => 1000,1,Dial(SIP/phone1&SIP/phone2,20,tr)
* When somebody calls 1 the sip phone1 will ring for 20 seconds if nobody answer the call will fail. This sip phone has to be defined in sip.conf.

The complete extensions.conf file is:

[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static=yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect=no
; If clearglobalvars is not set, then global variables will persist
; through reloads, and even if deleted from the extensions.conf or
; one of its included files, will remain set to the previous value.
;
clearglobalvars=no
;
; User context is where entries from users.conf are registered. The
; default value is 'default'
;
userscontext=sip
;
; The "Globals" category contains global variables that can be referenced
; in the dialplan with the GLOBAL dialplan function:
; $

{GLOBAL(VARIABLE)}\\
\\
\\
\\
\\
\\
\\
\\

; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid

; Unix/Linux environmental variables can be reached with the ENV dialplan

; function: $
\\
{ENV(VARIABLE)}\\
\\
\\
\\
\\
\\
\\
\\

;
[globals]
CONSOLE=Console/dsp                     ; Console interface for demo
; Context sip
[sip]
exten => 1,1,Dial(SIP/phone1,20,tr)
exten => 2,1,Dial(SIP/phone2,20,tr)
exten => 1000,1,Dial(SIP/phone1&SIP/phone2,20,tr)
\\
\\
\\

 
 

ASTERISK CLI

If you installed Asterisk in /usr/sbin, then to run it write:

#/usr/sbin/asterisk

To enter in CLI interface run:

\#/usr/sbin/asterisk \-rcvvvv

Asterisk 1.4.0, Copyright (C) 1999 - 2006 Digium, Inc. and others.

Created by Mark Spencer <markster@digium.com>

Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.

This is free software, with components licensed under the GNU General Public

License version 2 and other licenses; you are welcome to redistribute it under

certain conditions. Type 'core show license' for details.

=========================================================================

== Parsing '/etc/asterisk/asterisk.conf': Found

== Parsing '/etc/asterisk/extconfig.conf': Found

Connected to Asterisk 1.4.0 currently running on lab2 (pid = 2448)

\-\- Remote UNIX connection

Verbosity is at least 15

lab2*CLI>
\\

 
As many v's you write more verbose output you'll obtain. Main  commands are:

Basic ASTERISK installation (1.4.1)

OS specific help

Validation, confirmation tests