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

Review of Ring Voltage Booster II™ from Mike Sandman Enterprises

 

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.

This article was originally published in April, 2008.

Once in a while you run into a situation where someone wants to put a whole bunch of phones on one physical phone pair. This can often happen in a home with many rooms, where every room has been prewired with a phone jack. You start out with a phone in the kitchen or living room, then you want one in the master bedroom, then each of the kids wants one, then you want one in the workshop down in the basement, and so on. Okay, so granted that the above example would probably have been more appropriate 20 years ago (before all the family members started wanting their own cell phones) but you can still run into such situations, both in homes and in small businesses that only have one or two phone lines and a bunch of phones hanging off each line.

In the old days the phone company let you have enough current to ring five standard telephone ringers – 5 REN in telco-speak – and that was five of the old mechanical style ringers with real bells. But nowadays people have started replacing their old wireline lines with newer stuff, like VoIP, and VoIP adapters can be notoriously stingy with ring current. Sometimes when people convert to VoIP, they find that they either have to disconnect some phones (or at least, shut off or disconnect the ringers in those phones) or figure out a way to boost the ring current.

Yet another problem with both certain makes of VoIP adapters, and even with some low-cost telephone switches sold to businesses, is that they don’t produce enough ringing voltage or current to begin with. That might be particularly true if the adapter or switch was designed to standards other than those typically used in the U.S.A. and Canada. In those two countries, phones and phone equipment have always been designed to expect ringing current at approximately 90 volts AC at 20 Hertz (cycles per second), but in some other countries both the ringing voltage and frequency can be quite different, causing equipment designed for the North American standard to not ring properly. Even with a VoIP adapter set to the correct voltage and frequency (not all are; it’s left to the provider to set those parameters on some devices), most VoIP adapters are only rated at 3 REN or less.

Ring Voltage Booster II™

Recently I discovered that Mike Sandman Enterprises has started offering their Ring Voltage Booster II™ – this is the successor to the original Ring Voltage Booster™ that Mike has been selling for several years now, and it looked to me as though it would be just the thing to cure those ringing problems. The Ring Voltage Booster II is used in series with a telephone wire pair entering the premises (or coming out of a VoiP adapter or similar device), and it senses ringing voltage on the line and increases it (actually regenerates it) to the North American standard 90VAC RMS at 20 cycles, and increases ringing current to 7.5 REN.

I wanted to obtain a unit and try it out. I did just that and I thought I’d share the results of my test with you folks, because I was very favorably impressed with the unit. If all you want to know is whether it works as advertised, I would say that based on my experience the answer is an unqualified yes (with one very minor caveat, which I will mention in a moment).

The way I tested it was this. I had a Sipura SPA-2000 VoIP adapter which was connected to the existing phone wiring in a home where the wireline service has recently been disconnected. There was already quite a collection of phone equipment on the line, and I hung a couple of extra items on to load it down. When we got through adding phones we had the following on the line: two modern phones with warble-type ringers, three old 2500-series touch-tone wall phones with real mechanical ringers, one old 2500-series desk set with a real mechanical ringer, and just for fun, one old Western Electric 302 desk set with original ringer and ringing capacitor.

I want everyone reading to pause for a moment and consider that, apart from the fact that this 1940’s-era phone has a rotary dial rather than a touch tone pad, it works great today with the original ringer and capacitor. I’ve had several computer power supplies fail on me in recent years, usually within a year or two of purchase, due to bad capacitors (in a couple cases, exploding capacitors!). For all the bad things about the old Bell System, they sure knew how to build a telephone that would survive just about anything, except the elimination of switching equipment that accepts rotary dial pulses.

Anyway, I had the aforementioned relatively huge load (well above 3 REN, no matter how you count it) hooked up to the Sipura SPA-2000, and I placed a call to it.

And darned if the phones didn’t ring!

I stood there open-mouthed for a moment. Granted the ringing was a bit weak, but all the phones were ringing. I really hadn’t expected that. I could tell I was putting a significant load on the SPA-2000, but not enough to make a very noticeable difference in the quality of ringing. Then it dawned on me – I remember reading somewhere that early Sipura adapters were conservatively rated, but such was not necessarily the case with their successor, the PAP-2 from Linksys. Well, I have one of those, too.

So I disconnected the SPA-2000 and hooked up the newer PAP-2, and placed a call to the PAP-2, and did that make a difference! With the same load as described above, the phones were still ringing, but they were really struggling. The W.E. 302 and one of the new warblers were having the most trouble, both giving only partial rings. The others were ringing very anemically.

I then inserted the Ring Voltage Booster II™ and placed several test calls. The ringing was clear and strong, in fact, each phone rang as if it were the only phone on the line, and the ringing seemed loud and crisp on all phones. Granted this is a bit of a subjective observation since I was, after all, listening to mechanical telephone bells ring, but I grew up with those and I know what they sound like when they are ringing as they should, and these were.

