
- •Table of Contents
- •Introduction
- •What This Book Covers
- •Conventions
- •Reader Feedback
- •Customer Support
- •Errata
- •Questions
- •What is Asterisk?
- •Asterisk is a PBX
- •Station-To-Station Calls
- •Line Trunking
- •Telco Features
- •Advanced Call Distribution
- •Call Detail Records
- •Call Recording
- •Asterisk is an IVR System
- •Asterisk is a Voicemail System
- •Asterisk is a Voice over IP (VoIP) System
- •What Asterisk Isn't
- •Asterisk is Not an Off-the-Shelf Phone System
- •Asterisk is Not a SIP Proxy
- •Asterisk Does Not Run on Windows
- •Is Asterisk a Good Fit for Me?
- •Trade-Offs
- •Flexibility versus Ease of Use
- •Graphical versus Configuration File Management
- •Calculating Total Cost of Ownership
- •Return on Investment
- •Summary
- •The Public Switched Telephony Network (PSTN)
- •Connection Methods
- •Plain Old Telephone Service (POTS) Line
- •Integrated Services Digital Network (ISDN)
- •Voice over IP Connections
- •Determining Our Needs
- •Terminal Equipment
- •Types of Terminal Devices
- •Hard Phones
- •Soft Phones
- •Communications Devices
- •Another PBX
- •Choosing a Device
- •Features, Features, and More Features…
- •Determining True Cost
- •Compatibility with Asterisk
- •Sound Quality Analysis
- •Usability Issues
- •Recording Decisions
- •How Much Hardware do I Need?
- •Choosing the Extension Length
- •Summary
- •Preparing to Install Asterisk
- •Obtaining the Source Files
- •Installing Zaptel
- •Installing libpri
- •Installing Asterisk
- •Getting to Know Asterisk
- •Summary
- •Zaptel Interfaces
- •zaptel.conf
- •Lines
- •Terminals
- •zapata.conf
- •Lines
- •Terminals
- •SIP Interfaces
- •IAX Interfaces
- •Voicemail
- •Music On Hold
- •Queues
- •Conference Rooms
- •Summary
- •Creating a Context
- •Creating an Extension
- •Creating Outgoing Extensions
- •Advanced Call Distribution
- •Call Queues
- •Call Parking
- •Direct Inward Dialing (DID)
- •Automated Attendants
- •System Services
- •Summary
- •Call Detail Records
- •Flat-File CDR Logging
- •Database CDR Logging
- •Monitoring Calls
- •Recording Calls
- •Legal Concerns
- •Summary
- •CentOS
- •Preparation and Installation
- •The Asterisk Management Portal (AMP)
- •Maintenance
- •Setup
- •Flash Operator Panel (FOP)
- •Flash Operator Configuration Files
- •Web MeetMe
- •Flexibility When Needed
- •A Simple One-to-One PBX
- •Extensions
- •Trunks
- •Routes
- •Customer Relationship Management/SugarCRM
- •Adding Contacts
- •Call Scheduling
- •Administration of SugarCRM
- •Configure Settings
- •User Management
- •User Roles
- •Summary
- •Small Office/Home Office
- •The Scenario
- •The Discussion
- •The Configuration
- •zaptel.conf
- •zapata.conf
- •musiconhold.conf
- •voicemail.conf
- •modules.conf
- •extensions.conf
- •Conclusions
- •Small Business
- •The Scenario
- •The Discussion
- •The Configuration
- •zaptel.conf
- •zapata.conf
- •musiconhold.conf
- •agents.conf
- •queues.conf
- •sip.conf
- •meetme.conf
- •voicemail.conf
- •extensions.conf
- •Conclusions
- •Hosted PBX
- •The Scenario
- •The Discussion
- •The Configuration
- •zaptel.conf
- •zapata.conf
- •musiconhold.conf
- •sip.conf
- •voicemail.conf
- •extensions.conf
- •Conclusions
- •Summary
- •Backup and System Maintenance
- •Backing Up Configurations
- •Backing Up Log Files
- •Backup Scripts
- •Time Synchronization
- •Adding It All to cron
- •Rebuilding and Restoring the Asterisk Server
- •Disaster Recovery Plan (DRP)
- •Asterisk Server Security
- •Internal Access Control
- •Host Security Hardening for Asterisk
- •Integrity Checker
- •Root-Kit Detection
- •Automated Hardening
- •Role Based Access Control (RBAC)
- •Network Security for Asterisk
- •Firewalling the Asterisk Protocols
- •SIP (Session Initiation Protocol)
- •RTP—The Real-Time Transport Protocol
- •Controlling Administration of Asterisk
- •Asterisk Scalability
- •Load Balancing with DNS
- •Support Channels for Asterisk
- •Mailing Lists
- •Forums
- •IRC (Internet Relay Chat)
- •Digium
- •Summary
- •Index

