⇥ iPhone + Asterisk = free long distance
Like many a small business, MTA uses VoIP for its phone services—after all, our employees are all over the place, and POTS lines just wouldn’t do it. Through the clever combination of VoIP and Asterisk, the phone bill for the entire company still comes in at under $50 a month.
Plus, Asterisk gives us a number of advantages when we’re on the go. For example, we use a DISA to cause our PBX to bridge a new line into an incoming call, thus allowing us to make long-distance calls from any phone by paying only our incoming and outgoing rates—given that 1-800 service costs us around $0.03 a minute, and outgoing long-distance service costs around $0.02 a minute, $0.05 a minute sounds like a very attractive rate when you’re away from home and need to make a call; all you need is a payphone and you’re in business.
DISA works well from cell phones, too—but here there are a few pet peeves. A DISA call requires me to make an outgoing call (which is always billable on my cell phone plan) to the office, dial a special code and then dial the phone number I want to reach… and my memory for phone numbers isn’t all that good. The fact that I can’t seem to dial a number from my address book while I’m on a call really irks me: the data is there, the technology isn’t that complicated, and the only reason that I can think of why this wouldn’t be allowed is that telephone companies don’t want it to… which, to me, sounds like a really good reason why it should.
Asterisk to the rescue
Thus, I have been thinking of coming up with a solution that solves all these problems—with the possible added benefit of sticking it to the phone company*. Yesterday, I finally had a couple of hours to spend on it, and this is what I came up with.
First, I have a small PHP script that runs on one of our servers. The script takes a phone number in input (as well as a shared secret in case someone gets a hold of the address) and then creates a small call file, which is sent to Asterisk. The call file, combined with a specially-built context, instructs Asterisk to:
- Set its Caller ID to the outgoing phone number
- Call my cell phone
- Upon pick up, play a simple voice messsage (“Press 1 to complete your call”)
- When 1 is pressed, initiate a call to the outgoing phone number
- Bridge the two calls
Item #1 on the list is mostly a nice touch—by setting the CID to the number I’m trying to dial, I can still have a meaningful record of the conversation in my iPhone’s call log. Items 2 through 4 call me cell phone (incoming calls are free, you see) and then wait for some action on my part; this ensures that, should I fail to pick up or the call go to voicemail, the person I want to call doesn’t end up getting into an argument with my recorded messages. Item #5, finally, completes the bridge, thus giving me a completely free call to either an internal MTA extension or an arbitrary external number.
On the iPhone
So, far, there is nothing special about my set up. I can now make phone calls simply by invoking a script through HTTP—something that can easily be done from an iPhone without the need for anything more than stock software: I could just use Safari to call up the script and be done with it.
However, this doesn’t directly solve the problem with being unable to dial from my address book. This is where the couple hours of free time last night came into play. Armed with the GM release of the 3.0 SDK, I wrote a little application that allows me to initiate a bridged call either by dialing a number or by calling up my address book, and then selecting a contact and a phone number:
Clearly, this app is not going to make it to the App Store any time soon, but it’s a great little thing to have for me and the rest of the staff.
* I don’t usually advocate sticking it to anyone—but, unfortunately, for the phone company, I happen to know what their operating costs are, and am fully aware of the fact that they are, indeed, sticking it to me with their $0.30 per minute (plus another $0.20 for long distance) rates. Therefore, it is only fair to return the favour.