Asterisk: The Future of Telephony, 2nd Edition

Book description

This bestselling book is now the standard guide to building phone systems with Asterisk, the open source IP PBX that has traditional telephony providers running scared! Revised for the 1.4 release of the software, the new edition of Asterisk: The Future of Telephony reveals how you can save money on equipment and support, and finally be in control of your telephone system.

If you've worked with telephony in the past, you're familiar with the problem: expensive and inflexible systems that are tuned to the vendor's needs, not yours. Asterisk isn't just a candle in the darkness, it's a whole fireworks show. Because Asterisk is so powerful, configuring it can seem tricky and difficult. This book steps you through the process of installing, configuring, and integrating Asterisk with your existing phone system.

You'll learn how to write dialplans, set up applications including speech synthesis and voice recognition, how to script Asterisk, and much more -- everything you need to design a simple but complete system with little or no Asterisk experience, and no more than rudimentary telecommunications knowledge. The book includes:

  • A new chapter on managing/administering your Asterisk system
  • A new chapter on using Asterisk with databases
  • Coverage of features in Asterisk 1.4
  • A new appendix on dialplan functions
  • A simplified installation chapter
  • New simplified SIP configuration, including examples for several popular SIP clients (soft phones and IP telephones)
  • Revised chapters and appendicies reviewed and updated for the latest in features, applications, trends and best-practices
Asterisk is revolutionizing the telecom industry, due in large part to the way it gets along with other network applications. While other PBXs are fighting their inevitable absorption into the network, Asterisk embraces it. If you need to take control of your telephony systems, move to Asterisk and see what the future of telecommunications looks like.

Publisher resources

View/Submit Errata

