Speed dial to post to url. Part of my Google voice 2014 workaround.

<< < (5/10) > >>

giqcass:
Quote from: Roger on April 10, 2014, 09:14:46 am

I am trying to implement this with Aaron's googlevoice.php code, but I don't see where to add my google voice credentials.

googlevoice.php remains completely untouched when you implement it.

Please have a look at example.php.  That's where all of the code you need to modify is.  Most of the code isn't needed.  Let us know if you need additional help.

Roger:
I have tested out the code and am able to place a call using the sample php code below, but not from the Obi.  What I don't understand is how the Obi sends my username and password to the php code and how the Obi knows to call the callNumber function within the php code. 

<?php

ini_set('display_errors', 'On');

include('gvcall.php');

// NOTE: Full email address required.
$gv = new GoogleVoice('username@gmail.com', 'passwd');

// Call a phone from one of your forwarding phones.
$gv->callNumber('12123334444', '16315971111', 'home');

?>

For anyone else trying this out, adding "ini_set('display_errors', 'On');" to the code will provide useful error messages.  I had to install php5-curl which didn't come with my basic php install.

azrobert:
FYI I deleted all the code in the script except Login, callnumber and cancelcall.
This is not necessary.

I added some code to the Example script.
I hard coded all the parms in the script except the outbound number.
From the OBi I sent the script the outbound number and another parm.
Based on the value of the extra parm I did a callnumber or a cancelcall.

Edit:
If you are running the script on a Web server you don't need the cancelcall. Always do a callnumber.

azrobert:
I re-read your post and I'm not sure I answered your question.
Are you asking how to pass parms to the script?

Call the script like this:
http://192.168.1.100:5060/gvcall.PHP?dialnum=18005551212

In the script do:
$dialnum = $_GET["dialnum"];
$gv->callNumber($dialnum, '3601234567', 'home');

Roger:
Thanks so much azrobert and giqcass for your help.  I didn't know I needed to add to the script.  I am now able to place a call via a URL as such:

http://localhost/gv.php?dialnum=12123334444

Please bear with me as I am learning PHP as I go, but I have a two more questions:

1) Do I use the configURL to get the Obi to execute the URL: http://localhost/gv.php?dialnum=12123334444?
Here is my configURL: 

SET TPRM1 = $UDM0; @loop IF ( $TPRM1 != $UDM0 ) SYNC http://192.168.1.145/gv.php?dialnum=$UDM0; SET TPRM1 = $UDM0; WAIT 5; GOTO loop;

Does that look okay?  192.168.1.145 is the server IP from my router, which sits behind my Obi.  Will the Obi be able to get to that address?

2) While I am able to place a call via a URL from my localhost, when I put the same php code on a website hosted by fatcow.com I get an error when placing a call.  Would you be able to guess the problem based on the error message below?
 
Fatal error: Uncaught exception 'Exception' with message 'Could not log in to Google Voice with username: username@gmail.com' in /hermes/waloraweb099/b1942/moo.xxxxx/gvcall.php:67 Stack trace: #0 /hermes/waloraweb099/b1942/moo.xxxxx/gvcall.php(89): GoogleVoice->_logIn() #1 /hermes/waloraweb099/b1942/moo.xxxxx/gv.php(15): GoogleVoice->callNumber('12123334444', '16314445555', 'home') #2 {main} thrown in /hermes/waloraweb099/b1942/moo.xxxxx/gvcall.php on line 67

Navigation

[0] Message Index

[#] Next page

[*] Previous page