Mini-review of Asterisk Gateway Interface 1.4 and 1.6 Programming

 

Important
This is an edited version of a post that originally appeared on a blog called The Michigan Telephone Blog, which was written by a friend before he decided to stop blogging. It is reposted with his permission. Comments dated before the year 2013 were originally posted to his blog. In order to comply with Federal Trade Commission regulations, I am disclosing that he received a free product sample of the item under review prior to writing the review, and that any links to Amazon.com in this article are affiliate links, and if you make a purchase through one of those links I will receive a small commission on the sale.

This was originally posted in April, 2009.

I am NOT currently a PHP coder, so it’s a bit difficult for me to comment on this book. Not that the book is exclusively for PHP coders, but virtually all the examples are in PHP, so if you really want to understand what’s going on, you probably have to know at least some PHP.

So before I continue, let me run Packt Publishing’s little blub, to get the cover photo and linking out of the way:

Asterisk Gateway Interface 1.4 and 1.6 Programming Design and develop Asterisk-based VoIP telephony platforms and services using PHP and PHPAGI

  • Develop voice-enabled applications utilizing the collective power of Asterisk, PHP, and the PHPAGI class library
  • Learn basic elements of a FastAGI server utilizing PHP and PHPAGI
  • Develop new Voice 2.0 mesh-ups using the Asterisk Manager
  • Add Asterisk application development skills to your development arsenal, enriching your market offering and experience
  • Up to date for Asterisk version 1.6 and covers all previous versions

http://www.packtpub.com/asterisk-gateway-interface-programming/book

Okay, that’s the publisher’s word on the book. Now here’s my take: The one thing I thought was not right about this book was how many pages you have to go through before you get to what is supposed to be the book’s subject. The first chapter is about Installing a ‘Vanilla’ Asterisk. Now really, if someone is contemplating the purchase of this book, don’t you think it’s likely that they have Asterisk (in some form) already installed?

The second chapter is on Basic IVR Development: Using the Asterisk DialPlan and while I suppose this chapter is somewhat useful in laying the groundwork for what is to come, by the time you are through with it you are already up to page 53. And then comes the next chapter: More IVR Development: Input, Recordings, and Call Control. And that chapter ends on page 73. This is a problem because the last regular page of the book, at the end of Chapter 10, is page 191 – which basically means that nearly half the book is devoted to installing Asterisk from scratch, and then creating an IVR the old-fashioned way (if I want an IVR I’ll create it in FreePBX, thank you very much). And there is virtually nothing about AGI programming in those initial three chapters.

Finally, in Chapter 4, starting on page 75, we get into A Primer to AGI: Asterisk Gateway Interface – and this is where the book hits its stride and keeps on going. If you know PHP but know next to nothing about Asterisk AGI programming, this book will teach you the basics of what you need to know to start writing AGI code – but perhaps just as important, it will teach you good coding practices. It explains when you should try to put code in the Asterisk DialPlan as opposed to putting it in an AGI script. It explains why certain languages are much better than others when you are writing an AGI script. And it will teach you the fundamental rationale behind AGI scripts – if you are a seldom-coder like me, you probably think that calling an AGI script is simply calling a bit of code written in some other programming language. Nothing could be further from the truth.

AGI scripts are actually quite a bit more powerful than many Asterisk users realize – I think that theoretically you could do most of your Asterisk programming from inside an AGI script, but that doesn’t mean you should. One of the things that the AGI shines at is obtaining data that’s not normally available to Asterisk – for example, information from a local or remote database, or even from a FTP server or web-based service. You’ve seen web-based “click to call” services like Jajah? That’s basically obtaining data from a web server so that Asterisk can initiate a callback, and this book shows you how something like that is set up.

I’ve heard it said that in many books there is one chapter that epitomizes the entire volume. In this case, there are about five chapters that are the heart of the book, but you will learn a great deal in those five chapters. Even without knowing a lick of PHP, I came away with a greater understanding of what AGI scripts are, and when and how they should be used. Had I actually been able to understand the PHP examples, I think I’d have had a much greater appreciation for the book. The author definitely knows his subject; and perhaps that’s why once he gets into it you feel like you’re getting solid information.

So I guess I would say this: If you judge the value of a book solely on page count, and you don’t need to know how to install Asterisk from scratch or set up an IVR, then you may feel a bit disappointed by this book (if that’s really the case, do yourself a favor and skip the first three chapters). But if you judge a text on how quickly it can bring you up to speed on a subject, and you want to learn Asterisk AGI programming, I think you’ll like it. Since the book relies so heavily on PHP, I think the first three chapters might have been better spent on an introduction to PHP – if the author would have covered that as well as he covers the Asterisk Gateway Interface, I’m sure I would have had a greater appreciation of this volume.

One other thing I noted is that this book seems to be very current – It’s not talking about Asterisk as it was two years ago. It was first published in January, 2009. That’s important when you are looking for information related to Asterisk, which can change quite a bit in a couple of years.

Asterisk Gateway Interface 1.4 and 1.6 Programming (Amazon affiliate link) by Nir Simionovich
Chapter List:

Table of Contents
Preface
Chapter 1: Installing a ‘Vanilla’ Asterisk
Chapter 2: Basic IVR Development: Using the Asterisk DialPlan
Chapter 3: More IVR Development: Input, Recordings, and Call Control
Chapter 4: A Primer to AGI: Asterisk Gateway Interface
Chapter 5: AGI Scripting with PHP
Chapter 6: PHPAGI: An AGI Class Library in PHP
Chapter 7: FastAGI: AGI as a TCP Server
Chapter 8: AMI: The Asterisk Manager Interface
Chapter 9: Final Programming Project
Chapter 10: Scaling Asterisk Applications
Index

Or if you’d like to see a complete Table of Contents with subheadings, in outline form, go here.

Author Nir Simionovich’s blog

2 thoughts on “Mini-review of Asterisk Gateway Interface 1.4 and 1.6 Programming

  1. NOTICE: All comments above this one were imported from the original Michigan Telephone Blog and may or may not be relevant to the edited article above.

Leave a Reply to Adrian Abramovich Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez