News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

GV Outbound Calls After EOL

Started by azrobert, May 27, 2022, 07:34:55 AM

Previous topic - Next topic

azrobert

There have been several posts showing how to use a GV forwarding number to receive inbound GV calls. Most suggest using Callcentric, but any provider's inbound number can be used. You will need an SIP inbound number for GV outbound calls.

GV has a callback function. Sign into GV using an internet browser. Click on Settings and enable option "Always Use My Phone to Place Calls". Now when you place a call from the GV Website, a popup will ask which forwarding number you want to use for the outbound call. When you select a number, GV will ring that number. When you answer the call, GV will complete the outbound call. This function is clumsy, but it works.

My AutoHotKey script automates this procedure. Requirements are an OBi, and a PC running AHK. The OBi via an auto-provisioning hack (used in an unintended way) would post a URL containing the outbound number.  This will trigger the AHK script that retrieves the number and then walks thru the steps to make a call.

See instructions here:
https://www.obitalk.com/forum/index.php?msg=112105

See Version 2 of the script here:
https://www.obitalk.com/forum/index.php?msg=114020

azrobert

Hi guys,

I got my AHK GV callback script working.

I had timing problems with the script. I'm no expert, but I think the script can enter keystrokes too fast and then they are not recognized properly. I had to put pauses (sleeps) between commands to get it working. The most trouble I had was selecting the forwarding number. I have 3 forwarding numbers and the script selects the 2nd. I suspect if you're going to have problems, it will be here. It is my understanding that computer speed can change AHK behavior. I have comments in the script and provided alternate methods of selecting a forwarding number. if you have timing issues, I probably won't be able to help. You'll just have to play with it. You can watch the screen as the script runs. This should give you an idea where the script is failing.

azrobert

#2
Obsolete post - Removed

Koby

Just curious, have you ever looked at selgooglevoice?  Instead of using AutoHotKey it uses Selenium which if I understand it correctly is not tied to Windows, in other words it might also work on a Mac or Linux system.  Other than that it seems to perhaps be similar to what you are doing. The drawback that as far as I can tell, in both cases is that it requires you to be able to run a web browser, which means you would have to have a desktop version of the operating system installed.  So it would not work on any kind of "headless" server.

I remember when you could do this much more easily using a script called PyGoogleVoice but at some point that just stopped working and apparently the original author is no longer around to fix it.  That program did not require you to be running a web browser, it was a simple command line program that probably would have been ideal for this type of use (also it allowed you to send texts from the command line using your Google Voice account, which was very useful at times).

azrobert

Never heard of selgooglevoice.
Didn't PyGoogleVoice require a server that supported Python?

Koby

#5
Quote from: azrobert on May 31, 2022, 01:47:00 PMNever heard of selgooglevoice.

Not surprising, there's almost no information about it except on Github.  Only reason I mentioned it is for those that don't run Windows.  My understanding, though I might be wrong, is that AutoHotKey is a Windows-only program, while Selenium is cross-platform and can also run on a Mac or a Linux desktop.

Quote from: azrobert on May 31, 2022, 01:47:00 PMDidn't PyGoogleVoice require a server that supported Python?

Yes, but these days most Linux distros come with Python already installed.  Not certain about Windows though.  Anyway it's a moot point, that program hasn't worked for probably at least five years now.

Taoman

Hey azrobert, is there any way to make this work using a Voice Gateway? I tried but think I got stuck at the OutboundCallRoute. All 4 of my SP trunks are in use as are VG6, VG7, and VG8. SP2 and SP3 are SIP trunks. SP1 and SP4 are GV trunks.

I already have an AHK script running at all times doing a variety of things. Since you're doing a loop, I assume I could just paste in your script at the end of my script?

TIA

azrobert

Quote from: Taoman on June 01, 2022, 07:42:36 AMHey azrobert, is there any way to make this work using a Voice Gateway? I tried but think I got stuck at the OutboundCallRoute.

Do you see the call in the OBi history?
Are the computer and OBi on the same network.
The outbound call defaults to port 5060. Click on the PhonerLite network tab to see the port number.

Taoman

Thanks for your reply. I got a new cable modem and I'm redoing my entire local network. So it will be awhile before I can get back to this.

azrobert

I have a new version of my AutoHotKey GV callback script. The script runs as a web server, so the OBi talks directly to AHK, eliminating the softphone.

You can test the AHK script by entering a URL into a browser. No need to make OBi config changes for testing the script.

If anyone is interested, let me know and I'll post instructions.

Taoman

Quote from: azrobert on June 14, 2022, 08:53:30 AMIf anyone is interested, let me know and I'll post instructions.

