Raspberry Pi - FreePBX - Home VoIP network, for my children

Raspberry Pi - Home VoIP system

VoIP Phone in use

I've had the need to have a little experiment with VoIP phones recently.
(Voice over Internet Protocol - Phone calls via your computer/network.)

After doing a little research I decided the easiest thing was to do was grab a spare Raspberry Pi and find some VoIP phones to test with.

-

Note: I have a "few" Raspberry Pis around the house, most in use, some just "there"... just in case.
(They are crazy handy to have around, I find myself using them all the time when odd problems arise.)

I initially thought this was going to be a simple project. Up until I introduced the Cisco VoIP phones it was - Soft phones worked nicely... Then I managed to hit nearly every hurdle possible.


FreePBX on a Raspberry Pi:
I used the website http://www.raspberry-asterisk.org/ for my base FreePBX/Asterisk install - it covers everything I needed from a basic VoIP solution. I don't need to re-hash these steps.

I tested this basic setup using Zoiper for Android and IOS and it didn't take long at all to make some test calls between these soft-phones.

***NOTE***
The latest version of FreePBX uses port 5160 for the SIP port, not the traditional port: 5060
***NOTE***


If you're just after a simple system, with the VoIP client running on your PC/Laptop/Phone then you're pretty much done.
(If you want to make external calls you will have to get a SIP trunk from a provider, but you can test 0800 numbers using the bundled STAR Communications Trunk that comes with the install)

---

Hurdle # 1:
Powering these older VoIP phones:
I bought a few of the Cisco 7940 VoIP handsets from ebay, they were only £10 each but didn't include power etc - they're PoE... that's not a problem I had a spare PoE injector to reuse.
Purchased from: http://www.pironnetworks.com/

While I waited for them to arrive I did some research on the handsets and found that predate the PoE standards (802.3af / 802.3at) and therefore couldn't work with PoE switches and injectors... Doh!

I knew the units would be receiving power from the Ethernet cable and that the data lines would have to be "normal" meaning there must be something strange going on with the spare wires.
Knowing this I was able to find some articles with details on these handsets - Cisco wired them with the power wires reversed.
A very excellent post here: http://www.eines.info/?p=1737 covers the details.
The important bit:
Make a short cable that has "traditional" wiring one side and the switched power wired on the other - if needed, just use a coupler to connect this to your cabling

Now your 7940s should be powered and, if like mine, just sit there waiting in SCCP mode for a config to be applied.


Hurdle #2:
DHCP at home - No options:
I have a home network and I'm kind of happy with the router I currently have from my ISP... it's fast and has a few bells and whistles etc (but no SNMP access... grr) and like almost all home router based DHCP servers it doesn't offer access to the DHCP options.
DHCP options allow you to control many aspects of what extra information is provided to DHCP Clients - the most common being TFTP Server and Proxy configs.

In order to run these phones you need to have a TFTP (Trivial FTP) server running and clients have to know what IP to connect on.
On a PC etc you can just TFTP to any IP and pull configs etc, but these phones are dumb dumb dumb - they start up, find a DHCP address and try to pull from the TFTP server provided in the DHCP options.
If you don't use DHCP and/or don't have a TFTP server configured it won't work...

So from here I decided to sever my VoIP network from my home network, creating a separate network just for VoIP that can't get out - as I'm using this for my Children this works very well in providing that air-gap that stops any accidental outgoing calls etc :-)

I turned the Pi into a DHCP server

Install DHCP server:
I've previously used Adafruit's tutorial to install and DHCP server on the Raspberry Pi.
If you follow the DHCP install/Config steps you should be ready to add the DHCP options for TFTP:
https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software



DHCP Option 150:
I used various sites to get the DHCP options for Cisco VoIP phones right. You should only need to add option 150 for Cisco phones:
https://askubuntu.com/questions/267796/how-can-i-configure-isc-dhcpd-to-provide-option-150-for-cisco-phones

Make sure you do NOT substitue "{ ip-address }" for you IP address... I did and things didn't work till I fixed it. Oops.
 
option voip-tftp-server code 150 = { ip-address };