Chapter 8
As we can see, configuring voicemail is simple. The important thing to remember is that whatever we set the name to determines whether an extension will match an entry in the Directory. Also, the context in voicemail should always match the context in extensions.conf.
extensions.conf
[general]
static=yes
writeprotect=no
#include macros.incl #include incoming.incl #include outgoing.incl #include default.incl #include dialext.incl
[globals]
TRUNK=Zap/g1
TRUNKMSD=1
This is our entire extensions.conf file. By using the #include feature, we are able to make our configuration files much easier to read, and much easier to maintain. We should remember to keep the filenames easy to read and logical. Since each of these files is included into the extensions.conf file, they will not get separate sections in this chapter.
;macros.incl
;#included into extensions.conf [macro-stdexten]
;
;Standard extension macro:
;${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as
; |
well) |
|
|
|
|
; ${ARG2} - Device(s) to ring |
|
|
|
|
|
; |
|
|
|
|
|
exten => s,1,Dial(${ARG2},20) |
; |
Ring |
the interface, 20 seconds |
||
|
|
; |
maximum |
||
exten => s,2,Goto(s-${DIALSTATUS},1) ; |
Jump |
based on status |
|||
exten => s-NOANSWER,1,Voicemail(u${ARG1}) |
; |
If unavailable, send to |
|||
|
|
|
|
; |
voicemail |
exten => s-NOANSWER,2,Goto(default,0,1) |
|
; |
If they press #, go to |
||
|
|
|
|
; |
Operator |
exten => s-BUSY,1,Voicemail(b${ARG1}) |
|
; If |
busy, send to voicemail |
||
|
|
|
; |
with busy message |
|
exten => s-BUSY,2,Goto(default,0,1) |
|
; If |
they press #, go to |
||
|
|
|
; |
Operator |
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1}) exten => s-CHANUNAVAIL,2,Goto(default,0,1)
exten => s-.,1,Goto(s-NOANSWER,1)
;Treat anything else as no
;answer
125