I'm interested. "runs as a web server" on what platform?

azrobert

Quote from: Taoman on June 14, 2022, 10:07:58 AMI'm interested. "runs as a web server" on what platform?

Windows.

I found an example on the AHK forum and modified it with my code.

azrobert

#12
To run GV_Server on Windows just download the compiled version (GV_Server.exe).
You don't need to install AutoHotKey to run the compiled GV_Server.

Making modifications to the script:
Install AutoHokey.
Download GV_Server.ahk, AHKhttp.ahk and AHKsock.ahk
All scripts must be stored in the same folder.
Right click on GV_Server and select Edit.
Make your mods.

To compile GV_Server, right click and select Compile.

OBi Configuration:
Define a star code in your Star Code Profile:
*(1xxxxxxxxxx|xxxxxxxxxx|<480>xxxxxxx|011xx.S3), Set Speed Dial99, set($Spd[99],$code)

Change the area code (480) to yours for 7 digit numbers.

System Management -> Auto Provisioning
Under ITSP Provisioning:
Method: System Start
ConfigURL:
SET UDM0 = ""; @loop IF ($UDM0 != "" ) GOTO call; WAIT 2; GOTO loop; @call SYNC http://192.168.1.100:8000/GV?parm1=$UDM0&parm2=1&parm3=L&parm4=0; SET UDM0 = ""; WAIT 2; GOTO loop;

Change 192.168.1.100 to the IP address of the computer running AHK.
Optional parm2 will select your forwarding number.  Default  = 1.
Valid numbers 1, 2 or 3 for 1st 2nd or 3rd forwarding number.
Use optional parm3=R or parm3=r when the primary and secondary mouse buttons were switched.
Optional parm4=n used to adjust vertical position of cursor.
See for parm4 explanation:
https://www.obitalk.com/forum/index.php?msg=113092

System Management -> Auto Provisioning
Under User Defined Macro 0:
Value: $SpeedDial.99
Expandin: ANY

This is a hack of the ITSP Auto Provisioning.
The star code saves the dialed number in SpeedDial99
The user Macro equates variable UDM0 to SpeedDial99.
The ConfigURL checks SpeedDiall99 for a number.
It sleeps for 2 seconds and checks again.
When it finds a number, it issues http request with UDM0 as parm1.
This triggers the script.

Operation:
Enable "Always use my phone to place calls" in GV settings.
You must have a GV forwarding number setup to ring your OBi.
You must be signed into your Google account.

The GV_Server will automatically open a browser with GV.
Chrome, Brave, Edge and Firefox are supported.
The default browser is Chrome.
Change browser:
    Create a shortcut for GV_Server
    Right click on shortcut and select Properties
    Modify the Target by adding a space and the browser code.

Browser Codes:
    Brave: B or b
    Edge: E or e
    Firefox: F or f

The GV_Server script must be running.
To start the GV_Server script, just double click on it.
To stop script, right click on the taskbar ICON and select Exit.

Dial *8005551212
You can dial 11, 10 or 7 digit numbers after the asterisk.
It also supports international calls (011xx,)
Hang-up when you hear dial tone.
Wait for the callback and answer it.


See Version 2 of the script here:
https://www.obitalk.com/forum/index.php?msg=114020


azrobert

#13
I added an optional parameter (parm2) to select the forwarding number. Values 1, 2 or 3. Will default to the 1st forwarding number when parm2 is not supplied or invalid. I only have 2 forwarding numbers defined, so I didn't test "3".

Initiate from a browser:
http://localhost:8000/GV?parm2=2&parm1=6235941000

New OBi ConfigURL:
SET UDM0 = ""; @loop IF ($UDM0 != "" ) GOTO call; WAIT 2; GOTO loop; @call SYNC http://192.168.1.100:8000/GV?parm2=2&parm1=$UDM0; SET UDM0 = ""; WAIT 2; GOTO loop;


azrobert

You can use SipSorcery to trigger a GV callback.
This replaces the ITSP Auto Provisioning hack.

Setup SipSorcery as a trunk.
I used an OBi VG.

Add following to the SipSorcery dial plan:

dialnum="#{req.URI.User}"
if  dialnum.match /^(1[2-9]\d{9}$)/ 
     result = sys.WebGet("http://your_public_ip:8000/GV?parm2=1&parm1=#{dialnum}",1)
     sys.Dial("music@iptel.org[cd=30]")
  end

In your router port forward 8000 to the computer IP running AutoHotKey.

Send 11 digit number to SipSorcery.
You will hear music.
Wait for the Call Waiting Tone.
Press Flash

Koby

