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.
<p>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</p>
<p>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.</p><p>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.</p><p>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.</p><p>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.</p><p>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.</p>
Great project! <br> <br>I have been trying running google voice on RPI too.. But it keeps giving &quot;googlevoice.util.LoginError&quot; error. As I googled it I saw that It is a common problem but i couldn't solve it for raspberry pi. <br> <br>Have you encouraged this problem? How did you solve it? <br> <br>Thanks.
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.<br><br>In settings.py set LOGIN to &quot;https://accounts.google.com/ServiceLogin?service=grandcentral&amp;passive=1209600&amp;continue=https://www.google.com/voice&amp;followup=https://www.google.com/voice&amp;ltmpl=open&quot;<br><br>Is the solution that worked for me, I think.
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! <br> <br>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!
I use the &quot;you don't need a computer&quot; version of Magic Jack, so it doesn't even plug into my WIndows computer (they don't make a Linux version, btw).<br><br>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.<br><br>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
Thank you so much!

About This Instructable


93 favorites


More by mrmath: Running an HD44780 Display off the ATmega on a Gertboard Voiceberry Pi! Driving an HD44780 Display using a Shift Register and a Raspberry Pi
Add instructable to: