This is my second book, and I have to admit that I really enjoyed working on this book. While I enjoyed working on my previous book, (the AsteriskNow book from Packt Publishing), I couldn't help but feel that a portion of me has really slipped into the pages of this book.
This book is a developer's book, and it is written for developers by a developer. I see myself as an Asterisk application developer. After developing dozens of platforms over the course of the past six years, all based arround Asterisk, I can honestly say that I've seen mistakes that I made six years ago, still being made today by novice developers.
My role at Greenfield Technologies Ltd. (apart from being the CEO and Founder) is that of a development consultant, where I render various Asterisk consulting services to various companies in Israel and worldwide. Wherever I go, no matter what customer I cater, the mistakes and wrongful paradigms seem to persist. They persist due to a simple reason: there is no school for Asterisk developers. We have web developers, core developers, and database developers. But Asterisk developer is usually either a web developer or a core developer who is assigned a task, or in the worst case, a database developer entrusted with a task that he totally doesn't understand. The developers automatically do what they were taught to do: they superimpose their aggregated knowledge and experience on the Asterisk world, which usually ends up in disaster.
Asterisk is one of the most innovative pieces of open source software created in the past ten years (Asterisk just hit nine years old on December 05, 2008). While Asterisk provides one of the most extensive telephony toolkits available today, its utilization in a commercial application or platform construct isn't as straightforward as it would seem. This book de-mystifies some of the mystic characteristics associated with Asterisk, while at the same exposing some of the well-guarded secrets of professional Asterisk platform developers.
Asterisk requires a new skill set to be developed—one that web developers have no idea of and core developers completely disregard. My aim with this book is to enable you to learn the lessons and values that I've learned over a period of six years from a simple, shrink wrapped, to the point guide. I hope this book will remain on your table as a useful tool.
Chapter 1 introduces the various hardware elements required for installing your Asterisk PBX system, and guides you through the Asterisk installation procedure.
Chapter 2 introduces us to the dialplan—extension, context, and syntax. It then covers the main part—developing a basic IVR (Interactive Voice Response) application using Asterisk dialplan.
Chapter 3 takes us a bit deeper into IVR development, wherein we learn grabbing and processing input. The introduction of the Read application, and the conditional branching and execution, enable a new flexibility that was not available initially.
Chapter 4 is all about AGI—its working, its three types, and the different frameworks. Finally it covers the do's and don'ts that need to be followed for the AGI script to work and function properly.
Chapter 5 introduces you to your first AGI script, using the Hello World
program. It also touches upon AGI debugging.
Chapter 6 covers a PHP based AGI class library—PHPAGI. The chapter starts with an explanation of the PHPAGI file structure, and then goes on to cover simple, and finally more complex, PHPAGI examples.
Chapter 7 introduces the basic elements of a FastAGI server, again using PHP and PHPAGI.
Chapter 8 helps understand the Asterisk Manager Interface (AMI)—an Asterisk proprietary Computer Telephony Integration (CTI) interface.
Chapter 9 takes you through the steps of developing a full click-2-call application, using all the concepts you've learned. Chapter 9 can be used as the basis for a large scale service, such as JaJah or RebTel.
Chapter 10 tries to deal with some of the more advanced topics of developing Asterisk applications—mainly scalability and performance issues. By the end of this chapter, the reader should be well-equipped with the information to build the next Verizon Killer application.
In order to utilize this book to the fullest, you will need the following:
A personal computer (PC) running the Linux operating system. We used CentOS for this book, but you may use any distribution that you feel comfortable with. If you would like to get up and running really quickly, you can use the AsteriskNOW (version 1.5) distribution, located at http://www.asterisknow.org. This can also be a Virtual Machine (VM) based system, using VMWARE.
A PC that you can use as your workstation for development purposes and web browsing purposes.
An IP Phone—either a soft phone or hardware IP phone.
A Digium TDM11B card (optional).The Digium TDM11B card provides two analog interfaces—one for a phone line (an FXO) and the other for an analog phone (an FXS).
Experience with the Linux shell—basic system administration skills are required.
Experience with a programming language. This book is for developers, it doesn't teach you a programming language. Knowledge of PHP is preferred for this book.
Finally, you need patience and a pot of coffee—at least for the first three chapters.
This book is intended for developers wishing to utilize Asterisk, system administrators wishing to gain better control over their Asterisk installation, and telephony service providers wishing to deploy Asterisk-based solutions to their infrastructure. You are expected to have some experience with Asterisk and a basic understanding of programming. No knowledge of Asterisk programming is required.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "If we are going to examine the operational flow of the just seen context, it is fairly clear that Asterisk will perform background playback on two files—demo-congrats
and demo-instruct"
A block of code will be set as follows:
exten => 3,1,Set(LANGUAGE()=fr) exten => 3,n,Goto(s,restart)
Any command-line input and output is written as follows:
# ./memcached -d -m 2048 -l 192.168.2.52 -p 6636
New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this:
"As the immediately preceding screenshot illustrates, issue the make config command in order to install initial configuration files and system init scripts."
Note
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to <[email protected]>
, making sure to mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form onwww.packtpub.com or email <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide onwww.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Visit http://www.packtpub.com/files/code/4466_Code.zip to directly download the example code.
The downloadable files contain instructions on how to use them.
Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata are added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide the location address or website name immediately so we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with some aspect of the book, and we will do our best to address it.