Now, with the Pi, a switch and a VoIP handset you should now be getting an IP and an error similar to "TFTP Timeout" or missing config.

(If you'ew still having problems or aren't using Cisco phones, you might need to add option 66 too)

Hurdle #3:
The Free endpoint manager:
This took longer than I'd have liked - I got distracted by the commercial version and began worrying that the commercial version was now the only option - thankfully it isn't.

From Admin -> Module Admin you can install the "OSS PBX End Point Manager"

* You need to have MONGODB installed for OSS to work:
apt-get install mongodb

Configuring the End Point Manager:


Connectivity-> OSS End Point Advanced Settings

Under "settings" make sure you configure your paths to each application.
I didn't have NMAP installed (apt-get install nmap)

Add the relevant Firmware:


Connectivity-> OSS End Point Package Manager.

  • Check for updates
  • Install the firmware required for your devices.
Create your extensions. (Applications -> Extensions)
Scan for VoIP devices: Connectivity-> OSS End Point Device list -> "Search" button.
Associate the device with the extensions.
Save
(Apply)


Hurdle #4:
DO NOT install another TFTP Server:
While trying to get everything running I thought the system didn't have a TFTP Server installed and running (the problem was because the DHCP options weren't correct.)
So I installed another TFTP Server, thinking it was the only one I was installing - this caused a TIMEOUT problem when the phone tried to pull it's firmware and config - I used TCPDUMP to confirm the traffic was getting thorough, it just wasn't doing anything.

I removed that second TFTP Server and on the next boot the phone started pulling its new firmware!
After a few reboots of the handset as part of its firmware install I had a working SIP handset. Well ALMOST working.

Hurdle #5:
SIP port change:
The latest version of FreePBX/Asterisk has changed CHAN_SIP to use port 5160 instead of the usual 5060.
This means that the config files created by the End Point Manager (EPM) all have 5060 - a quick edit in your favourite editor and another phone reboot you *should* be working. (should... unless you get stuck by the next hurdle.)

Hurdle #6:
Password too long?:
When you create extensions in FreePBX you can set the secret key/password or leave the system to do it for you, the beauty of the EPM is that it pulls that information automatically into the config for the handset so you don't have to manually edit it on the phone.
Sadly when I thought I was done, I wasn't... I couldn't make calls.
After a bit of head scratching I logged into the asterisk CLI and watched as I tried to make a call - incorrect password/authentication.
I wasn't 100% sure what was wrong, the password on the system matched the one in the file - so I just tried removing half the password, saved, edited the 5060, saved and rebooted the phone......

It worked! I got a dial tone - I was able to make calls!

1 Desk with Phone and Pi
I repeated the config for a second handset, ran a few cables and now we have a handset in each room, connected it all to a Pi that my children can use to call each other.

This saves a lot of shouting and running back and forth between rooms while they're playing on Minecraft for the Pi.

They love the phones and are even enjoying exploring the voicemail messages.

Thanks for reading this far, it's been quite a journey to get everything working.


Jeff


Update: In writing this I have found that I can change the default template for the Handset - allowing me to default the SIP port to 5160 instead of 5060.


Connectivity-> OSS End Point Advanced settings -> Product Configuration Editor (Tab)



Comments

  1. Such a wonderful idea! Thanks for sharing

    ReplyDelete
  2. I have set up a similar system, buy added intercom extensions, so from the kitchen tablet softphone on the wall, a single button press opens the intercom line to my sons phone on speakerphone and he can talk without stopping what he is doing. Essential for kids acceptance factor! To make it even more attractive I took an image of a shield from zelda converted it black/white scaled to 240 pixels (I think) then dropped it in the tftp server folder. Next boot it has the shield as his backdrop. Coolest phone ever. The system has been operational for over 12 mths, never a fault.

    ReplyDelete
    Replies
    1. That's great to hear Chris.
      Sounds like a good setup.

      I've not changed the image yet, doesn't look too hard.
      -
      The girls are enjoying being able to answer the phones etc, and sometimes getting more enjoyment out of not answering...

      Still a big hit.

      Delete

Post a Comment

Popular posts from this blog