asterisk_the_definitive_guide_3rd_edition.pdf

(4750 KB) Pobierz
782108393.002.png
Asterisk™: The Definitive Guide, Third Edition
by Leif Madsen, Jim Van Meggelen, and Russell Bryant
Copyright © 2011 Leif Madsen, Jim Van Meggelen, and Russell Bryant. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles ( http://my.safaribooksonline.com ). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com .
Editor: Mike Loukides
Production Editor: Teresa Elsey
Copyeditor: Rachel Head
Proofreader: Andrea Fox
Production Services: Molly Sharp
Indexer: Fred Brown
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
Printing History:
June 2005:
First Edition.
August 2007:
Second Edition.
April 2011:
Third Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Asterisk: The Definitive Guide , the images of starfish, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-0-596-51734-2
[LSI]
1302181785
Table of Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
1.
A Telephony Revolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Asterisk and VoIP: Bridging the Gap Between Traditional and Network
Telephony
2
The Zapata Telephony Project
2
Massive Change Requires Flexible Technology
3
Asterisk: The Hacker’s PBX
4
Asterisk: The Professional’s PBX
5
The Asterisk Community
5
The Asterisk Mailing Lists
6
Asterisk Wiki Sites
7
The IRC Channels
7
Asterisk User Groups
7
The Asterisk Documentation Project
8
The Business Case
8
Conclusion
8
2.
Asterisk Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Modules
10
Applications
12
Bridging Modules
15
Call Detail Recording Modules
15
Channel Event Logging Modules
16
Channel Drivers
17
Codec Translators
18
Format Interpreters
18
Dialplan Functions
19
PBX Modules
21
v
782108393.003.png 782108393.004.png
Resource Modules
21
Addon Modules
23
Test Modules
24
File Structure
24
Configuration Files
24
Modules
24
The Resource Library
25
The Spool
25
Logging
25
The Dialplan
25
Hardware
26
Asterisk Versioning
26
Previous Release Methodologies
26
The New Release Methodology
27
Conclusion
28
3.
Installing Asterisk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Installation Cheat Sheet
31
Distribution Installation
35
CentOS Server
35
Ubuntu Server
40
Software Dependencies
44
Downloading What You Need
46
Getting the Source via Subversion
47
Getting the Source via wget
47
How to Install It
48
LibPRI
48
DAHDI
49
Asterisk
50
Setting File Permissions
50
Base Configuration
51
Disable SELinux
51
Initial Configuration
52
make menuselect
59
Updating Asterisk
64
Common Issues
66
Upgrading Asterisk
68
Conclusion
69
4.
Initial Configuration Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
asterisk.conf
71
The [directories] Section
71
The [options] Section
72
vi
|
Table of Contents
782108393.005.png
The [files] Section
75
The [compat] Section
75
modules.conf
75
The [modules] Section
76
indications.conf
77
musiconhold.conf
79
Converting Music to a Format That Works Best with Asterisk
79
Conclusion
81
5.
User Device Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Telephone Naming Concepts
84
Hardphones, Softphones, and ATAs
86
Configuring Asterisk
87
How Channel Configuration Files Work with the Dialplan
88
sip.conf
89
iax.conf
95
Modifying Your Channel Configuration Files for Your Environment
98
Loading Your New Channel Configurations
98
The Asterisk CLI
99
Testing to Ensure Your Devices Have Registered
99
Analog Phones
100
A Basic Dialplan to Test Your Devices
103
Under the Hood: Your First Call
104
Conclusion
105
6.
Dialplan Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Dialplan Syntax
107
Contexts
108
Extensions
110
Priorities
111
Applications
113
The Answer(), Playback(), and Hangup() Applications
113
A Simple Dialplan
115
Hello World
115
Building an Interactive Dialplan
116
The Goto(), Background(), and WaitExten() Applications
116
Handling Invalid Entries and Timeouts
119
Using the Dial() Application
119
Using Variables
122
Pattern Matching
125
Includes
129
Conclusion
130
Table of Contents
|
vii
782108393.001.png
Zgłoś jeśli naruszono regulamin