Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 604 trang
THÔNG TIN TÀI LIỆU
Cấu trúc
Table of Contents
Foreword
Preface
Audience
Organization
Software
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
Jim Van Meggelen
Leif Madsen
Jared Smith
Chapter 1. A Telephony Revolution
VoIP: Bridging the Gap Between Traditional and Network Telephony
The Zapata Telephony Project
Massive Change Requires Flexible Technology
Asterisk: The Hacker’s PBX
Asterisk: The Professional’s PBX
The Asterisk Community
The Asterisk Mailing Lists
The Asterisk Wiki
The IRC Channels
Asterisk User Groups
The Asterisk Documentation Project
The Business Case
This Book
Chapter 2. Preparing a System for Asterisk
Server Hardware Selection
Performance Issues
Choosing a Processor
Small systems
Medium systems
Large systems
Choosing a Motherboard
Power Supply Requirements
Computer power supplies
Redundant power supplies
Environment
Power Conditioning and Uninterruptible Power Supplies
Power-conditioned UPSes
Grounding
Electrical Circuits
The Equipment Room
Humidity
Temperature
Dust
Security
Telephony Hardware
Connecting to the PSTN
Analog interface cards
Digital interface cards
Channel banks
Other types of PSTN interfaces
Connecting Exclusively to a Packet-Based Telephone Network
Echo Cancellation
Types of Phones
Physical Telephones
Analog telephones
Proprietary digital telephones
ISDN telephones
IP telephones
Softphones
Telephony Adaptors
Communications Terminals
Linux Considerations
Conclusion
Chapter 3. Installing Asterisk
What Packages Do I Need?
Linux Package Requirements
Obtaining the Source Code
Obtaining Asterisk Source Code
Extracting the Source Code
Menuselect
Compiling Zaptel
The ztdummy Driver
The Zapata Telephony Drivers
Using ztcfg and zttool
Compiling libpri
Compiling Asterisk
Standard Installation
Alternative make Arguments
make clean
make distclean
make update
make webvmail
make progdocs
make config
Using Precompiled Binaries
Installing Additional Prompts
Common Compiling Issues
Asterisk
configure: error: no acceptable C compiler found in $PATH
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
configure: error: *** termcap support not found
Zaptel
make: cc: Command not found
FATAL: Module wctdm/fxs/fxo not found
Unresolved symbol link when loading ztdummy
Depmod errors during compilation
Loading Asterisk and Zaptel Quickly
Loading Zaptel Modules Without Scripts
Systems Running udevd
Loading Zaptel
Loading ztdummy
Loading libpri Without Script
Starting Asterisk Without Scripts
Console Commands
Directories Used by Asterisk
/etc/asterisk/
/usr/lib/asterisk/modules/
/var/lib/asterisk
/var/spool/asterisk/
/var/run/
/var/log/asterisk/
/var/log/asterisk/cdr-csv
AsteriskNOW™
What Is AsteriskNOW?
Before You Begin
What You Will Need
Installation
Quick installation
Extended procedure
Accessing the GUI
Alternate Installations
For More Information
Conclusion
Chapter 4. Initial Configuration of Asterisk
What Do I Really Need?
Working with Interface Configuration Files
Setting Up the Dialplan for Some Test Calls
FXO and FXS Channels
Determining the FXO and FXS Ports on Your TDM400P
Configuring an FXO Channel for a PSTN Connection
Zaptel Hardware Configuration
Zapata Hardware Configuration
Dialplan Configuration
Dialing In
Configuring an FXS Channel for an Analog Telephone
Zaptel Hardware Configuration
Zapata Hardware Configuration
Dialplan Configuration
Configuring SIP Telephones
Basic SIP Telephone Configuration in Asterisk
Defining the SIP device in Asterisk
Configuring the Device Itself
Essential Server Components
DHCP server
FTP server
CounterPath’s X-Lite Softphone
Polycom’s IP 430
DHCP server
Protocol to use for downloading
FTP
The Polycom configuration files
Cisco 7960 Telephone
Linksys SPA-942
Logging in to the phone
Registering your phone to Asterisk
Configuring the Dialplan for Testing
Connecting to a SIP Service Provider
Connecting Two Asterisk Boxes Together via SIP
Configuring Our Asterisk Boxes
SIP Phone Configuration
Configuring the Dialplan
Configuring an IAX Softphone
Configuring the Channel Configuration File (iax.conf)
Configure the Softphone
Configuring the Dialplan for Testing
Connecting to an IAX Service Provider
Connecting Two Asterisk Boxes Together via IAX
Configuring Our Asterisk Boxes
IAX Phone Configuration
Configuring the Dialplan
Using Templates in Your Configuration Files
Debugging
Connecting to the Console
Enabling Verbosity and Debugging
Conclusion
Chapter 5. Dialplan Basics
Dialplan Syntax
Contexts
Extensions
Priorities
Unnumbered priorities
Priority labels
Applications
A Simple Dialplan
The s Extension
The Answer(), Playback(), and Hangup() Applications
Our First Dialplan
Building an Interactive Dialplan
The Background(), WaitExten(), and Goto() Applications
Handling Invalid Entries and Timeouts
Using the Dial() Application
Adding a Context for Internal Calls
Using Variables
Global variables
Channel variables
Environment variables
Adding variables to our dialplan
Pattern Matching
Pattern-matching syntax
Pattern-matching examples
Using the ${EXTEN} channel variable
Enabling Outbound Dialing
Includes
Conclusion
Chapter 6. More Dialplan Concepts
Expressions and Variable Manipulation
Basic Expressions
Operators
Dialplan Functions
Syntax
Examples of Dialplan Functions
Conditional Branching
The GotoIf() Application
Time-Based Conditional Branching with GotoIfTime()
Voicemail
Creating Mailboxes
Adding Voicemail to the Dialplan
Accessing Voicemail
Creating a Dial-by-Name Directory
Macros
Defining Macros
Calling Macros from the Dialplan
Using Arguments in Macros
Using the Asterisk Database (AstDB)
Storing Data in the AstDB
Retrieving Data from the AstDB
Deleting Data from the AstDB
Using the AstDB in the Dialplan
Handy Asterisk Features
Zapateller()
Call Parking
Conferencing with MeetMe()
Conclusion
Chapter 7. Understanding Telephony
Analog Telephony
Parts of an Analog Telephone
Ringer
Dial pad
Hybrid (or network)
Tip and Ring
Digital Telephony
Pulse-Code Modulation
Digitally encoding an analog waveform
Increasing the sampling resolution and rate
Nyquist’s Theorem
Logarithmic companding
Aliasing
The Digital Circuit-Switched Telephone Network
Circuit Types
The humble DS-0―the foundation of it all
T-carrier circuits
SONET and OC circuits
Digital Signaling Protocols
Channel Associated Signaling (CAS)
ISDN
Signaling System 7
Packet-Switched Networks
Conclusion
Chapter 8. Protocols for VoIP
The Need for VoIP Protocols
VoIP Protocols
IAX (The “Inter-Asterisk eXchange” Protocol)
History
Future
Security considerations
IAX and NAT
SIP
History
Future
Security considerations
SIP and NAT
H.323
History
Future
Security considerations
H.323 and NAT
MGCP
Proprietary Protocols
Skinny/SCCP
UNISTIM
Codecs
G.711
G.726
G.729A
GSM
iLBC
Speex
MP3
Quality of Service
TCP, UDP, and SCTP
Transmission Control Protocol
User Datagram Protocol
Stream Control Transmission Protocol
Differentiated Service
Guaranteed Service
MPLS
RSVP
Best Effort
Echo
Why Echo Occurs
Managing Echo on Zaptel Channels
Hardware Echo Cancellation
Asterisk and VoIP
Users and Peers and Friends—Oh My!
Users
Peers
Friends
register Statements
VoIP Security
Spam over Internet Telephony (SPIT)
Encrypting Audio with Secure RTP
Spoofing
What Can Be Done?
Basic network security
Encryption
Physical security
Conclusion
Chapter 9. The Asterisk Gateway Interface (AGI)
Fundamentals of AGI Communication
What Are STDIN, STDOUT, and STDERR?
The Standard Pattern of AGI Communication
Calling an AGI Script from the Dialplan
Writing AGI Scripts in Perl
The Perl AGI Library
Creating AGI Scripts in PHP
The PHP AGI Library
Writing AGI Scripts in Python
The Python AGI Library
Debugging in AGI
Debugging from the Operating System
Using Asterisk’s agi debug Command
Conclusion
Chapter 10. Asterisk Manager Interface (AMI) and Adhearsion
The Manager Interface
Connecting to the Manager Interface
Sending Commands
Transferring a call
Reading a configuration file
Updating configuration files
The Flash Operator Panel
Asterisk Development with Adhearsion
A New Approach to Dialplans
Asterisk Development with Adhearsion
Installing Adhearsion
Installing Ruby/RubyGems on AsteriskNOW
Installing Ruby/RubyGems on Linux
Installing Ruby/RubyGems on Mac OS X
Ruby/RubyGems on Windows
Installing Adhearsion from RubyGems
Exploring a New Adhearsion Project
Adhearsion dialplan writing
Database integration
Distributing and reusing code
Integrate with Your Desk Phone Using Micromenus
Integrating with a Web Application
Using Java
More Information
Chapter 11. The Asterisk GUI Framework
Why a GUI for Asterisk?
What Is the GUI?
Mark Spencer Talks About the GUI
Using the GUI
GUI elements
Architecture of the Asterisk GUI
Components of the Asterisk GUI
Asterisk Manager Interface
Manager over HTTP and the Asterisk web server
AJAM and JavaScript
Installing the Asterisk GUI
Setting up httpd.conf and manager.conf
Developing for the Asterisk GUI
Issuing Manager Commands over HTTP
LOGIN
Transferring a call
Reading a configuration file
Updating configuration files using UPDATECONFIG
Error response
Ajax, AJAM, and Asterisk
Form processing in a traditional web application
Form processing in an Ajax application
The Prototype framework
Customization of the GUI
Adding a new tab to the GUI
Exposing configuration settings in the GUI
For More Information
Chapter 12. Relational Database Integration
Introduction
Installing the Database
Installing and Configuring ODBC
Configuring res_odbc for Access to Our Database
Using Realtime
Static Realtime
Dynamic Realtime
Storing Call Detail Records
Getting Funky with func_odbc: Hot-Desking
ODBC Voicemail
Creating the Large Object Type
Configuring voicemail.conf for ODBC Storage
Testing ODBC Voicemail
Conclusion
Chapter 13. Managing Your Asterisk System
Call Detail Recording
Managing Logs
Running Asterisk As a Non-root User
Customizing System Prompts
Music on Hold
Conclusion
Chapter 14. Potpourri
Festival
Getting Festival Set Up and Ready for Asterisk
Configuring Asterisk for Festival
Starting the Festival Server
Calling Festival from the Dialplan
Call Files
DUNDi
How Does DUNDi Work?
Configuring Asterisk for Use with DUNDi
The General Peering Agreement
General configuration
Creating mapping contexts
Defining DUNDi peers
Allowing remote connections
Configuring the dialplan
Alternative Voicemail Storage Methods
Storing Voicemail in an IMAP Server
Storing Voicemail in an ODBC Database
Asterisk and Jabber (XMPP)
Conclusion
Chapter 15. Asterisk: The Future of Telephony
The Problems with Traditional Telephony
Closed Thinking
Limited Standards Compliancy
Slow Release Cycles
Refusing to Let Go of the Past and Embrace the Future
Paradigm Shift
The Promise of Open Source Telephony
The Itch That Asterisk Scratches
Open Architecture
Standards Compliance
Lightning-Fast Response to New Technologies
Passionate Community
Some Things That Are Now Possible
Legacy PBX migration gateway
Low-barrier IVR
Conference rooms
Home automation
The Future of Asterisk
Speech Processing
Festival
Speech recognition
High-Fidelity Voice
Video
The challenge of video-conferencing
Why we love video-conferencing
Why video-conferencing may never totally replace voice
Wireless
Wi-Fi
Wi-MAX
Unified Messaging
Peering
E.164
ENUM
e164.org
DUNDi
Challenges
Too much change, too few standards
VoIP spam
Fear, uncertainty, and doubt
Bottleneck engineering
Regulatory wars
Quality of service
Complexity
Opportunities
Tailor-made private telecommunications networks
Low barrier to entry
Hosted solutions of similar complexity to corporate web sites
Proper integration of communications technologies
Appendix A. VoIP Channels
IAX
General IAX Settings
Registering to Other Servers with register Statements
IAX Channel Definitions
Channel-specific parameters
SIP
General SIP Parameters
SIP Channel Definitions
Appendix B. Application Reference
Appendix C. AGI Reference
Appendix D. Configuration Files
modules.conf
adsi.conf
adtranvofr.conf
agents.conf
alarmreceiver.conf
alsa.conf
amd.conf
asterisk.conf
cdr.conf
cdr_manager.conf
cdr_odbc.conf
cdr_pgsql.conf
cdr_tds.conf
codecs.conf
dnsmgr.conf
dundi.conf
enum.conf
extconfig.conf
extensions.conf
extensions.ael
features.conf
festival.conf
followme.conf
func_odbc.conf
gtalk.conf
http.conf
iax.conf
iaxprov.conf
indications.conf
jabber.conf
logger.conf
[general]
[logfiles]
manager.conf
meetme.conf
mgcp.conf
modem.conf
musiconhold.conf
osp.conf
oss.conf
phone.conf
privacy.conf
queues.conf
res_odbc.conf
res_snmp.conf
rpt.conf
rtp.conf
say.conf
sip.conf
sip_notify.conf
skinny.conf
sla.conf
smdi.conf
udptl.conf
users.conf
voicemail.conf
General Voicemail Settings
Voicemail Zones
Defining Voicemail Contexts and Mailboxes
vpb.conf
zapata.conf
zaptel.conf
Appendix E. Asterisk Dialplan Functions
Appendix F. Asterisk Manager Interface Actions
Appendix G. An Example of func_odbc
Index
Nội dung
[...]... lists.digium.com, these four are currently the most important: Asterisk- Biz Anything commercial with respect to Asterisk belongs in this list If you’re selling something Asterisk- related, sell it here If you want to buy an Asterisk service or product, post here Asterisk- Dev TheAsterisk developers hang out here The purpose of this list is the discussion of the development ofthe software that is Asterisk, ... odds with each other, in theAsterisk community they delight in each others’ skills The significance of this cooperation cannot be underestimated Still, if the dream ofAsterisk is to be realized, the community must grow—yet one ofthe key challenges that the community currently faces is a rapid influx of new users The members ofthe existing community, having birthed this thing called Asterisk, are... Mark Spencer of Digium, is keenly aware ofthe cultural significance of Asterisk, and is giddy about thefuture One ofthe more powerful side effects caused by the energy oftheAsterisk community is the cooperation it has spawned among the telecommunications professionals, networking professionals, and information technology professionals who share a love for this phenomenon While these professions have... subjects, just one of which is Asterisk Since Asterisk documentation forms by far the bulk of the information on this web site,‡ and it probably contains more Asterisk knowledge than all other sources put together (with the exception of the mailing-list archives), it is commonly referred to as the place to go for Asterisk knowledge TheAsterisk Community | 7 The IRC Channels TheAsterisk community... in “dead-tree” format —basically a book that a new user could pick up and learn the basics ofAsterisk About that same time, the number of new users on theAsterisk mailing lists and in the IRC channels grew tremendously, and we felt that writing an Asterisk book would greatly improve the signal-to-noise ratio TheAsterisk Documentation Project was born! The rest, they say, is history Since then, we’ve... many other open source projects, such as Linux and the Internet, the development ofAsterisk was fueled by the dreams of folks who knew that there had to be something more than what the industry was producing The strength of the community is that it is composed not of employees assigned to specific tasks, but rather of folks from all sorts of industries, with all sorts of experiences, and all sorts of. .. Documentation lowers the barrier to entry and helps people contemplate the possibilities Produced with the generous support of O’Reilly Media, Asterisk: The Futureof Telephony was inspired by the work started by theAsterisk Documentation Project We have come a long way, and this book is the realization of a desire to deliver documentation that introduces the most fundamental elements ofAsteriskthe things... product; Asterisk has scores Most proprietary PBXes have a worldwide support team comprised of a few dozen real experts; Asterisk has hundreds The depth and breadth ofthe expertise that surrounds this product is unmatched in the telecom industry Asterisk enjoys the loving attention of old Telco guys who # From the release ofAsterisk 1.2 to Asterisk 1.4, there have been over 4,000 updates to the code in the. .. irc.freenode.net The two most active channels are #asterisk and #asterisk- dev.§ To cut down on spam-bot intrusions, both of these channels now require registration to join.‖ Asterisk User Groups In many cites around the world, lonely Asterisk users began to realize that there were other like-minded people in their towns Asterisk User Groups (AUGs) began to spring up all over the place While these groups... revolution since before the crash; time will tell how well they respond to the open source revolution Asterisk: The Hacker’s PBX | 5 • End users are fed up with incompatible, limited functionality, and horrible support Asterisk solves the first two problems; entepreneurs and the community are addressing the latter TheAsterisk Community One ofthe compelling strengths ofAsterisk is the passionate community . information con-
tained herein.
TM
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN-10: 0-5 9 6-5 104 8-9
ISBN-13: 97 8-0 -5 9 6-5 104 8-0
[M]
This. Inc. Asterisk : The Future of Telephony, the image of starfish, and related trade dress
are trademarks of O’Reilly Media, Inc. Asterisk is a trademark of