Instructables
This instructable is the final one in the series, leading up to the Voiceberry Pi!

I work from home as a computer consultant.  I spend a good deal of time on conference calls, and needed a second line to handle these calls.  I explored my options, and decided to go with Magic Jack.  You know the adds.  Phone service for just $19.99 a year. That's $1.70 a month. WIth Magic Jack.

The quality is good, and the product works. But, to cut down on costs, they don't let you dial toll numbers to conference calls (if they know about it).  Many of my conference calls only have toll numbers, so I needed a way to around this limitation.

Enter Google Voice.  At first I thought about using my USB headset to make calls using the VoIP features of Google Voice, but the quality wasn't that great, and people complained. But I found out that you can make Google Voice call your phone, then connect you with another phone, anywhere in the US, for free.

So, I started doing that.  If I needed to call a toll conference call, I'd tell Google Voice to call it, but connect it to my Magic Jack number.  My phone would ring, I'd pick up, and then I'd hear ringing on the other end.  It was as though i called it directly, but Google Voice did it for me. Perfect.

Except it is a pain in the butt to log into Google Voice every time I need to make a call.  Enter Voiceberry Pi.

Voiceberry Pi, when complete (it's in an alpha stage now, but worthy of an instructable all the same), will be a small appliance that sits on your desk, and is much like a phone.  It will allow you to dial a phone number, like you would on a phone, and then it will tell Google to connect that call using your phone.  Google Voice will call you, and you are connected to your line.

Other features for the future, and some gotchas will be detailed in the final step.
 
Remove these adsRemove these ads by Signing Up

Step 1: Hook up the Display Part 1: The Shift Register

Picture of Hook up the Display Part 1: The Shift Register
The first step is to hook up a display so you can see what you're dialing and what you're doing.  Before that can be done, because of a limited number of pins, I like to hook up a shift register to drive the display.

You can follow the steps in my other instructable on hooking up the shift register, then come back here.

Step 2: Hook up the Display Part 2: Adding the Display

Picture of Hook up the Display Part 2: Adding the Display
The next step is to actually hook up the display.  My instructable on running an HD44780 based display covers this in detail.  Hop on over and follow that setup, then come back for the next step.

Step 3: Adding the Keypad

Picture of Adding the Keypad
You can't dial without a keypad.  This instructable, also mine, details how to do just that.  Although the GPIO pins used in the Voiceberry Pi are different, the end result is the same.

Step 4: Pulling it all togehter with code

Attached is my code to make this run.  It's built using pygooglevoice, a pretty powerful interface between Python and Google Voice.  Login credentials can be stored directly in the pygooglevoice settings, which they are in my case.  That's why you won't see them in the code.

I would love to show a video of it working, but it's going to have my actual phone numbers, and I don't want them out on the web.  I trust the actual instructables folks, but given how targeted we are for SPAM, I don't want to give them out here.  Nothing personal.

How it works:

The code first logs in using credentials stored in the pygooglevoice library.  While that is happening, "Logging In" is displayed on the screen.  Next, it waits for user input, displaying "Waiting".  If you press the "*" key on the keypad, the display changes to "Dialing", and you are in dialing mode.  Dial the phone number to call, and if you make a mistake, hit the "*" key again to clear the number.  When you've dialed the number, press the "#" key to place the call, and the display updates to "Calling". When the call has been placed, the display updates to "Call Placed", waits a short time, and then goes back to waiting.

Your call gets placed using Google Voice, to the phone number you've configured in your account. Errors in logging in or connecting are displayed as well, if necessary.

Step 5: Next steps, new features, and thoughts

Picture of Next steps, new features, and thoughts
To start with, the code runs at 100% CPU usage, which is unacceptable.  I need to find a way to cut down on that, and still have the thing function.  Not sure how I'm going to do that, to be honest.

Next, of course, would be to put this into some sort of permanent home, and not just have wires lying on my desk.

The code currently has no functionality to cancel the call. Once you start dialing, you need to finish the process.  That needs to be added to the code.

I'd like to use a bigger keypad, more like this one.  The added buttons would make it easier to use--Press A to start dialing, and B to place the call. That kind of thing.  Also, it's a straight 4x4 matrix, and comes with the 8 header pins already in place.  A much better solution, but it cost more than the two keypads I got combined.

I'd like to explore other features of Google Voice.  Perhaps hookup a speaker to the audio out of the Raspberry Pi, and play back voicemail. Or check for incoming SMS messages (outgoing would be tough on this small keypad, but then again, it wouldn't be impossible).