Table of contents

  1. Dedication
  2. Foreword
  3. Preface
    1. Audience
    2. Organization
    3. Software
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
      1. Jim Van Meggelen
      2. Leif Madsen
      3. Jared Smith
  4. 1. A Telephony Revolution
    1. VoIP: Bridging the Gap Between Traditional and Network Telephony
      1. 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
      1. The Asterisk Mailing Lists
      2. The Asterisk Wiki
      3. The IRC Channels
      4. Asterisk User Groups
      5. The Asterisk Documentation Project
    6. The Business Case
    7. This Book
  5. 2. Preparing a System for Asterisk
    1. Server Hardware Selection
      1. Performance Issues
      2. Choosing a Processor
        1. Small systems
        2. Medium systems
        3. Large systems
      3. Choosing a Motherboard
      4. Power Supply Requirements
        1. Computer power supplies
        2. Redundant power supplies
    2. Environment
      1. Power Conditioning and Uninterruptible Power Supplies
        1. Power-conditioned UPSes
      2. Grounding
      3. Electrical Circuits
      4. The Equipment Room
        1. Humidity
        2. Temperature
        3. Dust
        4. Security
    3. Telephony Hardware
      1. Connecting to the PSTN
        1. Analog interface cards
        2. Digital interface cards
        3. Channel banks
        4. Other types of PSTN interfaces
      2. Connecting Exclusively to a Packet-Based Telephone Network
      3. Echo Cancellation
    4. Types of Phones
      1. Physical Telephones
        1. Analog telephones
        2. Proprietary digital telephones
        3. ISDN telephones
        4. IP telephones
      2. Softphones
      3. Telephony Adaptors
      4. Communications Terminals
    5. Linux Considerations
    6. Conclusion
  6. 3. Installing Asterisk
    1. What Packages Do I Need?
      1. Linux Package Requirements
    2. Obtaining the Source Code
      1. Obtaining Asterisk Source Code
      2. Extracting the Source Code
    3. Menuselect
    4. Compiling Zaptel
      1. The ztdummy Driver
      2. The Zapata Telephony Drivers
      3. Using ztcfg and zttool
    5. Compiling libpri
    6. Compiling Asterisk
      1. Standard Installation
      2. Alternative make Arguments
        1. make clean
        2. make distclean
        3. make update
        4. make webvmail
        5. make progdocs
        6. make config
      3. Using Precompiled Binaries
    7. Installing Additional Prompts
    8. Common Compiling Issues
      1. Asterisk
        1. configure: error: no acceptable C compiler found in $PATH
        2. configure: error: C++ preprocessor “/lib/cpp” fails sanity check
        3. configure: error: *** termcap support not found
      2. Zaptel
        1. make: cc: Command not found
        2. FATAL: Module wctdm/fxs/fxo not found
        3. Unresolved symbol link when loading ztdummy
        4. Depmod errors during compilation
    9. Loading Asterisk and Zaptel Quickly
    10. Loading Zaptel Modules Without Scripts
      1. Systems Running udevd
      2. Loading Zaptel
      3. Loading ztdummy
    11. Loading libpri Without Script
    12. Starting Asterisk Without Scripts
      1. Console Commands
    13. Directories Used by Asterisk
      1. /etc/asterisk/
      2. /usr/lib/asterisk/modules/
      3. /var/lib/asterisk
      4. /var/spool/asterisk/
      5. /var/run/
      6. /var/log/asterisk/
      7. /var/log/asterisk/cdr-csv
    14. AsteriskNOW™
      1. What Is AsteriskNOW?
      2. Before You Begin
      3. What You Will Need
      4. Installation
        1. Quick installation
        2. Extended procedure
      5. Accessing the GUI
      6. Alternate Installations
      7. For More Information
    15. Conclusion
  7. 4. Initial Configuration of Asterisk
    1. What Do I Really Need?
    2. Working with Interface Configuration Files
    3. Setting Up the Dialplan for Some Test Calls
    4. FXO and FXS Channels
      1. Determining the FXO and FXS Ports on Your TDM400P
    5. Configuring an FXO Channel for a PSTN Connection
      1. Zaptel Hardware Configuration
      2. Zapata Hardware Configuration
      3. Dialplan Configuration
      4. Dialing In
    6. Configuring an FXS Channel for an Analog Telephone
      1. Zaptel Hardware Configuration
      2. Zapata Hardware Configuration
      3. Dialplan Configuration
    7. Configuring SIP Telephones
      1. Basic SIP Telephone Configuration in Asterisk
        1. Defining the SIP device in Asterisk
      2. Configuring the Device Itself
      3. Essential Server Components
        1. DHCP server
        2. FTP server
      4. CounterPath’s X-Lite Softphone
      5. Polycom’s IP 430
        1. DHCP server
        2. Protocol to use for downloading
        3. FTP
        4. The Polycom configuration files
          1. The bootROM
          2. The application image
          3. The sip.cfg file
          4. The master config file for each phone
          5. The set-specific config file
          6. Gotchas
      6. Cisco 7960 Telephone
      7. Linksys SPA-942
        1. Logging in to the phone
        2. Registering your phone to Asterisk
      8. Configuring the Dialplan for Testing
    8. Connecting to a SIP Service Provider
    9. Connecting Two Asterisk Boxes Together via SIP
      1. Configuring Our Asterisk Boxes
      2. SIP Phone Configuration
      3. Configuring the Dialplan
    10. Configuring an IAX Softphone
      1. Configuring the Channel Configuration File (iax.conf)
      2. Configure the Softphone
      3. Configuring the Dialplan for Testing
    11. Connecting to an IAX Service Provider
    12. Connecting Two Asterisk Boxes Together via IAX
      1. Configuring Our Asterisk Boxes
      2. IAX Phone Configuration
      3. Configuring the Dialplan
    13. Using Templates in Your Configuration Files
    14. Debugging
      1. Connecting to the Console
      2. Enabling Verbosity and Debugging
    15. Conclusion
  8. 5. Dialplan Basics
    1. Dialplan Syntax
      1. Contexts
      2. Extensions
      3. Priorities
        1. Unnumbered priorities
        2. Priority labels
      4. Applications
    2. A Simple Dialplan
      1. The s Extension
      2. The Answer(), Playback(), and Hangup() Applications
      3. Our First Dialplan
    3. Building an Interactive Dialplan
      1. The Background(), WaitExten(), and Goto() Applications
      2. Handling Invalid Entries and Timeouts
      3. Using the Dial() Application
      4. Adding a Context for Internal Calls
      5. Using Variables
        1. Global variables
        2. Channel variables
        3. Environment variables
        4. Adding variables to our dialplan
      6. Pattern Matching
        1. Pattern-matching syntax
        2. Pattern-matching examples
        3. Using the ${EXTEN} channel variable
      7. Enabling Outbound Dialing
      8. Includes
    4. Conclusion
  9. 6. More Dialplan Concepts
    1. Expressions and Variable Manipulation
      1. Basic Expressions
      2. Operators
    2. Dialplan Functions
      1. Syntax
      2. Examples of Dialplan Functions
    3. Conditional Branching
      1. The GotoIf() Application
      2. Time-Based Conditional Branching with GotoIfTime()
    4. Voicemail
      1. Creating Mailboxes
      2. Adding Voicemail to the Dialplan
      3. Accessing Voicemail
      4. Creating a Dial-by-Name Directory
    5. Macros
      1. Defining Macros
      2. Calling Macros from the Dialplan
      3. Using Arguments in Macros
    6. Using the Asterisk Database (AstDB)
      1. Storing Data in the AstDB
      2. Retrieving Data from the AstDB
      3. Deleting Data from the AstDB
      4. Using the AstDB in the Dialplan
    7. Handy Asterisk Features
      1. Zapateller()
      2. Call Parking
      3. Conferencing with MeetMe()
    8. Conclusion
  10. 7. Understanding Telephony
    1. Analog Telephony
      1. Parts of an Analog Telephone
        1. Ringer
        2. Dial pad
        3. Hybrid (or network)
          1. Hook switch (or switch hook)
          2. Handset
      2. Tip and Ring
    2. Digital Telephony
      1. Pulse-Code Modulation
        1. Digitally encoding an analog waveform
        2. Increasing the sampling resolution and rate
        3. Nyquist’s Theorem
        4. Logarithmic companding
        5. Aliasing
    3. The Digital Circuit-Switched Telephone Network
      1. Circuit Types
        1. The humble DS-0―the foundation of it all
        2. T-carrier circuits
        3. SONET and OC circuits
      2. Digital Signaling Protocols
        1. Channel Associated Signaling (CAS)
        2. ISDN
          1. ISDN-BRI/BRA
          2. ISDN-PRI/PRA
        3. Signaling System 7
    4. Packet-Switched Networks
    5. Conclusion
  11. 8. Protocols for VoIP
    1. The Need for VoIP Protocols
    2. VoIP Protocols
      1. IAX (The “Inter-Asterisk eXchange” Protocol)
        1. History
        2. Future
        3. Security considerations
        4. IAX and NAT
      2. SIP
        1. History
        2. Future
        3. Security considerations
        4. SIP and NAT
      3. H.323
        1. History
        2. Future
        3. Security considerations
        4. H.323 and NAT
      4. MGCP
      5. Proprietary Protocols
        1. Skinny/SCCP
        2. UNISTIM
    3. Codecs
      1. G.711
      2. G.726
      3. G.729A
      4. GSM
      5. iLBC
      6. Speex
      7. MP3
    4. Quality of Service
      1. TCP, UDP, and SCTP
        1. Transmission Control Protocol
        2. User Datagram Protocol
        3. Stream Control Transmission Protocol
      2. Differentiated Service
      3. Guaranteed Service
        1. MPLS
        2. RSVP
      4. Best Effort
    5. Echo
      1. Why Echo Occurs
      2. Managing Echo on Zaptel Channels
      3. Hardware Echo Cancellation
    6. Asterisk and VoIP
      1. Users and Peers and Friends—Oh My!
        1. Users
        2. Peers
        3. Friends
      2. register Statements
    7. VoIP Security
      1. Spam over Internet Telephony (SPIT)
      2. Encrypting Audio with Secure RTP
      3. Spoofing
      4. What Can Be Done?
        1. Basic network security
          1. Segregating voice and data traffic
          2. DMZ
          3. Server hardening
        2. Encryption
        3. Physical security
    8. Conclusion
  12. 9. The Asterisk Gateway Interface (AGI)
    1. Fundamentals of AGI Communication
      1. What Are STDIN, STDOUT, and STDERR?
      2. The Standard Pattern of AGI Communication
      3. Calling an AGI Script from the Dialplan
    2. Writing AGI Scripts in Perl
      1. The Perl AGI Library
    3. Creating AGI Scripts in PHP
      1. The PHP AGI Library
    4. Writing AGI Scripts in Python
      1. The Python AGI Library
    5. Debugging in AGI
      1. Debugging from the Operating System
      2. Using Asterisk’s agi debug Command
    6. Conclusion
  13. 10. Asterisk Manager Interface (AMI) and Adhearsion
    1. The Manager Interface
      1. Connecting to the Manager Interface
      2. Sending Commands
        1. Transferring a call
        2. Reading a configuration file
        3. Updating configuration files
    2. The Flash Operator Panel
    3. Asterisk Development with Adhearsion
      1. A New Approach to Dialplans
      2. Asterisk Development with Adhearsion
      3. Installing Adhearsion
        1. Installing Ruby/RubyGems on AsteriskNOW
        2. Installing Ruby/RubyGems on Linux
        3. Installing Ruby/RubyGems on Mac OS X
        4. Ruby/RubyGems on Windows
        5. Installing Adhearsion from RubyGems
      4. Exploring a New Adhearsion Project
        1. Adhearsion dialplan writing
        2. Database integration
        3. Distributing and reusing code
      5. Integrate with Your Desk Phone Using Micromenus
      6. Integrating with a Web Application
      7. Using Java
      8. More Information
  14. 11. The Asterisk GUI Framework
    1. Why a GUI for Asterisk?
    2. What Is the GUI?
      1. Mark Spencer Talks About the GUI
        1. Using the GUI
        2. GUI elements
    3. Architecture of the Asterisk GUI
      1. Components of the Asterisk GUI
        1. Asterisk Manager Interface
        2. Manager over HTTP and the Asterisk web server
        3. AJAM and JavaScript
    4. Installing the Asterisk GUI
      1. Setting up http.conf and manager.conf
    5. Developing for the Asterisk GUI
      1. Issuing Manager Commands over HTTP
        1. LOGIN
        2. Transferring a call
        3. Reading a configuration file
        4. Updating configuration files using UPDATECONFIG
        5. Error response
      2. Ajax, AJAM, and Asterisk
        1. Form processing in a traditional web application
        2. Form processing in an Ajax application
        3. The Prototype framework
      3. Customization of the GUI
        1. Adding a new tab to the GUI
        2. Exposing configuration settings in the GUI
      4. For More Information
  15. 12. Relational Database Integration
    1. Introduction
    2. Installing the Database
    3. Installing and Configuring ODBC
      1. Configuring res_odbc for Access to Our Database
    4. Using Realtime
      1. Static Realtime
      2. Dynamic Realtime
    5. Storing Call Detail Records
    6. Getting Funky with func_odbc: Hot-Desking
    7. ODBC Voicemail
      1. Creating the Large Object Type
      2. Configuring voicemail.conf for ODBC Storage
      3. Testing ODBC Voicemail
    8. Conclusion
  16. 13. Managing Your Asterisk System
    1. Call Detail Recording
    2. Managing Logs
    3. Running Asterisk As a Non-root User
    4. Customizing System Prompts
    5. Music on Hold
    6. Conclusion
  17. 14. Potpourri
    1. Festival
      1. Getting Festival Set Up and Ready for Asterisk
      2. Configuring Asterisk for Festival
      3. Starting the Festival Server
      4. Calling Festival from the Dialplan
    2. Call Files
    3. DUNDi
      1. How Does DUNDi Work?
      2. Configuring Asterisk for Use with DUNDi
        1. The General Peering Agreement
        2. General configuration
        3. Creating mapping contexts
        4. Defining DUNDi peers
        5. Allowing remote connections
        6. Configuring the dialplan
    4. Alternative Voicemail Storage Methods
      1. Storing Voicemail in an IMAP Server
      2. Storing Voicemail in an ODBC Database
    5. Asterisk and Jabber (XMPP)
    6. Conclusion
  18. 15. Asterisk: The Future of Telephony
    1. The Problems with Traditional Telephony
      1. Closed Thinking
      2. Limited Standards Compliancy
      3. Slow Release Cycles
      4. Refusing to Let Go of the Past and Embrace the Future
    2. Paradigm Shift
    3. The Promise of Open Source Telephony
      1. The Itch That Asterisk Scratches
      2. Open Architecture
      3. Standards Compliance
      4. Lightning-Fast Response to New Technologies
      5. Passionate Community
      6. Some Things That Are Now Possible
        1. Legacy PBX migration gateway
        2. Low-barrier IVR
        3. Conference rooms
        4. Home automation
    4. The Future of Asterisk
      1. Speech Processing
        1. Festival
        2. Speech recognition
      2. High-Fidelity Voice
      3. Video
        1. The challenge of video-conferencing
        2. Why we love video-conferencing
        3. Why video-conferencing may never totally replace voice
      4. Wireless
        1. Wi-Fi
        2. Wi-MAX
      5. Unified Messaging
      6. Peering
        1. E.164
        2. ENUM
        3. e164.org
        4. DUNDi
      7. Challenges
        1. Too much change, too few standards
        2. VoIP spam
        3. Fear, uncertainty, and doubt
        4. Bottleneck engineering
        5. Regulatory wars
        6. Quality of service
        7. Complexity
      8. Opportunities
        1. Tailor-made private telecommunications networks
        2. Low barrier to entry
        3. Hosted solutions of similar complexity to corporate web sites
        4. Proper integration of communications technologies
  19. A. VoIP Channels
    1. IAX
      1. General IAX Settings
      2. Registering to Other Servers with register Statements
      3. IAX Channel Definitions
        1. Channel-specific parameters
    2. SIP
      1. General SIP Parameters
      2. SIP Channel Definitions
  20. B. Application Reference
    1. AddQueueMember() — Dynamically adds queue members to the specified call queue
    2. ADSIProg() — Loads an ADSI script into an ADSI-capable phone
    3. AgentCallbackLogin() — Enables agent login with callback
    4. AgentLogin() — Allows a call agent to log in to the system
    5. AgentMonitorOutgoing() — Records an agent’s outgoing calls
    6. AGI() — Executes an AGI-compliant application
    7. AlarmReceiver() — Provides support for receiving alarm reports from a burglar or fire alarm panel
    8. AMD() — Answering machine detection
    9. Answer() — Answers a channel, if it is ringing
    10. AppendCDRUserField() — Appends a value to the user field of the Call Detail Record
    11. Authenticate() — Requires that the caller enter a correct password before continuing
    12. Background() — Plays a file while accepting touch-tone (DTMF) digits
    13. BackgroundDetect() — Plays a file in the background and detects talking
    14. Busy() — Indicates a busy condition to the channel
    15. ChangeMonitor() — Changes the monitoring filename of a channel
    16. ChanIsAvail() — Finds out if a specified channel is currently available
    17. ChannelRedirect() — Redirects a channel to a new location in the dialplan
    18. ChanSpy() — Listens to the audio on a channel, and optionally whisper to the calling channel
    19. Congestion() — Indicates congestion on the channel
    20. ContinueWhile() — Restart a While() loop
    21. ControlPlayback() — Plays a file, with the ability to fast forward and rewind the file
    22. DateTime() — Says the date and/or time in the user-specified format
    23. DBdel() — Deletes a key from the AstDB
    24. DBdeltree() — Deletes a family or key tree from the AstDB
    25. DeadAGI() — Executes an AGI-compliant script on a dead (hung-up) channel
    26. Dial() — Attempts to connect channels
    27. Dictate() — Virtual dictation machine
    28. Directory() — Provides a dialable directory of extensions
    29. DISA() — Direct Inward System Access: allows inbound callers to make outbound calls
    30. DumpChan() — Dumps information about the calling channel to the console
    31. EAGI()
    32. Echo() — Echoes inbound audio back to the caller
    33. EndWhile() — Ends a while loop
    34. Exec() — Executes an Asterisk application dynamically
    35. ExecIf() — Conditionally executes an Asterisk application
    36. ExitWhile() — Exit from a While() loop, whether or not the conditional has been satisfied
    37. ExtenSpy() — Listen to the audio on an extension, and optionally whisper to the calling channel
    38. ExternalIVR() — Interfaces with an external IVR application
    39. FastAGI() — Executes an AGI-compliant script across a network connection
    40. Festival() — Uses the Festival text-to-speech engine to read text to the caller
    41. Flash() — Flashes a Zap trunk
    42. FollowMe() — Find me/follow me functionality
    43. ForkCDR() — Creates an additional CDR from the current call
    44. GetCPEID() — Gets the CPE ID from an ADSI-capable telephone
    45. Gosub() — Branches to a new location, saving the return address
    46. GosubIf() — Conditionally branches to a new location, saving the return address
    47. Goto() — Sends the call to the specified priority, extension, and context
    48. GotoIf() — Conditionally goes to the specified priority
    49. GotoIfTime() — Conditionally branches, depending on the time and day
    50. Hangup() — Unconditionally hangs up the current channel
    51. HasNewVoicemail() — Checks to see if there is new voicemail in the indicated voicemail box
    52. HasVoicemail() — Indicates whether there is voicemail in the indicated voicemail box
    53. IAX2Provision() — Provisions a calling IAXy device
    54. ICES() — Streams audio to an Icecast server
    55. ImportVar() — Sets a variable based on a channel variable from a different channel
    56. Log() — Logs a custom message from the dialplan
    57. LookupBlacklist() — Performs a lookup of a Caller ID name/number from the blacklist database
    58. LookupCIDName() — Performs a lookup of a Caller ID name from the AstDB
    59. Macro() — Calls a previously defined dialplan macro
    60. MacroExclusive() — Runs a macro, exclusive of any other channel
    61. MacroExit() — Explicitly returns from a macro
    62. MacroIf() — Conditionally calls a previously defined macro
    63. MailboxExists() — Conditionally branches if the specified voicemail box exists
    64. MeetMe() — Puts the caller in to a MeetMe conference bridge
    65. MeetMeAdmin() — Performs MeetMe conference administration
    66. MeetMeCount() — Counts the number of participants in a MeetMe conference
    67. Milliwatt() — Generates a 1,000 Hz tone
    68. MixMonitor() — Records a channel in the background, mixing both directions synchronously
    69. Monitor() — Monitors (records) the audio on the current channel
    70. MorseCode() — Plays Morse code
    71. MP3Player() — Plays an MP3 file or stream
    72. MusicOnHold() — Plays music on hold indefinitely
    73. NBScat() — Plays an NBS local stream
    74. NoCDR() — Disables Call Detail Records for the current call
    75. NoOp() — Does nothing
    76. Page() — Opens one-way audio to multiple phones
    77. Park() — Parks the current call
    78. ParkAndAnnounce() — Parks the current call and announces the call over the specified channel
    79. ParkedCall() — Answers a parked call
    80. PauseMonitor() — Suspends monitoring of a channel
    81. PauseQueueMember() — Temporarily blocks a queue member from receiving calls
    82. Pickup() — Answers a ringing call from another phone
    83. Playback() — Plays the specified audio file to the caller
    84. Playtones() — Plays a tone list
    85. PrivacyManager() — Requires a caller to enter his phone number, if no Caller ID information is received
    86. Progress() — Indicates progress
    87. Queue() — Places the current call in to the specified call queue
    88. QueueLog() — Writes arbitrary queue events to the queue log
    89. Random() — Conditionally branches, based upon a probability
    90. Read() — Reads DTMF digits from the caller and assigns the result to a variable
    91. ReadFile() — Reads the contents of a file in to a variable
    92. RealTime — Looks up information from the RealTime configuration handler
    93. RealTimeUpdate() — Updates a value via the RealTime configuration handler
    94. Record() — Records channel audio to a file
    95. RemoveQueueMember() — Dynamically removes queue members
    96. ResetCDR() — Resets the Call Detail Record
    97. RetryDial() — Attempts to place a call, and retries on failure
    98. Return() — Returns from a Gosub() or GosubIf()
    99. Ringing() — Indicates ringing tone
    100. SayAlpha() — Spells a string
    101. SayDigits() — Says the specified digits
    102. SayNumber() — Says the specified number
    103. SayPhonetic() — Spells the specified string phonetically
    104. SayUnixTime() — Says the specified time in a custom format
    105. SendDTMF() — Sends arbitrary DTMF digits to the channel
    106. SendImage() — Sends an image file
    107. SendText() — Sends text to the channel
    108. SendURL() — Sends the specified URL to the channel (if supported)
    109. Set() — Sets a variable to the specified value
    110. SetAMAFlags() — Sets AMA flags in the Call Detail Record
    111. SetCallerID() — Sets the Caller ID for the channel
    112. SetCallerPres() — Sets Caller ID presentation flags
    113. SetCDRUserField() — Sets the Call Detail Record user field
    114. SetGlobalVar() — Sets a global variable to the specified value
    115. SetMusicOnHold() — Sets the default music-on-hold class for the current channel
    116. SetTransferCapability() — Sets the ISDN transfer capability of a channel
    117. SIPAddHeader() — Adds a SIP header to the outbound call
    118. SIPDtmfMode() — Changes the DTMF method for a SIP call
    119. SLAStation() — Shared line appearance station
    120. SLATrunk() — Shared line appearance trunk
    121. SoftHangup() — Performs a soft hangup of the requested channel
    122. StackPop() — Removes last address from Gosub() stack
    123. StartMusicOnHold() — Starts music on hold
    124. StopMixMonitor() — Stops monitoring a channel
    125. StopMonitor() — Stops monitoring a channel
    126. StopPlaytones() — Stops playing a tone list
    127. StopMusicOnHold() — Stops music on hold
    128. System() — Executes an operating system command
    129. Transfer() — Transfers the caller to a remote extension
    130. TryExec() — Tries to execute an Asterisk application
    131. TrySystem() — Tries to execute an operating system command
    132. UnpauseMonitor() — Resumes monitoring of a channel
    133. UnpauseQueueMember() — Unpauses a queue member
    134. UserEvent() — Sends an arbitrary event to the Manager Interface
    135. Verbose() — Sends arbitrary text to verbose output
    136. VMAuthenticate() — Authenticates the caller from voicemail passwords
    137. VoiceMail() — Leaves a voicemail message in the specified mailbox
    138. VoiceMailMain() — Enters the voicemail system
    139. Wait() — Waits for a specified number of seconds
    140. WaitExten() — Waits for an extension to be entered
    141. WaitForRing() — Waits the specified number of seconds for a ring
    142. WaitForSilence() — Waits for a specified amount of silence
    143. WaitMusicOnHold() — Waits the specified number of seconds, playing music on hold
    144. While() — Starts a while loop
    145. Zapateller() — Uses a special information tone to block telemarketers
    146. ZapBarge() — Barges in on (monitors) a Zap channel
    147. ZapRAS() — Executes the Zaptel ISDN Remote Access Server
    148. ZapScan() — Scans Zap channels to monitor calls
  21. C. AGI Reference
    1. ANSWER
    2. CHANNEL STATUS
    3. DATABASE DEL
    4. DATABASE DELTREE
    5. DATABASE GET
    6. DATABASE PUT
    7. EXEC
    8. GET DATA
    9. GET FULL VARIABLE
    10. GET OPTION
    11. GET VARIABLE
    12. HANGUP
    13. NoOp
    14. RECEIVE CHAR
    15. RECORD FILE
    16. SAY ALPHA
    17. SAY DATE
    18. SAY DATETIME
    19. SAY DIGITS
    20. SAY NUMBER
    21. SAY PHONETIC
    22. SAY TIME
    23. SEND IMAGE
    24. SEND TEXT
    25. SET AUTOHANGUP
    26. SET CALLERID
    27. SET CONTEXT
    28. SET EXTENSION
    29. SET MUSIC ON
    30. SET PRIORITY
    31. SET VARIABLE
    32. STREAM FILE
    33. TDD MODE
    34. VERBOSE
    35. WAIT FOR DIGIT
  22. D. Configuration Files
    1. modules.conf
    2. adsi.conf
    3. adtranvofr.conf
    4. agents.conf
    5. alarmreceiver.conf
    6. alsa.conf
    7. amd.conf
    8. asterisk.conf
    9. cdr.conf
    10. cdr_manager.conf
    11. cdr_odbc.conf
    12. cdr_pgsql.conf
    13. cdr_tds.conf
    14. codecs.conf
    15. dnsmgr.conf
    16. dundi.conf
    17. enum.conf
    18. extconfig.conf
    19. extensions.conf
    20. extensions.ael
    21. features.conf
    22. festival.conf
    23. followme.conf
    24. func_odbc.conf
    25. gtalk.conf
    26. http.conf
    27. iax.conf
    28. iaxprov.conf
    29. indications.conf
    30. jabber.conf
    31. logger.conf
      1. [general]
      2. [logfiles]
    32. manager.conf
    33. meetme.conf
    34. mgcp.conf
    35. modem.conf
    36. musiconhold.conf
    37. osp.conf
    38. oss.conf
    39. phone.conf
    40. privacy.conf
    41. queues.conf
    42. res_odbc.conf
    43. res_snmp.conf
    44. rpt.conf
    45. rtp.conf
    46. say.conf
    47. sip.conf
    48. sip_notify.conf
    49. skinny.conf
    50. sla.conf
    51. smdi.conf
    52. udptl.conf
    53. users.conf
    54. voicemail.conf
      1. General Voicemail Settings
      2. Voicemail Zones
      3. Defining Voicemail Contexts and Mailboxes
    55. vpb.conf
    56. zapata.conf
    57. zaptel.conf
  23. E. Asterisk Dialplan Functions
    1. AGENT — Returns information about an agent
    2. ARRAY — Allows one to define several variables at one time
    3. BASE64_DECODE — Decodes a BASE64 encoded string
    4. BASE64_ENCODE — Encodes a string in BASE64
    5. BLACKLIST — Checks if the Caller ID is on the blacklist
    6. CALLERID — Gets or sets Caller ID data on the channel
    7. CDR — Gets or sets CDR information for this call (which will be written to the CDR log)
    8. CHANNEL — Gets or sets various channel parameters
    9. CHECK_MD5 — Validate an MD5 digest
    10. CHECKSIPDOMAIN — Checks if a domain is local
    11. CURL — Returns the data resulting from a GET or POST to a URI
    12. CUT — Cuts a string based on a given delimiter
    13. DB — Read or write to AstDB
    14. DB_DELETE — Deletes a key or key family from the AstDB database
    15. DB_EXISTS — Checks AstDB for specified key
    16. DUNDILOOKUP — Queries DUNDi peers for a particular number
    17. ENUMLOOKUP — Queries the ENUM database for a particular number
    18. ENV — References environment variables
    19. EVAL — Evaluates stored variables
    20. EXISTS — Checks if value is non-blank
    21. FIELDQTY — Counts fields
    22. FILTER — Strips string of illegal characters
    23. GLOBAL — References global namespace
    24. GROUP — Associates the channel into a set group
    25. GROUP_COUNT — Counts the number of channels in the specified group.
    26. GROUP_LIST — Lists channel groups
    27. GROUP_MATCH_COUNT — Counts channels in a matching group name
    28. IAXPEER — Obtains IAX channel information
    29. IF — Conditional value selection
    30. IFTIME — Compares the current system time to a time specification
    31. ISNULL — Checks if a value is blank
    32. KEYPADHASH — Converts letters into numbers
    33. LANGUAGE — Accesses the channel language
    34. LEN — Calculates the string length
    35. MATH — Mathematical calculations
    36. MD5 — Calculates MD5 digest
    37. MUSICCLASS — Access a channel’s music-on-hold setting
    38. QUEUE_MEMBER_COUNT — Counts queue members
    39. QUEUE_MEMBER_LIST — Lists queue members
    40. QUEUE_WAITING_COUNT — Count waiting calls
    41. QUEUEAGENTCOUNT
    42. QUOTE — Escapes a string
    43. RAND — Random number
    44. REALTIME — Retrieves real-time data
    45. REGEX — Compares based upon a regular expression
    46. SET — Sets a variable
    47. SHA1 — SHA-1 digest
    48. SIP_HEADER — Retrieves a SIP header
    49. SIPCHANINFO — Retrieves info on a SIP channel
    50. SIPPEER — Retrieves info about a SIP peer
    51. SORT — Sorts a list
    52. SPEECH — Retrieves info on speech recognition results
    53. SPEECH_ENGINE — Modifies speech engine property
    54. SPEECH_GRAMMAR — Retrieves speech grammar information
    55. SPEECH_SCORE — Retrieves speech recognition confidence score
    56. SPEECH_TEXT — Retrieves recognized text
    57. SPRINTF — Formats a string
    58. STAT — Evaluates filesystem attributes
    59. STRFTIME — Formats the date and time
    60. STRPTIME — Converts a string into a date and time
    61. TIMEOUT — Accesses channel timeout values
    62. TXTCIDNAME — DNS lookup
    63. URIDECODE — Decodes a URI
    64. URIENCODE — Encodes a URI
    65. VMCOUNT — Counts voicemail messages
  24. F. Asterisk Manager Interface Actions
    1. AbsoluteTimeout — Sets the sAbsoluteTimeout on a channel
    2. AgentCallbackLogin — Sets an agent as logged in to the queue system in callback mode
    3. AgentLogoff — Sets an agent as no longer logged in
    4. Agents — Lists agents and their status
    5. ChangeMonitor — Changes monitoring filename of a channel
    6. Command — Executes an Asterisk CLI command
    7. DBGet — Gets AstDB entry
    8. DBPut — Puts DB entry
    9. Events — Controls event flow
    10. ExtensionState — Checks extension status
    11. GetConfig — Retrieves configuration
    12. GetVar — Retrieves the value of a variable
    13. Hangup — Hangs up channel
    14. IAXNetstats — Shows IAX statistics
    15. IAXPeers — Lists IAX peers
    16. ListCommands — Lists the manager commands
    17. Logoff — Logs off manager session
    18. MailboxCount — Checks mailbox message count
    19. MailboxStatus — Checks mailbox status
    20. MeetmeMute — Mutes a MeetMe user
    21. MeetMeUnmute — Unmutes a MeetMe user
    22. Monitor — Monitors a channel
    23. Originate — Originates call
    24. Park — Parks a channel
    25. ParkedCalls — Lists parked calls
    26. PauseMonitor — Pauses the recording of a channel
    27. Ping — Keeps connection alive
    28. PlayDTMF — Plays DTMF on a channel
    29. QueueAdd — Adds a member to the specified queue
    30. QueuePause — Pauses or unpauses a member in a call queue
    31. QueueRemove — Removes interface from queue
    32. QueueStatus — Checks queue status
    33. Queues — Shows basic queue information
    34. Redirect — Redirects (transfers) a channel
    35. SIPpeers — Lists all SIP peers
    36. SIPShowPeer — Shows information about a SIP peer
    37. SetCDRUserField — Sets the CDR UserField
    38. SetVar — Sets channel variable
    39. Status — Lists channel status
    40. StopMonitor — Stops the recording of a channel
    41. UnpauseMonitor — Unpauses monitoring
    42. UpdateConfig — Updates a config file
    43. UserEvent — Sends an arbitrary event
    44. WaitEvent — Waits for an event to occur
    45. ZapDNDoff — Sets a Zap channel’s do not disturb status to off
    46. ZapDNDon — Sets a Zap channel’s do not disturb status to on
    47. ZapDialOffhook — Dials over Zap channel while off-hook
    48. ZapHangup — Hangs up Zap channel
    49. ZapRestart — Fully restarts Zaptel channels
    50. ZapShowChannels — Shows status Zapata channels
    51. ZapTransfer — Transfers Zap channel
  25. G. An Example of func_odbc
    1. Hot-Desking (extensions.conf) — Dialplan code
    2. Hot-Desking (func_odbc.conf) — Custom dialplan functions
    3. Hot-Desking (sip.conf) — Two sample phone configurations and sample service provider configuration
  26. Index
  27. About the Authors
  28. Colophon
  29. Copyright

Product information

  • Title: Asterisk: The Future of Telephony, 2nd Edition
  • Author(s): Jim Van Meggelen, Jared Smith, Leif Madsen
  • Release date: August 2007
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596510480