Practical Asterisk 1.4 (unstable) - Rev. 727

Foreword
1. Installation and "Hello World"
Introduction
A simple PBX system
Objectives
Requirements
Which Asterisk version?
Which Linux distribution is best for Asterisk?
Why don't we use Asterisk packages with apt-get or rpm?
Installing from current Asterisk sources
Configure the Asterisk server
An answering machine
What did we just do?
extensions.conf - the Asterisk dialplan
voicemail.conf - The voicemail system
Calling the public telephone network
Taking calls from the public telephone network
2. Dialplan Basics
Context
Syntax
Extension
Syntax
Fundamental Applications
Priority
A "Hello World!" example
n priority
Pattern Matching
Syntax
Testing a pattern using dialplan show
Pattern matching order
A special case - the pattern "_." in Asterisk 1.2
Include statements
Syntax
Example
Order of execution when using include statements
Time-conditional include statements
Syntax
Example
3. Programming in the dialplan
Programming "How-to"
Program structure
Variables
Labels and Goto()
While() loops
GotoIf() conditional
Gosub() subroutines
Variables
Expanding variables in an extension
General considerations
String variables
Reserved characters
Integers
Defining global variables in extensions.conf
Defining variables with Set()
Syntax
Inheritance of channel variables
Single-level inheritance
Multi-level inheritance
System channel variables
Manipulating variables
Substring
Syntax
Examples
Special extensions
The h extension
Example
The i extension
Example
The o and a extensions
The t and T extensions
t extension
T extension
The s extension
Macros
Macro basics
Priority jumping is deprecated
4. Voicemail
Introduction
Example implementations
The Robinson Family
Tasks
Configuration
Widgets, Inc.
Tasks
Configuration
Special considerations
Dialplan applications
VoiceMail()
Syntax
VoiceMailMain()
Syntax
IVR
voicemail.conf
[general]
[zonemessages]
Syntax
Defined contexts
The default context
Mailboxesd
Syntax
Directory (Dial-by-Name)
Syntax
Operation
Saving passwords in voicemail.conf
5. Interactive Voice Response (IVR)
A simple IVR
Differences between Playback() and Background()
Difference between 10 and 1000
Intelligent discernment
Invalid input (the i extension)
Pauses
Multilevel IVR systems
IVR depth
Text-to-Speech (TTS)
Installating Cepstral Text-to-Speech
Examples and tests
Pauses in text
6. External control of Asterisk
asterisk -rx "command"
Example
Call Files
Parameters
Executing call files in the future
Hotel wake-up call example
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
The Aynchronous Javascript Asterisk Manager (AJAM)
Example: Getting the number of voicemail messages with AJAM
HTML
Plain-Text
XML
AJAX and AJAM considerations
JSON
Ping
AJAM Demo
Apache
7. Fax server
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
Installing Asterisk 1.4.x on Debian Linux 4.0 (Etch)
Start-up and shutdown scripts
B. Applications in the dialplan
AddQueueMember()
ADSIProg()
AgentCallbackLogin()
AgentLogin()
AgentMonitorOutgoing()
AGI()
AlarmReceiver()
AMD()
Answer()
AppendCDRUserField()
Authenticate()
Background()
BackgroundDetect()
Busy()
CallingPres()
ChangeMonitor()
ChanIsAvail()
ChannelRedirect()
ChanSpy()
Congestion()
ContinueWhile()
ControlPlayback()
DateTime()
DBdel()
DBdeltree()
DeadAGI()
Dial()
Dictate()
Directory()
DISA()
DumpChan()
EAGI()
Echo()
EndWhile()
Exec()
ExecIf()
ExecIfTime()
ExitWhile()
ExtenSpy()
ExternalIVR()
FastAGI()
Festival()
Flash()
FollowMe()
ForkCDR()
GetCPEID()
Gosub()
GosubIf()
Goto()
GotoIf()
GotoIfTime()
Hangup()
IAX2Provision()
ImportVar()
Log()
LookupBlacklist()
LookupCIDName()
Macro()
MacroExclusive()
MacroExit()
MacroIf()
mailboxExists()
MeetMe()
MeetMeAdmin()
MeetMeCount()
Milliwatt()
MixMonitor()
Monitor()
Morsecode()
MP3Player()
MusicOnHold()
NBScat()
NoCDR()
NoOp()
Page()
Park()
ParkAndAnnounce()
ParkedCall()
PauseMonitor()
PauseQueueMember()
Perl()
PHP()
Pickup()
Playback()
Playtones()
PrivacyManager()
Progress()
Queue()
QueueLog()
Random()
Read()
ReadFile()
RealTime()
RealTimeUpdate()
Record()
RemoveQueueMember()
ResetCDR()
RetryDial()
Return()
Ringing()
SayAlpha()
SayDigits()
SayNumber()
SayPhonetic()
SayUnixTime()
SendDTMF()
SendImage()
SendText()
SendURL()
Set()
SetAMAFlags()
SetCallerPres()
SetCDRUserField()
SetGlobalVar()
SetMusicOnHold()
SetTransferCapability()
SIPAddHeader()
SIPdtmfMode()
SMS()
SoftHangup()
StopMonitor()
StopPlaytones()
System()
Transfer()
TryExec()
TrySystem()
UnpauseMonitor()
UnpauseQueueMember()
UserEvent()
Verbose()
VMAuthenticate()
VoiceMail()
VoiceMailMain()
Wait()
WaitExten()
WaitForRing()
WaitForSilence()
WaitMusicOnHold()
While()
Zapateller()
ZapBarge()
ZapRAS()
ZapScan()
C. Functions in the dialplan
AGENT()
ARRAY()
BASE64_DECODE()
BASE64_ENCODE()
CALLERID()
CDR()
CHANNEL()
CHECKSIPDOMAIN()
CURL()
CUT()
DB()
DB_DELETE()
DB_EXISTS()
DUNDILOOKUP()
ENUMLOOKUP()
ENV()
EVAL()
EXISTS()
FIELDQTY()
FILTER()
GLOBAL()
GROUP()
GROUP_COUNT()
GROUP_LIST()
GROUP_MATCH_COUNT()
IAXPEER()
IF()
IFTIME()
ISNULL()
KEYPADHASH()
LANGUAGE()
LEN()
MATH()
MD5()
MUSICCLASS()
ODBC_SQL()
ODBC_USER_DATABASE()
QUEUEAGENTCOUNT()
QUEUE_MEMBER_COUNT()
QUEUE_MEMBER_LIST()
QUOTE()
RAND()
REGEX()
SET()
SHA1()
SIPCHANINFO()
SIPPEER()
SIP_HEADER()
SORT()
STAT()
STRFTIME()
STRPTIME()
TIMEOUT()
TXTCIDNAME()
URIDECODE()
URIENCODE()
VMCOUNT()
D. Configuration templates
Creating templates
Using templates
Example
E. GNU Free Documentation License
PREAMBLE
APPLICABILITY AND DEFINITIONS
VERBATIM COPYING
COPYING IN QUANTITY
MODIFICATIONS
COMBINING DOCUMENTS
COLLECTIONS OF DOCUMENTS
AGGREGATION WITH INDEPENDENT WORKS
TRANSLATION
TERMINATION
FUTURE REVISIONS OF THIS LICENSE
ADDENDUM: How to use this License for your documents
Index