PIONEERS Rube Goldberg Google Voice Forwarding

accountingnerd

New Member
Joined
Mar 17, 2011
Messages
6
Reaction score
5
Here's a little python script that I hacked out to do automatic switches to Google Voice forwarding for my wife's smart phone. She wanted a smart phone so that she could run some apps, but didn't want to spend money on a data plan (or minutes for that matter) because she is mostly at home with a strong WiFi connection. Thus, I needed a solution that wouldn't depend on a data plan to make changes to her Google Voice settings (like Groove Forwarder), and came up with this. I scheduled this to run every five minutes, and so far, it's worked pretty well.

A couple of external dependencies make this possible. Her phone is set to always have the WiFi on, even when sleeping. We lose some battery life by doing that, but the inconvenience for us is minor. I'm also able to do this because her phone has a reserved IP address in the DHCP server, and so the phone always has the same IP address. Now when she's at home, the home phone rings, and when she's away, the cell phone rings.

Code:
#!/usr/bin/env python
# Created by Aaron J. Clark, CPA.CITP.
# [email protected]
#
# License:
#
# This Package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This package is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
#
from googlevoice import Voice
import os
 
voice = Voice()
 
#replace with your credentials. 2-factor authentication recommended
voice.login("[email protected]","password")  
 
# ping her phone to see if she's home
response = os.system("ping -c1 192.168.X.X") #Change to the IP address of the device you are pinging
 
if response == 0:  #means that she's connected to the WiFi at home
    for phone in voice.phones:
        if phone.name.strip() == "Cell": #Change to your phone's name in Google Voice
            phone.disable()
        elif phone.name.strip() == "Home Phone": #Ibid.
            phone.enable()
       
else:  #She's out, so forward calls to her cell, and stop forwarding to the house.
    for phone in voice.phones:
        if phone.name.strip() == "Cell":
            phone.enable()
        elif phone.name.strip() == "Home Phone":
            phone.disable()
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Just ordered a Red (to freak out my Apple friends) $119 GooPhone i5C from China which looks like an iPhone 5c but runs Android under the hood over Wi-Fi. Your script will be the perfect addition. Thanks.

 

accountingnerd

New Member
Joined
Mar 17, 2011
Messages
6
Reaction score
5
Glad to share it. Love the new phone. Wonder which colour I should chose... :)
 

kenn10

Well-Known Member
Joined
Dec 16, 2007
Messages
3,764
Reaction score
2,173
Just ordered a Red (to freak out my Apple friends) $119 GooPhone i5C from China which looks like an iPhone 5c but runs Android under the hood over Wi-Fi. Your script will be the perfect addition. Thanks.



I wish they had one that runs on the Verizon CDMA or LTE network. It looks like they are mostly geared for the European markets. They might run on T-Mobile's HSPA+ network and the AT&T 2G network.
 

Members online

No members online now.

Forum statistics

Threads
25,782
Messages
167,509
Members
19,203
Latest member
frapu
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top