Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Foreword
Preface
Acknowledgments
About the Authors
Chapter 1 How to Get the Most Out of This Book
1.1 What Is Asterisk?
1.2 Who Should Read This Book?
1.2.1 The Beginner
1.2.2 The Journeyman
1.2.3 The Expert
1.3 Updates and Versions of the Book
1.4 Reader Contributions and Feedback
1.5 Additional Resources
Chapter 2 Installation and “Hello World”
2.1 Installing Asterisk on the Server
2.2 Calling “Hello World” from the CLI
2.2.1 Configuring Asterisk
2.2.2 Starting Asterisk and Calling “Hello World”
2.2.3 Stopping Asterisk
2.3 Calling “Hello World” with a SIP Phone
2.3.1 Configuring the SIP Phone and sip.conf
2.3.2 Starting Asterisk and the Phone
2.4 Building a Minimal Phone System with Two SIP Phones
2.4.1 Configuring Voicemail
2.5 Rights Administration with Contexts
2.5.1 The Originating Context
2.5.2 Call Destination: Contexts in extensions.conf
2.6 Calls to and from the Public Switched Telephone Network
2.6.1 Calling the PSTN
2.6.2 Taking Calls from the PSTN
Chapter 3 Dialplan Fundamentals
3.1 Contexts
3.2 Extensions
3.2.1 Fundamental Applications
3.2.2 Priorities
3.3 Pattern Matching
3.3.1 Pattern Elements
3.3.2 Testing a Pattern Using dialplan show
3.3.3 Pattern-Matching Order
3.4 Include Statements
3.4.1 Order of Execution When Using Include Statements
3.4.2 Time-Conditional Include Statements
3.5 The ${EXTEN} Variable and the ${CALLERID(num)} Function
3.5.1 ${EXTEN}
3.5.2 ${CALLERID(num)}
Chapter 4 Case Study: A Typical Business Telephone System
4.1 The Numbering Plan
4.2 Choosing the Infrastructure
4.2.1 Network
4.2.2 Server Hardware
4.3 Base Configuration
4.3.1 A sip.conf for 100 Users
4.3.2 The Dialplan
4.4 What Next?
Chapter 5 Dialplan Programming
5.1 Programming “How-To”
5.1.1 Program Structure
5.1.2 Using Set()
5.1.3 Labels and Goto()
5.1.4 While() Loops
5.1.5 GotoIf() Conditional
5.1.6 Gosub() Subroutines
5.2 Variables
5.2.1 Expanding Variables in an Extension
5.2.2 General Considerations
5.2.3 Defining Global Variables in extensions.conf
5.2.4 Defining Variables with Set()
5.2.5 Inheritance of Channel Variables
5.2.6 System Channel Variables
5.2.7 Manipulating Variables
5.3 Special Extensions
5.3.1 The h Extension
5.3.2 The i Extension
5.3.3 The o and a Extensions
5.3.4 The t and T Extensions
5.3.5 The s Extension
5.4 Macros
5.5 Deprecated Features
Chapter 6 Asterisk Extension Language
6.1 CLI Commands for AEL
6.2 aelparse
6.3 Comparing extensions.conf with extensions.ael
6.3.1 Line Termination
6.3.2 Contexts, Extensions, and Priorities
6.3.3 Comments
6.3.4 Includes
6.3.5 Global Variables
6.3.6 Expressions and Variable Assignment
6.3.7 Labels, goto, and jump
6.3.8 Conditionals
6.3.9 Loops
6.3.10 Macros
6.3.11 Hints
6.3.12 Filtering by Caller ID
6.4 Choosing between extensions.ael and extensions.conf
Chapter 7 Protocols
7.1 Network Protocols
7.1.1 Transmission Control Protocol
7.1.2 User Datagram Protocol
7.2 Channels
7.3 Peers, Users, and Friends
7.4 IAX Versus SIP
Chapter 8 Making Connections
8.1 Codecs
8.1.1 What Does a Codec Do?
8.1.2 Performance
8.1.3 Configuring Codecs
8.1.4 Commonly Used Codecs
8.1.5 Bandwidth and Trunking
8.2 Integrated Services Digital Network
8.2.1 ISDN Basics
8.2.2 Choosing an ISDN Card
8.2.3 Media Gateways
8.3 Analog Telephony
8.3.1 Connecting Analog Devices
8.3.2 Analog Telephone Adapter
Chapter 9 Voicemail
9.1 Example Implementations
9.1.1 An Example Home System
9.1.2 An Example Business System
9.3 Dialplan Applications
9.3.1 VoiceMail
9.3.2 VoiceMailMain
9.4 voicemail.conf
9.4.1 [general]
9.4.2 [zonemessages]
9.4.3 Defined Contents
9.4.4 Mailboxes
9.5 Dial-by-Name
9.6 Saving Passwords in voicemail.conf
Chapter 10 Interactive Voice Response
10.1 A Simple IVR
10.1.1 Timeouts
10.1.2 Invalid Input (the i Extension)
10.1.3 Pauses
10.2 Multilevel IVR Systems
10.3 Text-to-Speech
10.3.1 Installing Cepstral TTS
Chapter 11 The Asterisk Database
11.1 The Asterisk Database
11.1.1 Writing Values to the Database
11.1.2 Reading Values from the Database
11.1.3 Deleting Values from the Database
11.2 Database Access from the Command-Line Interface
11.2.1 Writing Values to the Database
11.2.2 Reading Values from the Database
11.2.3 Deleting Values from the Database
11.2.4 Displaying Database Contents
11.3 Database Access from the System Shell
11.4 Database Backup
11.5 Application Example: Call Forwarding
11.5.1 Simple Call Forwarding
11.5.2 Complex Call Forwarding
11.6 Application Example: Calling Card
Chapter 12 Queues
12.1 Extension for Testing Hold Music
12.2 musiconhold.conf
12.3 queues.conf
12.3.1 Announcement Sound Files
12.4 agents.conf
12.5 Extensions
12.5.1 Sending Callers to the Queue
12.5.2 AgentLogin() and AgentCallbackLogin()
12.6 Log File
12.6.1 Importing the Queue Log into MySQL
Chapter 13 Features
13.1 Call Transfer
13.1.1 Blind Transfer
13.1.2 Attended Transfer
13.2 Call Parking
Chapter 14 Conferencing
14.1 Installation and the Timing Device
14.2 Defining Conference Rooms
14.3 Access from the Dialplan
14.4 Announcing the Number of Conference Participants
Chapter 15 External Control of Asterisk
15.1 asterisk -rx “command”
15.2 Call Files
15.2.1 Making a Call Automatically
15.2.2 Parameters
15.2.3 Hotel Wake-Up Call Example
15.3 The Asterisk Manager Interface
15.3.1 Creating an AMI User
15.3.2 Talking to the AMI
15.3.3 AMI Commands
15.3.4 Getting the Number of Voicemail Messages with Expect
15.3.5 StarAstAPI for PHP
15.3.6 Getting the Number of Mailbox Messages with PHP
15.4 The Asynchronous JavaScript Asterisk Manager
15.4.1 Getting the Number of Voicemail Messages with AJAM
15.4.2 AJAX and AJAM Considerations
Chapter 16 Asterisk Gateway Interface
16.1 Data Streams
16.1.1 STDIN
16.1.2 STDOUT
16.1.3 STDERR
16.2 Examples in Various Programming Languages
16.2.1 Perl
16.2.2 PHP
16.2.3 Ruby and Adhearsion
16.2.4 Other Programming Languages
Chapter 17 Fax Server
17.1 Installing IAXmodem
17.1.1 Configuring IAXmodem
17.1.2 Configuring faxgetty and Logging
17.2 Installing Hylafax
17.3 Receiving Faxes
17.4 Sending Faxes
17.5 Sending Received Faxes as E-Mail
Chapter 18 Busy Lamp Field, Hints, Pickup
18.1 Controlling Indicators
18.1.1 sip.conf
18.1.2 Hints
18.2 Subscriptions
18.3 Configuring Telephones for BLF
18.3.1 BLF on the Aastra 480i
18.3.2 Polycom Soundpoint IP 501
18.4 Testing the Hints
18.5 Configuring Pickup
18.5.1 extensions.conf for Pickup
18.5.2 Configuring the Phones for Pickup
18.5.3 Configuring Group Pickup
18.6 Advanced BLF Indicators in Asterisk 1.6
Appendix A Installation Instructions for Asterisk 1.4
A.1 LibPRI
A.2 DAHDI
A.3 Asterisk
Appendix B Dialplan Applications
B.1 AbsoluteTimeout()
B.2 AddQueueMember()
B.3 ADSIProg()
B.4 AgentCallbackLogin()
B.5 AgentLogin()
B.6 AgentMonitorOutgoing()
B.7 AGI()
B.8 AlarmReceiver()
B.9 AMD()
B.10 Answer()
B.11 AppendCDRUserField()
B.12 Authenticate()
B.13 Background()
B.14 BackgroundDetect()
B.15 Bridge()
B.16 Busy()
B.17 ChangeMonitor()
B.18 ChanIsAvail()
B.19 ChannelRedirect()
B.20 ChanSpy()
B.21 CheckGroup()
B.22 ClearHash()
B.23 Congestion()
B.24 ContinueWhile()
B.25 ControlPlayback()
B.26 Curl()
B.27 Cut()
B.28 DAHDIBarge()
B.29 DAHDIRAS()
B.30 DAHDIScan()
B.31 DAHDISendKeypadFacility()
B.32 DateTime()
B.33 DBdel()
B.34 DBdeltree()
B.35 DBget()
B.36 DBput()
B.37 DeadAGI()
B.38 Dial()
B.39 Dictate()
B.40 DigitTimeout()
B.41 Directory()
B.42 DISA()
B.43 DumpChan()
B.44 DUNDiLookup()
B.45 EAGI()
B.46 Echo()
B.47 EndWhile()
B.48 EnumLookup()
B.49 Eval()
B.50 Exec()
B.51 ExecIf()
B.52 ExecIfTime()
B.53 ExitWhile()
B.54 ExtenSpy()
B.55 ExternalIVR()
B.56 FastAGI()
B.57 Festival()
B.58 Flash()
B.59 FollowMe()
B.60 ForkCDR()
B.61 GetCPEID()
B.62 GetGroupCount()
B.63 GetGroupMatchCount()
B.64 Gosub()
B.65 GosubIf()
B.66 Goto()
B.67 GotoIf()
B.68 GotoIfTime()
B.69 Hangup()
B.70 HasNewVoicemail()
B.71 HasVoicemail()
B.72 IAX2Provision()
B.73 ICES()
B.74 ImportVar()
B.75 Incomplete()
B.76 JabberSend()
B.77 JabberStatus()
B.78 KeepAlive()
B.79 Log()
B.80 LookupBlacklist()
B.81 LookupCIDName()
B.82 Macro()
B.83 MacroExclusive()
B.84 MacroExit()
B.85 MacroIf()
B.86 mailboxExists()
B.87 Math()
B.88 MD5()
B.89 MD5Check()
B.90 MeetMe()
B.91 MeetMeAdmin()
B.92 MeetMeChannelAdmin()
B.93 MeetMeCount()
B.94 Milliwatt()
B.95 MinivmAccMess()
B.96 MinivmDelete()
B.97 MinivmGreet()
B.98 MinivmNotify()
B.99 MinivmRecord()
B.100 MixMonitor()
B.101 Monitor()
B.102 Morsecode()
B.103 MP3Player()
B.104 MSet()
B.105 MusicOnHold()
B.106 NBScat()
B.107 NoCDR()
B.108 NoOp()
B.109 ODBCFinish()
B.110 Page()
B.111 Park()
B.112 ParkAndAnnounce()
B.113 ParkedCall()
B.114 PauseMonitor()
B.115 PauseQueueMember()
B.116 Pickup()
B.117 PickupChan()
B.118 Playback()
B.119 Playtones()
B.120 PrivacyManager()
B.121 Proceeding()
B.122 Progress()
B.123 Queue()
B.124 QueueLog()
B.125 RaiseException()
B.126 Random()
B.127 Read()
B.128 ReadExten()
B.129 ReadFile()
B.130 RealTime()
B.131 RealTimeUpdate()
B.132 ReceiveFAX()
B.133 Record()
B.134 RemoveQueueMember()
B.135 ResetCDR()
B.136 ResponseTimeout()
B.137 RetryDial()
B.138 Return()
B.139 Ringing()
B.140 SayAlpha()
B.141 SayDigits()
B.142 SayNumber()
B.143 SayPhonetic()
B.144 SayUnixTime()
B.145 SendDTMF()
B.146 SendFAX()
B.147 SendImage()
B.148 SendText()
B.149 SendURL()
B.150 Set()
B.151 SetAccount()
B.152 SetAMAFlags()
B.153 SetCallerID()
B.154 SetCallerPres()
B.155 SetCDRUserField()
B.156 SetCIDName()
B.157 SetCIDNum()
B.158 SetGlobalVar()
B.159 SetGroup()
B.160 SetLanguage()
B.161 SetMusicOnHold()
B.162 SetRDNIS()
B.163 SetTransferCapability()
B.164 SetVar()
B.165 SIPAddHeader()
B.166 SIPdtmfMode()
B.167 SIPGetHeader()
B.168 SMS()
B.169 SoftHangup()
B.170 Sort()
B.171 StackPop()
B.172 StartMusicOnHold()
B.173 StopMixMonitor()
B.174 StopMonitor()
B.175 StopMusicOnHold()
B.176 StopPlaytones()
B.177 System()
B.178 Transfer()
B.179 TryExec()
B.180 TrySystem()
B.181 TXTCIDName()
B.182 UnpauseMonitor()
B.183 UnpauseQueueMember()
B.184 UserEvent()
B.185 Verbose()
B.186 VMAuthenticate()
B.187 VoiceMail()
B.188 VoiceMailMain()
B.189 Wait()
B.190 WaitExten()
B.191 WaitForNoise()
B.192 WaitForRing()
B.193 WaitForSilence()
B.194 WaitMusicOnHold()
B.195 WaitUntil()
B.196 While()
B.197 Zapateller()
B.198 ZapBarge()
B.199 ZapRAS()
B.200 ZapScan()
B.201 ZapSendKeypadFacility()
Appendix C Dialplan Functions
C.1 AGENT()
C.2 ARRAY()
C.3 BASE64_DECODE()
C.4 BASE64_ENCODE()
C.5 BLACKLIST
C.6 CALLERID()
C.7 CDR()
C.8 CHANNEL()
C.9 CHECKSIPDOMAIN()
C.10 CURL()
C.11 CUT()
C.12 DB()
C.13 DB_DELETE()
C.14 DB_EXISTS()
C.15 DUNDILOOKUP()
C.16 ENUMLOOKUP()
C.17 ENV()
C.18 EVAL()
C.19 EXISTS()
C.20 FIELDQTY()
C.21 FILTER()
C.22 GLOBAL()
C.23 GROUP()
C.24 GROUP_COUNT()
C.25 GROUP_LIST()
C.26 GROUP_MATCH_COUNT()
C.27 IAXPEER()
C.28 IF()
C.29 IFTIME()
C.30 ISNULL()
C.31 KEYPADHASH()
C.32 LANGUAGE()
C.33 LEN()
C.34 MATH()
C.35 MD5()
C.36 MUSICCLASS()
C.37 ODBC_SQL()
C.38 ODBC_USER_DATABASE()
C.39 QUEUEAGENTCOUNT()
C.40 QUEUE_MEMBER_COUNT()
C.41 QUEUE_MEMBER_LIST()
C.42 QUOTE()
C.43 RAND()
C.44 REGEX()
C.45 SET()
C.46 SHA1()
C.47 SIPCHANINFO()
C.48 SIPPEER()
C.49 SIP_HEADER()
C.50 SORT()
C.51 STAT()
C.52 STRFTIME()
C.53 STRPTIME()
C.54 TIMEOUT()
C.55 TXTCIDNAME()
C.56 URIDECODE()
C.57 URIENCODE()
C.58 VMCOUNT()
Appendix D AGI Command Summary
D.1 ANSWER
D.2 ASYNCAGI BREAK
D.3 CHANNEL STATUS
D.4 CONTROL STREAM FILE
D.5 DATABASE DEL
D.6 DATABASE DELTREE
D.7 DATABASE GET
D.8 DATABASE PUT
D.9 EXEC
D.10 GET DATA
D.11 GET FULL VARIABLE
D.12 GET OPTION
D.13 GET VARIABLE
D.14 GOSUB
D.15 HANGUP
D.16 NOOP
D.17 RECEIVE CHAR
D.18 RECEIVE TEXT
D.19 RECORD FILE
D.20 SAY ALPHA
D.21 SAY DATE
D.22 SAY DATETIME
D.23 SAY DIGITS
D.24 SAY NUMBER
D.25 SAY PHONETIC
D.26 SAY TIME
D.27 SEND IMAGE
D.28 SEND TEXT
D.29 SET AUTOHANGUP
D.30 SET CALLERID
D.31 SET CONTEXT
D.32 SET EXTENSION
D.33 SET MUSIC
D.34 SET PRIORITY
D.35 SET VARIABLE
D.36 STREAM FILE
D.37 TDD MODE
D.38 VERBOSE
D.39 WAIT FOR DIGIT
Appendix E AMI Command Summary
E.1 AbsoluteTimeout
E.2 AgentCallbackLogin
E.3 AgentLogoff
E.4 Agents
E.5 AGI
E.6 Atxfer
E.7 Bridge
E.8 Challenge
E.9 ChangeMonitor
E.10 Command
E.11 CoreSettings
E.12 CoreShowChannels
E.13 CoreStatus
E.14 CreateConfig
E.15 DAHDIDialOffhook
E.16 DAHDIDNDoff
E.17 DAHDIDNDon
E.18 DAHDIHangup
E.19 DAHDIRestart
E.20 DAHDIShowChannels
E.21 DAHDITransfer
E.22 DBDel
E.23 DBDelTree
E.24 DBGet
E.25 DBPut
E.26 Events
E.27 ExtensionState
E.28 GetConfig
E.29 GetConfigJSON
E.30 Getvar
E.31 Hangup
E.32 IAXnetstats
E.33 IAXpeerlist
E.34 IAXpeers
E.35 JabberSend
E.36 ListCategories
E.37 ListCommands
E.38 Login
E.39 Logoff
E.40 MailboxCount
E.41 MailboxStatus
E.42 MeetmeList
E.43 MeetmeMute
E.44 MeetmeUnmute
E.45 ModuleCheck
E.46 ModuleLoad
E.47 Monitor
E.48 Originate
E.49 Park
E.50 ParkedCalls
E.51 PauseMonitor
E.52 Ping
E.53 PlayDTMF
E.54 QueueAdd
E.55 QueueLog
E.56 QueuePause
E.57 QueuePenalty
E.58 QueueRemove
E.59 QueueRule
E.60 Queues
E.61 QueueStatus
E.62 QueueSummary
E.63 Redirect
E.64 Reload
E.65 SendText
E.66 SetCDRUserField
E.67 Setvar
E.68 ShowDialPlan
E.69 SIPnotify
E.70 SIPpeers
E.71 SIPqualifypeer
E.72 SIPshowpeer
E.73 SIPshowregistry
E.74 Status
E.75 StopMonitor
E.76 UnpauseMonitor
E.77 UpdateConfig
E.78 UserEvent
E.79 VoicemailUsersList
E.80 WaitEvent
E.81 ZapDialOffhook
E.82 ZapDNDoff
E.83 ZapDNDon
E.84 ZapHangup
E.85 ZapRestart
E.86 ZapShowChannels
E.87 ZapTransfer
Appendix F Configuration Templates
F.1 Creating Templates
F.2 Using Templates
Appendix G Upgrading from 1.4 to 1.6
G.1 AEL
G.2 Core
G.3 Voicemail
G.4 Dialplan Applications and Functions
G.5 CDR
G.6 Audio Formats
G.7 Channel Drivers
G.8 Configuration
G.9 Asterisk Manager Interface
Appendix H From Zaptel to DAHDI
H.1 DAHDI
H.2 Interview with Kevin P. Fleming
Appendix I IAX vs. SIP
Appendix J GNU Free Documentation License
0 PREAMBLE
1 APPLICABILITY AND DEFINITIONS
2 VERBATIM COPYING
3 COPYING IN QUANTITY
4 MODIFICATIONS
5 COMBINING DOCUMENTS
6 COLLECTIONS OF DOCUMENTS
7 AGGREGATION WITH INDEPENDENT WORKS
8 TRANSLATION
9 TERMINATION
10 FUTURE REVISIONS OF THIS LICENSE
11 RELICENSING
Index
← Prev
Back
Next →
← Prev
Back
Next →