Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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.

...

  • Linux

...

  • 2.4

...

  • kernel

...

  • sources

...

  • or

...

  • kernel

...

  • 2.6

...

  • header

...

  • files.

...

  • (for

...

  • libpri)

...

  • bison

...

  • and

...

  • bison-devel

...

  • packages

...

  • (This

...

  • is

...

  • used

...

  • to

...

  • build

...

  • Asterisk)

...

  • ncurses

...

  • and

...

  • ncurses-devel

...

  • packages

...

  • (Used

...

  • to

...

  • build

...

  • astman,

...

  • etc.)

...

  • zlib

...

  • and

...

  • zlib-devel

...

  • packages

...

  • openssl

...

  • and

...

  • openssl-devel packages

Download & build:

Code Block
      packages

h2. Download & build:

{code}
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
\\
\\
{code}
 
 
h2. Configuration

The directory with all configuration files is by default 

 
 

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:

Code Block

[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

...

]

...

  • At

...

  • the

...

  • top

...

  • of

...

  • your

...

  • extensions.conf

...

  • file,

...

  • you

...

  • configure

...

  • a

...

  • few

...

  • general

...

  • settings

...

  • in

...

  • the

...

  • section

...

  • headed

...

  • [general

...

  • ]

...

  • .

...

[globals

...

]

...

  • Next,

...

  • in

...

  • the

...

  • [globals

...

  • ]

...

  • section,

...

  • you

...

  • may

...

  • define

...

  • global

...

  • variables

...

  • (or

...

  • constants)

...

  • and

...

  • their

...

  • initial

...

  • values.

...

  •  

Contexts and Extensions

  • After the [general] and [globals] categories, the remainder of the extensions.conf file is taken up by the definition of the Dialplan. The Dialplan consists of a collection of contexts. Each context consists of a collection of extensions.

Extension Patterns

  • When you define the extensions within a context, you may not only use literal numbers, not only alphanumeric names, but also you may define extensions that match whole sets of dialed numbers by using extension patterns.

The general syntax of extensions is:

exten => extension number, command priority, command

  • Where exten if fixed
  • Extension number is the number called
  • Command priority is the order the commands are to be run
  • Command is what is going to be done

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.

...

  • When

...

  • somebody

...

  • calls

...

  • 2

...

  • the

...

  • sip

...

  • phone2

...

  • will

...

  • ring

...

  • for

...

  • 20

...

  • seconds

...

  • if

...

  • nobody

...

  • answer

...

  • the

...

  • call

...

  • will

...

  • fail.

...

  • If

...

  • somebody

...

  • call

...

  • 1000

...

  • then

...

  • the

...

  • phone1

...

  • and

...

  • phone2

...

  • will

...

  • ring

...

  • in

...

  • parallel

...

  • until

...

  • one

...

  • of

...

  • them

...

  • answer

...

  • or

...

  • 20

...

  • secons

...

  • period

...

  • finish.

...

  • Since

...

  • an

...

  • extension

...

  • may

...

  • have

...

  • a

...

  • number

...

  • of

...

  • commands

...

  • there

...

  • may

...

  • be

...

  • multiple

...

  • entries

...

  • for

...

  • an

...

  • extension.

...

The

...

complete

...

extensions.conf

...

file

...

is:

Code Block


{code}
[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)
\\
\\
\\
{code}

 
 
h3. ASTERISK CLI

If you installed Asterisk in 

 
 

ASTERISK CLI

If you installed Asterisk in /usr/sbin,

...

then

...

to

...

run

...

it

...

write:

...

#/usr/sbin/asterisk

...

To

...

enter

...

in

...

CLI

...

interface

...

run:

Code Block

\\

\#/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:

...

  • restart

...

  • gracefully

...

  • :

...

  •   Causes

...

  • Asterisk

...

  • to

...

  • stop

...

  • accepting

...

  • new

...

  • calls

...

  • and

...

  • perform

...

  • a

...

  • cold

...

  • restart

...

  • when

...

  • all

...

  • active

...

  • calls

...

  • have

...

  • ended.

...

  • restart

...

  • now

...

  • :

...

  • Causes

...

  • Asterisk

...

  • to

...

  • immediately

...

  • hang

...

  • up

...

  • all

...

  • calls

...

  • and

...

  • perform

...

  • a

...

  • cold

...

  • restart.

...

  • restart

...

  • when

...

  • convenient

...

  • :

...

  • Causes

...

  • Asterisk

...

  • to

...

  • perform

...

  • a

...

  • cold

...

  • restart

...

  • when

...

  • all

...

  • active

...

  • calls

...

  • have

...

  • ended.

...

  • New

...

  • calls

...

  • are

...

  • accepted,

...

  • and

...

  • only

...

  • when

...

  • all

...

  • calls

...

  • have

...

  • completed

...

  • is

...

  • the

...

  • restart

...

  • performed.

...

  • Use

...

  • this

...

  • command

...

  • very

...

  • carefully,

...

  • as

...

  • you

...

  • have

...

  • no

...

  • way

...

  • of

...

  • knowing

...

  • when

...

  • the

...

  • conditions

...

  • for

...

  • the

...

  • restart

...

  • will

...

  • be

...

  • met.

...

  • On

...

  • a

...

  • busy

...

  • system,

...

  • the

...

  • restart

...

  • might

...

  • not

...

  • occur

...

  • until

...

  • well

...

  • after

...

  • you've

...

  • forgotten

...

  • you

...

  • requested

...

  • it.

...

  • The

...

  • best

...

  • practice

...

  • on

...

  • a

...

  • busy

...

  • system

...

  • is

...

  • to

...

  • execute

...

  • restarts

...

  • manually.

...

  • sip

...

  • show

...

  • peers

...

  • :

...

  • List

...

  • and

...

  • displays

...

  • the

...

  • status

...

  • of

...

  • all

...

  • peers

...

  • with

...

  • whom

...

  • you

...

  • are

...

  • registered

...

  • sip

...

  • reload

...

  • :

...

  • Reloads

...

  • the

...

  • SIP

...

  • channel

...

  • module.This

...

  • is

...

  • the

...

  • equivalent

...

  • of

...

  • performing

...

  • a

...

  • reload

...

  • chan_sip.so.

...

  • Reloading

...

  • the

...

  • SIP

...

  • channel

...

  • is

...

  • required

...

  • to

...

  • load

...

  • changes

...

  • to

...

  • sip.conf

...

  • and

...

  • sip_notify.conf

...

  • into

...

  • memory.

...

  • Active

...

  • SIP

...

  • channels

...

  • are

...

  • not

...

  • dropped

...

  • during

...

  • a

...

  • sip

...

  • reload.

...

  • stop

...

  • gracefully

...

  • :

...

  • Stops

...

  • the

...

  • system

...

  • when

...

  • all

...

  • currently

...

  • active

...

  • calls

...

  • have completed, and does not accept new calls.
  • stop now: Stops immediately, terminating all active calls.
  • stop when convenient: Stops the system when all currently active calls have completed.New calls are accepted, and the system will stop only when there are no longer any active calls.Using this command is not a good idea, since you have no real way of knowing when the necessary condition for stopping the system will occur.

Basic ASTERISK installation (1.4.1)

...

OS specific help

Validation, confirmation tests