Case Studies
exten => a,1,VoicemailMain(${ARG1}) ; |
If they press *, send to |
; |
VoicemailMain |
[macro-novm]
exten => s,1,Dial(${ARG1},30) ;ring the interface for 30 seconds exten => s,2,Goto(default,s,1)
exten => s,102,Goto(default,s,1)
Notice that we have a macro to set up all of the extensions we will be creating. This will save us a ton of work later on, as well as make our configuration files very readable.
;incoming.incl
;#included from extensions.conf [incoming]
exten => 5555551234,1,Goto(default,100,1) ;Main number rings to ; Operators
exten => 5555552345,1,Goto(default,110,1) ;Direct number to Support
exten => 5551110001,1,Goto(default,111,1) ;Direct line |
to |
|
; |
Extension |
111 |
exten => 5551110002,1,Goto(default,112,1) ;Direct line |
to |
|
; |
Extension |
112 |
exten => 5551110003,1,Goto(default,113,1) ;Direct line |
to |
|
; |
Extension |
113 |
. . . |
|
|
exten => s,1,Goto(default,100,1); |
|
|
exten => t,1,Goto(default,100,1); |
|
|
exten => i,1,Goto(default,100,1); |
|
|
Notice that we handle all incoming calls via this file. Here we define our DIDs and where we want them to ring. We also make sure to create intelligent rules in case the DID information is mangled by our phone company before Asterisk can decode it. In this case, we are sending the calls to our Operator.
; outgoing.incl
;#included from extensions.conf [local]
ignorepat => 9
exten => _9NXXXXXX,1,Goto(trunkdial,${EXTEN},1) exten => _91800XXXXXXX,1,Goto(trunkdial,${EXTEN},1) exten => _91866XXXXXXX,1,Goto(trunkdial,${EXTEN},1) exten => _91877XXXXXXX,1,Goto(trunkdial,${EXTEN},1) exten => _91888XXXXXXX,1,Goto(trunkdial,${EXTEN},1) include => default
[longdistance] ignorepad => 9
exten => _91NXXNXXXXXX,1,Goto(trunkdial,${EXTEN},1) include => local
[trunkdial]
exten => _9.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten => _9.,2,Congestion(5)
exten => _9.,3,Hangup
Notice what we have done here: we created a general context called trunkdial, which we use to dial any calls going over the trunk lines. Why is this helpful? If we were to add a new trunk group, we could add only one line. If we were to use the standard method of having each line above dial, we would have to add six lines for each new trunk group.
126

Chapter 8
This example assumes we will have no users placed directly in the trunkdial context, such as in the sip.conf file. For security reasons, we must be careful that we do not ever place a user explicitly in the trunkdial context.
;default.incl
;#included in extensions.conf [default]
exten => s,1,Goto(default,100,1) exten => t,1,Goto(default,100,1) exten => i,1,Goto(default,100,1)
; Operator queue, Operator Console, and Receptionist Phone
exten => |
100,1,Answer |
|
|
exten => |
100,2,Queue(Q100||||240) |
; only allow 4 minutes in queue |
|
exten => |
100,3,Voicemail(u100) |
; |
then send to VM |
exten => |
_10[12],1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Support |
Tier 1 |
|
|
exten => |
110,1,Answer |
|
|
exten => |
110,2,Queue(Q110||||240) |
; allow 4 minutes in queue |
|
exten => |
110,3,Goto(default,100,1) ; |
then send to Operator |
|
exten => |
_11[1-4],1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Support |
Tier 2 |
|
|
exten => |
120,1,Answer |
|
|
exten => |
120,2,Queue(Q120||||240) |
; allow 4 minutes in queue |
|
exten => |
120,3,Goto(default,100,1) ; |
then send to Operator |
|
exten => |
_12[12],1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Support |
Tier 3 |
|
|
exten => |
130,1,Answer |
|
|
exten => |
130,2,Queue(Q130||||240) |
; allow 4 minutes in queue |
|
exten => |
130,3,Goto(default,100,1) ; |
then send to Operator |
|
exten => |
131,1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Programmers, extensions 200-219 |
|
|
|
exten => |
_2[01]X,1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Testers, extensions 251-255 |
|
|
|
exten => |
_25[1-5],1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Project |
Managers, exts 301-304 |
|
|
exten => |
_30[1-4],1,Macro(stdexten,${EXTEN},SIP/${EXTEN}) |
||
;Shipping Department, ext 191, doesn't need voicemail |
|||
exten => |
191,1,Macro(novm,SIP/${EXTEN}) |
||
exten => |
800,1,Answer |
|
|
exten => |
800,2,VoicemailMain |
|
|
exten => |
_85X,1,Answer |
|
|
exten => |
_85X,2,MeetMe(${EXTEN}) |
|
|
exten => |
888,1,Goto(dialext,s,1) |
|
|
127