There's a ton of features that can be implemented.  The fun has just begun!

Step 6: Updates: A living instructable (11/3/12)

I am so happy that this instructable won me a prize, I've desided to revisit it, and update it with changes I've made.  Two quick changes this morning

  1. I added a sleep statement at the beginning of the loop.  The logic is "If state=waiting, then wait 1 second."  This means I have to hold down the * key to start dialing, but it's a small price to pay to go from 100% CPU utilization to 25% utilization.  Code:

    if (state==waiting):
      time.sleep(1)
     
  2. I added the ability to stop dialing.  Previously, while waiting, you'd press * to start dialing, then if you made a mistake, you'd press * again to start dialing all over again.  I've added some code that checks to see if there is a current number in the buffer.  If there is, it will reset dialing, but if not, it will go back to waiting.  Code:

    ...
    elif (state==dialing):
      if (keyPressed=="*"):
        if (string1==""):
          state=waiting
          showStrings("","Waiting")
        else:
          string1=""
          showStrings("","Dialing")
So that's two things that I was able to "knock off my list" of "what's next" from the last step.  There might be more coming!
1080pete6 months ago

I've been using magicJack for a few years now and like it overall. I switched my business number over to mj last year but am totally overkill by running it on a Mac mini. But today I thought of using a Pi and that led me here. Will following you instructable allow me to use the Pi with MJ even if I don't use the Google Voice? Really hope so. Thank you

mrmath (author)  1080pete6 months ago

This doesn't use the MagicJack directly on the RPi, unfortunately. It allows you to dial a number and have the RPi connect with Google Voice, telling Google Voice to call your MagicJack number, and connect you to the number you dialed.

Let's say your MJ number is (123) 456-7890, and you want to call a conference call at (987) 654-3210. You try to call that directly on your MJ, and you're told you have to use MJ's conference call system. You have no control over where the call is hosted, so you can't do that. You need to get through to (987) 654-3210.

This system lets you dial that number, then connects to Google Voice, tells Google Voice to call your MJ at (123) 456-7890, and when you pick up, to then connect you to (987) 654-3211.

Basically, your MJ line will ring, and when you pick up, you'll hear ringing, and then you'll be connected to the conference call.

You can do this directly with Google Voice on the web, but that requires the extra step of connecting to the website. This system lets you have a dial pad on your desk, ready to go.

tremo2 years ago
Great project!

I have been trying running google voice on RPI too.. But it keeps giving "googlevoice.util.LoginError" error. As I googled it I saw that It is a common problem but i couldn't solve it for raspberry pi.

Have you encouraged this problem? How did you solve it?

Thanks.
mrmath (author)  tremo2 years ago
I did encounter the problem. I came across a fix for it where you have to make a change to the URL for the authentication.

In settings.py set LOGIN to "https://accounts.google.com/ServiceLogin?service=grandcentral&passive=1209600&continue=https://www.google.com/voice&followup=https://www.google.com/voice&ltmpl=open"

Is the solution that worked for me, I think.
Ceralor2 years ago
This project is pretty awesome! I've been pondering a dialpad built into my Vonage box, but it's pretty limited. This project seems like a pretty awesome way to also build a SIP phone of sorts potentially with a speaker and all, a cheap-as-hell SIP phone. Nice job!

The only thing I could think of that'd also be cool is being able to use your Magic Jack with Linux on the Pi, but I highly doubt the project's built in any sort of Mono-compatible language you could run it under. Still a neat idea, too bad WINE isn't ARM-compatible!
mrmath (author)  Ceralor2 years ago
I use the "you don't need a computer" version of Magic Jack, so it doesn't even plug into my WIndows computer (they don't make a Linux version, btw).

I've thought about the SIP phone solution, and that's where I really would like to go. USB Headset and what not. I tried getting some stuff setup, but couldn't get it working so I settled on this.

I could include listening to voicemail via a speaker, I think. The pygooglevoice code allows for downloading voicemail as MP3s, so it shouldn't be that hard.
this project is awesome, great use the pi and very original! great documentation as well. excited to see version 2
mrmath (author)  amandaghassaei2 years ago
Thank you so much!