#15
Quote from: azrobert on June 24, 2022, 08:19:32 AMYou can use SipSorcery to trigger a GV callback.
This replaces the ITSP Auto Provisioning hack.

Setup SipSorcery as a trunk.
I used an OBi VG.

Add following to the SipSorcery dial plan:

dialnum="#{req.URI.User}"
if  dialnum.match /^(1[2-9]\d{9}$)/ 
    result = sys.WebGet("http://your_public_ip:8000/GV?parm2=1&parm1=#{dialnum}",1)
    sys.Dial("music@iptel.org[cd=30]")
  end

In your router port forward 8000 to the computer IP running AutoHotKey.

Send 11 digit number to SipSorcery.
You will hear music.
Wait for the Call Waiting Tone.
Press Flash


I hope you realize that only computers running Windows can run AutoHotKey.  Is there some reason you're adverse to finding a cross-platform solution that can run on other platforms (MacOS, Linux, FreeBSD, etc.)?

But in any case you've totally lost me with this post. I remember using SipSorcery at one point way back when but now you have to pay them $69 a year (payable ONLY in Bitcoin, no less, which makes me wonder if they are doing something shady) but also in their FAQ it explicitly says:

QuoteDoes SIP Sorcery work with Google Voice?

No.

So I have absolutely no idea what you are doing here but I can't see it as being a useful option for anyone else, unless I am totally missing the point.  But I still wish you'd find a way to do this that isn't restricted to Windows.

hapollo

#16
Quote from: Koby on June 29, 2022, 08:43:18 AMSo I have absolutely no idea what you are doing here but I can't see it as being a useful option for anyone else, unless I am totally missing the point.  But I still wish you'd find a way to do this that isn't restricted to Windows.

Maybe because the whole windows marketshare is still 75% of worldwide OS installs and Macs only 15% and Linux 5% So not only 15% then only .1% of Mac users wanting to use a custom calling method? Thus rewrite the whole script for a single user? So, do the math. Plus windows is perfectly capable of running on Macs using bootcamp. But why use bootcamp when you can get someone to rewrite a script just for you?!

Thanks azrobert for your continued optimizing of the script for the benefit of the majority and contributions to the community.

Taoman

Quote from: hapollo on June 29, 2022, 01:19:38 PMBut why use bootcamp when you can get someone to rewrite a script just for you?!


Exactly!

azrobert

Quote from: Koby on June 29, 2022, 08:43:18 AMI hope you realize that only computers running Windows can run AutoHotKey.  Is there some reason you're adverse to finding a cross-platform solution that can run on other platforms (MacOS, Linux, FreeBSD, etc.)?

But in any case you've totally lost me with this post. I remember using SipSorcery at one point way back when but now you have to pay them $69 a year (payable ONLY in Bitcoin, no less, which makes me wonder if they are doing something shady) but also in their FAQ it explicitly says:

So I have absolutely no idea what you are doing here but I can't see it as being a useful option for anyone else, unless I am totally missing the point.  But I still wish you'd find a way to do this that isn't restricted to Windows.

I'm a Windows person and also have used AHK. I have an old Dell XPS that I use to test things like this. My knowledge of Linux is limited and zip on other platforms, therefore my choice was Windows and AHK.

This isn't rocket science and I don't have a patent on the Idea, so anyone with more knowledge of other platforms can follow my example and create something.

My suggestion to use SipSorcery was directed at people that already had an SipSorcery account. I didn't think someone would buy a $69 subscription just to trigger my AHK script. A long time ago SipSorcery offered a limited function free account and I assumed some people still had one of these accounts.

You are not running Google Voice on SipSorcery. You are just posting a URL to trigger my AHK script. I like the SipSorcery solution better than the ITSP auto provisioning hack.

azrobert

#19
Quote from: hapollo on June 29, 2022, 01:19:38 PMThanks azrobert for your continued optimizing of the script for the benefit of the majority and contributions to the community.

Thank you for the feedback. There were only 7 downloads of my script and I was wondering if anyone got it to work. Actually, you don't say it worked. Anyway, it's nice that someone appreciates my effort.

I have another version of the AHK script that is about 1 second faster. It takes 9-10 seconds from the time a number is sent to SipSorcery until the callback rings. There is a URL parm to send GV the outbound number, so the new script doesn't have to enter the number. Timing has change from the old script and it takes 10 tabs to get to where you select the forwarding number, up from 2. Following is a URL example. The number is placed after the "%2b" and must be 11 digits.

https://voice.google.com/u/0/calls?a=nc,%2b16235941000

I was going to post a question on DLSReports if anyone knew of a URL parm that will pass the forwarding number to GV, but I haven't gotten around to it. Does anyone here know of such a parm?