IP04 Progress

Since I wrote my "IP04 and Me" blog post, I've made remarkable progress. My home phones now run completely under the control of the IP04, and I have that virtual receptionist I've been working towards.

To recap, I have a standard POTS home telephone line from Bell Canada, and telephone extensions on three floors of my house. In the beginning, the POTS line connected, in a daisy-chain fashion, to all the telephone extensions. The extensions could only call out on the POTS line, one at a time.



Then, I bought the IP04 from Rowetel, and started experimenting. First thing was to hook up the IP04 to my phones. The single FXO port of my IP04 would connect to the POTS line, while the three FXS ports would connect to each of the three telephone extension runs. Now, each extension was independent of the rest, and the incoming POTS line was independent of all the extensions.



Imagine the possibilities. I could now have extension calling extension, filter incoming calls, and control outgoing calls. The variations were endless. After some experimentation, I settled on a relatively simple plan in two parts:
1) The IP04 would answer all calls incoming from the POTS line, and attempt to filter out telemarketers. Calls received at "inconvenient" times (dinner time, during my favourite tv show, after bedtime, etc) would go straight to voicemail, while all other calls would ring all the extensions, so that someone could answer the call.
2) The IP04 would treat each household extension phone as a separate entity, and permit each phone to call any other phone, and to dial out on the POTS line. To call an outside telephone number, you would simply dial the number, just like you would have if you were directly connected to the POTS. However, to call another extension, you would dial a special phone number, one per extension.

The Receptionist

So here goes. I want the IP04 to act as a receptionist, and filter incoming calls. As befitting a household that can afford to employ someone to answer the telephone, I wanted to script this receptionist to seem to be a butler or secretary in a grand house. This receptionist would

  1. Pick up the incoming call
  2. Play an introductory fanfare (the "SIT", which informally heralds a disconnected line and might reduce the number of telemarketer calls I get),
  3. Answer the phone with a time-appropriate greeting ("Good Morning", "Good Afternoon", or "Good Evening"),
  4. and, if so permitted by the household, ring the call through to the extension phones.
  5. Should no one pick up the call, and if so permitted by the household, the receptionist would offer the unsuccessful caller an opportunity to leave a message in the household voicemail.
  6. Should the caller still remain on the line at this point, the receptionist would bid the caller "Goodbye", and hang up the phone.

The Extensions

But, it isn't enough to just accept calls from the outside; I needed to give my extensions the ability to call out, and call each other. And, while I worked that little task out, I added more to the IP04; I added two internal SIP voice-over-IP extensions to the mix. Now, the IP04 not only supported the incoming POTS line and three wired telephone extensions, but also provided services to two VoIP "telephones" on my LAN.



Now, my plan was to permit the extensions to call out, and call each other. This meant more work on the Asterisk dialplan.
First off, I gave each extension (physical and VoIP) its own "context"; it's own set of rules as to what it could call and how it would dial. This would permit me some later flexibility in control over the types of calls each phone could make.

So as not to confuse the "users" of my telephone system, I set up the dialplans so that, to reach a phone on the PSTN, you simply dial the number, as you would have without the IP04 managing the telephones. Since I live in North America, the "North American Numbering Plan" applies, and my area uses a 10-digit dialing scheme. Thus, my dialplan transparently handles dialed

  • 00 and 0 operator assistance numbers,
  • x11 assistance numbers,
  • 101-xxxx and 950-xxxx alternate long distance carrier numbers,
  • local 10-digit-dialing numbers,
  • 1-800-xxx-xxxx and similar toll-free numbers,
  • 0-xxx-xxx-xxxx and 1-xxx-xxx-xxxx long distance numbers, and
  • 011-xxxxxxxxxxxxx and 01-xxxxxxxxxxxxx international long distance numbers

Additionally, the dialplan handles calls between extensions by providing numbers that start with the octothorpe. Thus, dialing

  • #0 connects to my internal voicemail,
  • #1 connects to the Kitchen handset,
  • #2 connects to the Bedroom handset,
  • #3 connects to the Basement handset,
  • #40 connects to my SIP phone, and
  • #41 connects to the Guest SIP phone

The dialplan that handles the Guest SIP phone does not permit direct-dialed alternate long distance, long distance or international calls; if my guest wants to make a costly call on my dime, they have to ask me first. I could apply the same rules to the Bedroom phones as well; with the Asterisk PBX on the IP04, I could even include time-dependant rules that would (for instance) prevent long distance calls at any time, or (even) any outgoing calls from the bedroom phone after 9PM. Thankfully, I don't need that feature yet.

Long Distance

But, why stop here? One of my peeves about Bell Canada is the high cost of long-distance calls. Without a "long distance plan", Bell charges around $0.60 $0.90 per minute for an outward-dialed long distance call to an NANP number, and even more for calls to international numbers. I don't make many long distance calls, so the cost of a Bell "plan" would vastly outweigh the benefit I would get in lower long-distance rates (I've checked), and the other dedicated-line "home phone" providers have similar costs. To get a rate that would be economical for me, I would have to switch to a VoIP provider.

So, that's what I did, sort of. I contracted with a VoIP provider for an outward-dialled connection (using the Asterisk IAX2 protocol) that costs $0.01 per minute for North American long distance calls.



A minor change to my dialplan, and now the IP04 routes outward-dialed long-distance through my VoIP provider, rather than through Bell Canada. One advantage to having this VoIP contract in place is that the IAX2 trunk can handle multiple simultaneous calls; I can talk to my cousin in BC while Terry talks to her sister in Montreal. One cost, one trunk, multiple calls. I could even contract with the VoIP provider for a second telephone number, routed inward from the PSTN through their network, so that we can handle multiple simultaneous inbound calls.

Being Held Accountable

One thing I could not get from Bell Canada was a complete accounting of all the telephone calls made or received at my telephone number. Apparently, it would take a Court Order to Bell to find out, on paper, who called me, and who I called. I found it interesting that Bell has no problem telling me who I called long-distance at sixty ninety cents per minute, though.

Asterisk can keep record of all calls, their origin and destination, the date and time they were made, and how long they lasted. A bit of ftp magic, a small MySQL database, and a bit of scripting, and the IP04 now tells me, on a daily and monthly basis, what calls were made, when and who they were made to, how long they lasted, and even (with a bit of back-end computation) how much they cost me. It took just a little programming expertise to create the sort of report that Bell couldn't (or wouldn't).