1. Installation and "Hello World"
1.1. Introduction
1.2. A simple PBX system
Objectives
Requirements
Which Asterisk version?
Which Linux distribution is best for Asterisk?
Configure the Asterisk server
An answering machine
What did we just do?
Calling the public telephone network
Taking calls from the public telephone network
2. Dialplan Basics
2.1. Context
Syntax
2.2. Extension
Syntax
Fundamental Applications
Priority
2.3. Pattern Matching
Syntax
Testing a pattern using dialplan show
Pattern matching order
2.4. Include statements
Syntax
Example
Order of execution when using include statements
Time-conditional include statements
3. Programming in the dialplan
3.1. Programming "How-to"
Program structure
Variables
Labels and Goto()
While() loops
GotoIf() conditional
Gosub() subroutines
3.2. Variables
Expanding variables in an extension
General considerations
Defining global variables in extensions.conf
Defining variables with Set()
Inheritance of channel variables
System channel variables
Manipulating variables
3.3. Special extensions
The h extension
The i extension
The o and a extensions
The t and T extensions
The s extension
3.4. Macros
Macro basics
3.5. Priority jumping is deprecated
4. Voicemail
4.1. Introduction
4.2. Example implementations
The Robinson Family
Widgets, Inc.
4.3. Dialplan applications
VoiceMail()
VoiceMailMain()
4.4. voicemail.conf
[general]
[zonemessages]
Defined contexts
Mailboxesd
4.5. Directory (Dial-by-Name)
Syntax
Operation
4.6. Saving passwords in voicemail.conf
5. Interactive Voice Response (IVR)
5.1. A simple IVR
Differences between Playback() and Background()
Difference between 10 and 1000
Invalid input (the i extension)
Pauses
5.2. Multilevel IVR systems
IVR depth
5.3. Text-to-Speech (TTS)
Installating Cepstral Text-to-Speech
Examples and tests
Pauses in text
6. Queues
6.1. Extension for testing hold music
6.2. musiconhold.conf
6.3. queues.conf
musiconhold
announce
strategy
servicelevel
context
timeout
retry
weight
wrapuptime
maxlen
announce-frequency
announce-holdtime
announce-round-seconds
Announcement sound files
periodic-announce-frequency
monitor-format
monitor-join
joinempty
leavewhenempty
eventwhencalled
eventmemberstatus
reportholdtime
memberdelay
timeoutrestart
autopause
ringinuse
member
6.4. agents.conf
autologoff
ackcall
endcall
wrapuptime
musiconhold
updatecdr
recordagentcalls
recordformat
createlink
urlprefix
savecallsin
agent
6.5. extensions.conf
6.6. Log file
Importing the queue-Log into MySQL
7. External control of Asterisk
7.1. asterisk -rx "command"
Example
7.2. Call Files
Parameters
Executing call files in the future
Hotel wake-up call example
7.3. The Asterisk Manager Interface (AMI)
Example: Getting the number of voicemail messages with expect
StarAstAPI for PHP
Example: Getting the number of mailbox messages with PHP
7.4. The Aynchronous Javascript Asterisk Manager (AJAM)
Example: Getting the number of voicemail messages with AJAM
AJAX and AJAM considerations
8. Fax server
8.1. A fax server with IAXmodem and Hylafax
Installing IAXmodem
Installing Hylafax
Receiving faxes
Sending faxes
Sending received faxes as e-mail
IAXmodem and Hylafax FAQ
A. Installation instructions for Asterisk 1.4
A.1. Installing Asterisk 1.4.x on Debian Linux 4.0 (Etch)
Start-up and shutdown scripts
B. Applications in the dialplan
B.1. AddQueueMember()
B.2. ADSIProg()
B.3. AgentCallbackLogin()
B.4. AgentLogin()
B.5. AgentMonitorOutgoing()
B.6. AGI()
B.7. AlarmReceiver()
B.8. AMD()
B.9. Answer()
B.10. AppendCDRUserField()
B.11. Authenticate()
B.12. Background()
B.13. BackgroundDetect()
B.14. Busy()
B.15. CallingPres()
B.16. ChangeMonitor()
B.17. ChanIsAvail()
B.18. ChannelRedirect()
B.19. ChanSpy()
B.20. Congestion()
B.21. ContinueWhile()
B.22. ControlPlayback()
B.23. DateTime()
B.24. DBdel()
B.25. DBdeltree()
B.26. DeadAGI()
B.27. Dial()
B.28. Dictate()
B.29. Directory()
B.30. DISA()
B.31. DumpChan()
B.32. EAGI()
B.33. Echo()
B.34. EndWhile()
B.35. Exec()
B.36. ExecIf()
B.37. ExecIfTime()
B.38. ExitWhile()
B.39. ExtenSpy()
B.40. ExternalIVR()
B.41. FastAGI()
B.42. Festival()
B.43. Flash()
B.44. FollowMe()
B.45. ForkCDR()
B.46. GetCPEID()
B.47. Gosub()
B.48. GosubIf()
B.49. Goto()
B.50. GotoIf()
B.51. GotoIfTime()
B.52. Hangup()
B.53. IAX2Provision()
B.54. ImportVar()
B.55. Log()
B.56. LookupBlacklist()
B.57. LookupCIDName()
B.58. Macro()
B.59. MacroExclusive()
B.60. MacroExit()
B.61. MacroIf()
B.62. mailboxExists()
B.63. MeetMe()
B.64. MeetMeAdmin()
B.65. MeetMeCount()
B.66. Milliwatt()
B.67. MixMonitor()
B.68. Monitor()
B.69. Morsecode()
B.70. MP3Player()
B.71. MusicOnHold()
B.72. NBScat()
B.73. NoCDR()
B.74. NoOp()
B.75. Page()
B.76. Park()
B.77. ParkAndAnnounce()
B.78. ParkedCall()
B.79. PauseMonitor()
B.80. PauseQueueMember()
B.81. Perl()
B.82. PHP()
B.83. Pickup()
B.84. Playback()
B.85. Playtones()
B.86. PrivacyManager()
B.87. Progress()
B.88. Queue()
B.89. QueueLog()
B.90. Random()
B.91. Read()
B.92. ReadFile()
B.93. RealTime()
B.94. RealTimeUpdate()
B.95. Record()
B.96. RemoveQueueMember()
B.97. ResetCDR()
B.98. RetryDial()
B.99. Return()
B.100. Ringing()
B.101. SayAlpha()
B.102. SayDigits()
B.103. SayNumber()
B.104. SayPhonetic()
B.105. SayUnixTime()
B.106. SendDTMF()
B.107. SendImage()
B.108. SendText()
B.109. SendURL()
B.110. Set()
B.111. SetAMAFlags()
B.112. SetCallerPres()
B.113. SetCDRUserField()
B.114. SetGlobalVar()
B.115. SetMusicOnHold()
B.116. SetTransferCapability()
B.117. SIPAddHeader()
B.118. SIPdtmfMode()
B.119. SMS()
B.120. SoftHangup()
B.121. StopMonitor()
B.122. StopPlaytones()
B.123. System()
B.124. Transfer()
B.125. TryExec()
B.126. TrySystem()
B.127. UnpauseMonitor()
B.128. UnpauseQueueMember()
B.129. UserEvent()
B.130. Verbose()
B.131. VMAuthenticate()
B.132. VoiceMail()
B.133. VoiceMailMain()
B.134. Wait()
B.135. WaitExten()
B.136. WaitForRing()
B.137. WaitForSilence()
B.138. WaitMusicOnHold()
B.139. While()
B.140. Zapateller()
B.141. ZapBarge()
B.142. ZapRAS()
B.143. ZapScan()
C. Functions in the dialplan
C.1. AGENT()
C.2. ARRAY()
C.3. BASE64_DECODE()
C.4. BASE64_ENCODE()
C.5. CALLERID()
C.6. CDR()
C.7. CHANNEL()
C.8. CHECKSIPDOMAIN()
C.9. CURL()
C.10. CUT()
C.11. DB()
C.12. DB_DELETE()
C.13. DB_EXISTS()
C.14. DUNDILOOKUP()
C.15. ENUMLOOKUP()
C.16. ENV()
C.17. EVAL()
C.18. EXISTS()
C.19. FIELDQTY()
C.20. FILTER()
C.21. GLOBAL()
C.22. GROUP()
C.23. GROUP_COUNT()
C.24. GROUP_LIST()
C.25. GROUP_MATCH_COUNT()
C.26. IAXPEER()
C.27. IF()
C.28. IFTIME()
C.29. ISNULL()
C.30. KEYPADHASH()
C.31. LANGUAGE()
C.32. LEN()
C.33. MATH()
C.34. MD5()
C.35. MUSICCLASS()
C.36. ODBC_SQL()
C.37. ODBC_USER_DATABASE()
C.38. QUEUEAGENTCOUNT()
C.39. QUEUE_MEMBER_COUNT()
C.40. QUEUE_MEMBER_LIST()
C.41. QUOTE()
C.42. RAND()
C.43. REGEX()
C.44. SET()
C.45. SHA1()
C.46. SIPCHANINFO()
C.47. SIPPEER()
C.48. SIP_HEADER()
C.49. SORT()
C.50. STAT()
C.51. STRFTIME()
C.52. STRPTIME()
C.53. TIMEOUT()
C.54. TXTCIDNAME()
C.55. URIDECODE()
C.56. URIENCODE()
C.57. VMCOUNT()
D. Configuration templates
D.1. Creating templates
D.2. Using templates
Example
E. GNU Free Documentation License
E.1. PREAMBLE
E.2. APPLICABILITY AND DEFINITIONS
E.3. VERBATIM COPYING
E.4. COPYING IN QUANTITY
E.5. MODIFICATIONS
E.6. COMBINING DOCUMENTS
E.7. COLLECTIONS OF DOCUMENTS
E.8. AGGREGATION WITH INDEPENDENT WORKS
E.9. TRANSLATION
E.10. TERMINATION
E.11. FUTURE REVISIONS OF THIS LICENSE
E.12. ADDENDUM: How to use this License for your documents
Index