There were two other things I wanted to observe. One was whether the unit interfered in any way with Caller ID. Only one of the phones in this test had a Caller ID display, but it got the correct Caller ID information every time. The other thing was whether it would have any problem with a distinctive ringing signal, and again, I can report that it did not. I happen to have that adapter programmed so that when a particular friend calls it rings with a distinctive ring, since this particular friend seems to have a peculiar form of psychic ability – he always seems to call when I am indisposed (usually in the bathroom or some such thing). So if it rings with his ring, I know I can wait until I’m through with whatever I’m doing, then call him back and share a laugh over yet another occurrence of his weird form of E.S.P. So, in order to test distinctive ringing, I called him and asked him to call me back and let it ring, and once the ringing commenced I checked several phones and all were ringing with the correct distinctive ring cadence (two approximately one-half second rings followed by a one second ring, or at least that’s what it sounds like). Also, I could hear a relay inside the Ring Voltage Booster II™ clicking on and off in time with the distinctive ring patterns.

In fact, the unit worked perfectly, save for one very minor nit: Sometimes, if I picked up a phone during a ring, it would continue to apply ringing voltage for the duration of that ring – in other words, it didn’t seem to always sense that the phone had been picked up and stop the ringing until that ring had ended. In all fairness, I’ve seen this happen before with other types of equipment, including real phone switches (particularly on long loops in rural areas, etc.). What this means is that if you pick up the phone at the very start of a ring and press it to your ear immediately, you could get a pretty loud buzz in the ear for a second or so. I don’t think this will be a major issue for most users, particularly since the unit solves a much greater problem (phones not ringing at all, or ringing very weakly). But for a few people, it might be an annoyance (Edit: One way to reduce this would be to always use a ring pattern that has rings that are one second long or less.  Some VoIP providers will let you set a “distinctive ringing” pattern for each line or each incoming number – if you pick one that has a two or more short rings instead of a single long one, you greatly reduce your chance of hearing the loud buzz when you pick up the phone.  Now that I think of that, I’ll bet that explains why many independent telephone companies used one-second long rings, instead of the two-second rings common in the Bell System).  I don’t know if this was an issue with just the unit I was using, or with all of the units of this model, but it was the only thing I noticed about the unit that wasn’t “perfect” – in every other way, it delivered all you’d expect from such a device.

There are a couple of other pleasant surprises about this unit. Neither the unit itself nor its power supply seem to generate excessive heat in normal standby mode (I did not test an extended ringing cycle lasting several minutes or more, because that would have required shutting off voicemail) – in fact the small “wall wart” was very cool to the touch a couple hours after being plugged in. That’s more than I can say about many of the “wall wart” power supplies i normally use, and as you know, heat is wasted energy, so I’m very happy that Mike is including what appears to be a quality power supply. But what really shocked me was the small size of the unit. Perhaps it’s because I’m an “olde pharte” that equates a ringing generator with, at the very least, a large steel box hanging on the wall in a basement or phone closet, but this thing blew me away because it’s even smaller than any of my VoIP adapters! The longest dimension on it is only about three and a half inches. You’re almost certainly not going to have any problem finding a place to put it.

Hookup couldn’t be simpler, but you must observe that you get the connections right to avoid damaging the unit – in other words, don’t connect the side that’s supposed to be connected to the phones to the incoming phone line, or you will damage the unit. There are only three connections, one for power, one for the incoming line (labeled “line in” – this is the side you’d connect to a VoIP adapter), and one to go to the phones. If you are connecting it to a VoIP adapter you can probably do it in under a minute, once you have it out of the packaging.

In summary, if for any reason you don’t have enough ringing voltage or current on your phone line (or coming out of a VoIP adapter) and you need to boost it, this is the unit that will do it, at least up to 7.5 REN. And if you have a ridiculous number of phones on one line, remember that you can connect some of them before the Ring Voltage Booster II™ (using the original ringing voltage and current from the line or adapter) and the rest after (using the regenerated ringing current from the Ring Voltage Booster II™).

One caveat, this unit does not increase the gain (circuit loss), talk battery, or loop current of a line – if you need to boost loop current then Mike sells a separate Loop Current Booster™ that will do that. But the Ring Voltage Booster II™ basically gets out of the way when the phone isn’t ringing, and should not have any effect whatsoever on transmit or receive volume levels.

Mike Sandman has been selling quality phone equipment for many years now, so I expected this to be a quality unit. Even so, I was very favorably impressed with it. If you have problems related to low ringing voltage or current, get this device. If you have problems related to wrong-frequency ringing current (something that’s putting out ringing current at a frequency other than 20 Hertz), I’m pretty sure this will solve that problem as well, though I did not test that personally. Here is one more link to the page that describes this unit (and some others) and please note this is a plain-vanilla link – I’m not making any commission or anything if you buy one. I hope this review helps someone that’s having a problem getting their phones to ring!

Disclosure:  I have not been and will not be paid anything for writing this article, and I do not receive any commission or other compensation from sales of this item, and the links in this article are not affiliate links.  I did, however, request and receive a complementary Ring Voltage Booster II™ for review purposes (which I was allowed to keep after writing the review, and for that I am most grateful).