I’m not sure when I first heard about Asterisk, maybe it was at the Gotham Ruby Conference–many, many years ago. If it wasn’t there, it couldn’t have been much earlier. Ever since, I’ve wanted to check it out for fun, but never followed through. A Hackaday post, the desire to make our landline usable again as well as the absolute need to call the living room from the office combined to push me into action on this project.

The Problem

Beyond just having some fun and maybe learning something, there were two main things to solve here: 1) Make the landline useful again and 2) Intra-apartment calling. You may ask “Why not just turn off the landline and yell between the rooms of your little apartment”? These are, indeed, simple solutions to these high-class “problems”. But, where’s the fun in that? I know, phones, not everyone’s idea of fun–to each their own.

The landline–kept mostly for sentimental reasons and the fact that is has a very desirable, 212 area code–wasn’t getting used anymore. Over the years, the mobile phones supplanted it and the only incoming calls were telemarketers and politicians. After a couple late-night calls, I just forwarded the number directly to voicemail, so it didn’t even ring through anymore. So sad.

As for intra-apartment calling, polling showed that 50% of residents rated this feature “very important”. The other 50%, by the way, are just tolerating this project. Honestly, this isn’t that important, but it’s kind of cool/ridiculous. However, by setting this up, each of the phones can be dialed separately from outside as well. Useful for things like, maybe, a business line.

The Solution

The idea is that all calls go to the auto-attendant which answers with a very simple greeting like “hello, press 1 to connect”. If they follow the instructions, the phones ring, otherwise, it just hangs up. This should be enough to end the robocalls, but won’t thwart human telemarketers. Although, we don’t seem to get the latter anymore. We’ll see how it goes, if they become a problem, additional measures can be taken.

This is a simple system as PBXs go: A server, DID number, auto-attendant, voicemail and two analog extensions. An old Raspberry Pi was pressed into service as the server and we already had two analog phones. Only an analog telephone adapter needed to be purchased.

Not knowing where to start with the setup, I turned to Asterisk: The Definitive Guide and followed it step-by-step through the Dialplan Basics section. If you use this online version of the book, know that it is an old edition for a previous version of the software. Use the latest versions of everything when installing and understand that there are some key differences in syntax etc. that you’ll need to work around. I found the book to be very helpful in getting something working quickly that I could configure through trial and error–all part of the fun.

In addition to configuring the server, other devices will also need some attention. In order for inbound and outbound calling to work, you’ll need a SIP provider. There are a lot of them out there, the one I used is mentioned below. For inbound calls to work consistently, some port forwarding will be necessary assuming your server is behind a firewall. You’ll also need to set up your analog telephone adapter and/or IP phones. I suggest setting up some protection on your server from brute force attacks, see the lessons learned below.

This ended up being a short and satisfying project. In all, most of this was completed in an afternoon and a couple evenings. Now it’s up and running and I’m using it to see if there are any tweaks needed. In the future, I might come up with some other amusing things to do with this system. Asterisk is very extensible, so the sky’s the limit and there are some very interesting projects out there for inspiration.

Resources

  • SIP Provider: voip.ms
    So far, so good with this provider. They are very inexpensive and responded promptly to my support request. What more can you ask?
  • Analog telephone adapter: Grandstream HT802
    Inexpensive with a good, web based, configuration interface. It also supports pulse dialing, important for those of us using rotary phones.

Lessons Learned

  • Web searches don’t always yield the correct answer
    Yes, we all know this. I mention it here because Asterisk has been around for a long time. The problem you are having is probably not unique and there are likely several different answers to be found. However, some of those might be old answers for old versions and will no longer apply. Check the dates on the posts and cross reference with others.
  • Don’t be afraid to contact support
    Tech support can be less than helpful sometimes. But, if you feel like you’ve tried everything and still can’t figure out why something isn’t working, open a ticket if you can. This was learned while trying to get outbound calling. Everything seemed to be set up correctly, but it just wouldn’t work. Turns out I wasn’t setting the CallerID correctly.
  • Protect your server
    Only a couple ports are open on the internet router to this server, but within a couple hours, it was getting absolutely hammered with SIP requests. Setting up fail2ban stopped this in short order. Manually configuring a firewall on this server would work just as well.

Comments are closed.