def _SendAlertToPhone(self, phone, msg): if not self._sent_one: import code from googlevoice import Voice voice = Voice() voice.login(self.monitor_email, self.monitor_pass) voice.send_sms(phone, msg) # Send an SMS. voice.call(phone, self.monitor_phone, 3) # Call the person as well. self._sent_one = 1
def _SendAlertToPhone(self, phone, msg): if not self._sent_one: import code from googlevoice import Voice voice = Voice() voice.login(self.monitor_email, self.monitor_pass) voice.send_sms(phone, msg) # Send an SMS. voice.call(phone, self.monitor_phone, 3) # Call the person as well. self._sent_one = 1
def run(): voice = Voice() voice.login() outgoingNumber = input('Number to call: ') forwardingNumber = input('Number to call from [optional]: ') or None voice.call(outgoingNumber, forwardingNumber) if input('Calling now... cancel?[y/N] ').lower() == 'y': voice.cancel(outgoingNumber, forwardingNumber)
def call_number(sysTrayIcon, outgoingNumber): print 'in call_number', outgoingNumber voice = Voice() gmail_name = open('/installs/gmail_name', 'r').read() print gmail_name gmail_password = open('/installs/gmail_password', 'r').read() #print gmail_password voice.login(gmail_name, gmail_password) # todo #forwardingNumber = open('/installs/call_here', 'r').read#'8012408783' forwardingNumber = '8012408783' voice.call(outgoingNumber, forwardingNumber)
class GoogleVoiceLibrary: """Robot Framework Google Voice test library. Use it to make calls, download voicemail, send SMS/text messages, etc. This test library makes use of Google Voice Python library, get it at http://code.google.com/p/pygooglevoice Requires Google Voice Python library to be pre-installed to work. This Robot Framework test library does not include or install that library. """ __version__ = '1.0' ROBOT_LIBRARY_SCOPE = 'GLOBAL' def __init__(self, pUsername, pPassword): self._gv = Voice() self._gv.login(pUsername, pPassword) def send_sms(self, toNumber, message): """Send an SMS text message to given phone number. """ self._gv.send_sms(toNumber, message) def place_call(self, toNumber, fromNumber=None): """Place a call to given phone number from optionally selected phone (number) registered with Google Voice (GV) account. If GV phone not specified, it will use the default one associated with GV. Invoking this keyword will ring the selected registered GV phone, and on answer, will then proceed to call the given phone number. For test automation, we assume you have a method to automate answering the GV phone after invoking this keyword. We also assume you automate answering the call at the called party, and perhaps also do some tone, DTMF, and/or caller ID validation in the test automation. """ try: self._gv.call(toNumber, fromNumber) except err: print "Failed to place call to %s from %s. %s" % (toNumber, fromNumber, err) def download_voicemails(self, downloadPath): """Downloads all voicemails in Google Voice account to given path location as MP3 files. One can then further process the MP3s for testing purposes (e.g. analyze for tone, DTMF, specific audio; convert MP3 to proper wave audio format, etc. then do analysis as mentioned). """ try: for message in self._gv.voicemail().messages: message.download(downloadPath) message.mark(1) #mark as read except IOError, err: print "Failed to download one or more voicemails as an MP3 to %s. %s" % ( downloadPath, err)
class GoogleVoiceLibrary: """Robot Framework Google Voice test library. Use it to make calls, download voicemail, send SMS/text messages, etc. This test library makes use of Google Voice Python library, get it at http://code.google.com/p/pygooglevoice Requires Google Voice Python library to be pre-installed to work. This Robot Framework test library does not include or install that library. """ __version__ = '1.0' ROBOT_LIBRARY_SCOPE = 'GLOBAL' def __init__(self, pUsername, pPassword): self._gv = Voice() self._gv.login(pUsername,pPassword) def send_sms(self, toNumber, message): """Send an SMS text message to given phone number. """ self._gv.send_sms(toNumber, message) def place_call(self, toNumber, fromNumber=None): """Place a call to given phone number from optionally selected phone (number) registered with Google Voice (GV) account. If GV phone not specified, it will use the default one associated with GV. Invoking this keyword will ring the selected registered GV phone, and on answer, will then proceed to call the given phone number. For test automation, we assume you have a method to automate answering the GV phone after invoking this keyword. We also assume you automate answering the call at the called party, and perhaps also do some tone, DTMF, and/or caller ID validation in the test automation. """ try: self._gv.call(toNumber, fromNumber) except err: print "Failed to place call to %s from %s. %s" % (toNumber,fromNumber,err) def download_voicemails(self, downloadPath): """Downloads all voicemails in Google Voice account to given path location as MP3 files. One can then further process the MP3s for testing purposes (e.g. analyze for tone, DTMF, specific audio; convert MP3 to proper wave audio format, etc. then do analysis as mentioned). """ try: for message in self._gv.voicemail().messages: message.download(downloadPath) message.mark(1) #mark as read except IOError, err: print "Failed to download one or more voicemails as an MP3 to %s. %s" % (downloadPath, err)
from googlevoice import Voice from googlevoice.util import input voice = Voice() voice.login() outgoingNumber = input('Number to call: ') forwardingNumber = input('Number to call from [optional]: ') or None voice.call(outgoingNumber, forwardingNumber) if input('Calling now... cancel?[y/N] ').lower() == 'y': voice.cancel(outgoingNumber, forwardingNumber)
try: voice.login(email,password) except: print ('Error! Login failed.') exit(0) try: outgoingNumber = argv[3] except: print ('Error! Please provide a Number to call ') voice.logout() exit(0) try: forwardingNumber = argv[4] except: forwardingNumber = None try: numberType = argv[5] except: numberType = None try: voice.call(outgoingNumber, forwardingNumber, numberType ) print ('Calling now...') except: print ('Error! Calling failed') voice.logout()
def dial(self, number): print "dialing number: %s" % number voice = Voice() voice = voice.login(gvoice_config.email, gvoice_config.passwd) voice.call(number, gvoice_config.phone_to_ring, gvoice_config.phone_to_ring_type)