- •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
Maintenance and Security
We could also restart the Asterisk service nightly in order to resolve any hung channels; this may not be possible if the system sees high usage during the night, but is useful in situations where we have channels hanging often.
Finally, asterisk_restart.cron:
#!/bin/bash /etc/init.d/asterisk stop /etc/init.d/zaptel restart /etc/init.d/asterisk start
Time Synchronization
As our Asterisk system retains logs of calls and also makes routing decisions based on time, it is important to have the system clock synchronized. We can do this with Network Time Protocol (NTP). This is very easy to use. Just install the ntpdate program, which you will most likely find in your distribution's package management system (yum, urpmi, apt, or whatever). Then run the script shown below. If we have a local time server (for instance if we have other time-dependent services such as Kerberos authentication installed), we should use that.
The timesync.cron NTP script:
#!/bin/bash
ntpdate pool.ntp.org # replace pool.ntp.org with local time server /sbin/hwclock –-systohc # sync the hardware clock
Adding It All to cron
The four files we have created can be added to our crontab to ensure they are run periodically. We can do this by first running:
$ crontab –e
Then creating the following entries (replacing /path/to with the location of our scripts):
30 |
01 |
* * * |
|
/path/to/backup.cron |
|
59 |
23 |
* * |
* |
|
/path/to/monitor_mix.cron |
00 |
01 |
* * |
* |
|
/path/to/asterisk_restart.cron |
00,15,30,45 |
* * * * |
/path/to/timesync.cron |
This ensures that our backup.cron, monitor_mix.cron, and asterisk_restart.cron scripts are run nightly and that our time is synchronized every 15 minutes.
As we are running these commands non-interactively, i.e. we are using scp in batch mode, we must ensure that the scp command can authenticate with the backup server. To do this we should use SSH keys instead of passwords for authentication by running the following commands:
$ ssh-keygen -t dsa ; accept all defaults by pressing enter at each
;prompt
$ ssh username@backupserver 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_dsa.pub ; enter password when prompted
142