GV voicemail transcripts on phone's microbrowser

rxcomm

Guru
Joined
Sep 13, 2010
Messages
77
Reaction score
2
Displaying GV voicemail transcripts on my phone's microbrowser is something I have been interested in doing for a while. It turns out that aaronpk has written a nice php API for GV that can be used for this application quite easily. Here's how:

1) Get the Google Voice PHP API from here.

2) Get my bugfix patch from here. Copy gv.patch into the same directory as GoogleVoice.php and apply the patch as follows:
Code:
 patch -p0 < gv.patch
3) Get the file vm.php from here. Edit line 4 of vm.php to add your GV credentials (email and password).

4) Put both the patched GoogleVoice.php and vm.php files in a directory accessible to the web server (e.g. /var/www/html). Point your phone's microbrowser to vm.php, and you should see a transcription of each new voicemail. Voicemails that have been read won't be shown (if you don't have any new voicemails, you will get a blank page).

The default configuration and formatting can be changed to add things like click-to-call and paging through voicemails for different numbers, depending on the capabilities of your microbrowser. If you do make some of these modifications, post your results!

This makes a nice combination when configured with the GV system on your PIAF as shown here.

Dave
 
Last edited by a moderator:
Displaying the GV vm transcripts is not an asterisk thing - it is web-based. So it will work with your PIAF server of any version (1.4, 1.6, or 1.8). Of course, the GV/asterisk integration will only work with asterisk 1.8.

Dave
 
I will be testing this, and making changes and posting them back, I love the idea.
 
I have tried a few configurations for this and cant seem to get it to work:

Code:
root@joshsphone:/var/www/html/vm $ ls
example.php  GoogleVoice.php  gv.patch  LICENSE  README.md  vm.php
root@joshsphone:/var/www/html/vm $ patch -p0 < gv.patch
patching file GoogleVoice.php
root@joshsphone:/var/www/html/vm $

And I changed the vm.php to:
Code:
<?php
include('GoogleVoice.php');
echo '<html><head></head><body>';
$gv = new GoogleVoice('[email protected]', 'thatOnePassword');

// fetch new voicemails
$voicemails = $gv->getNewVoicemail();

$msgIDs = array();
foreach( $voicemails as $s )
{
        preg_match('/\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match);
        $phoneNumber = '(' . $match[1] . ') ' . $match[2] . '-'. $match[3];
        echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . '<br />' . $s['message'] . '<br />';
}

echo '</body></html>';

?>

If I look at source I get:
Code:
<html><head></head><body>

Which would make you think I had no vms, but I do, I have one sitting there just waiting for me.

Let me know what I can do here. I am thinking this patch isn't working right.
 
You need to install a few packages (I always forget what I have previously installed by hand!).

Code:
yum install curl curl-devel php-xml php-pear php-devel
Then build php-json (not sure why this isn't a package in CentOS)
Code:
pecl download json
pear install json-1.2.1.tgz
And finally, add the file json.ini to /etc/php.d with the following contents:
Code:
[COLOR=#003300]
; php-json extension[/COLOR]
extension=json.so
Restart httpd and your vm.php should run.

Dave
 
excellent. Works great now, will play with it more.

Post results later.
 
Is there any way to forward local vm's from a piaf install to GV for transcription? Sorry this is a bit OT.
 
Is there any way to forward local vm's from a piaf install to GV for transcription?
I don't believe there is a way to do this. You can seamlessly integrate GV voicemail instead of asterisk as your voicemail provider per the link in the first post, however.

On another note, here is a vm.php file that implements click-to-dial for returning calls on polycom phones.

Code:
<?php
include('GoogleVoice.php');
echo '<html><head></head><body>';
$login = '[email protected]';
$passwd = 'xxx';
echo 'Voicemails from (NXX) NXX-XXXX:<br />';

$gv = new GoogleVoice($login,$passwd);

// fetch new voicemails
$voicemails = $gv->getNewVoicemail();

$msgIDs = array();
foreach( $voicemails as $s )
{
        preg_match('/\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match);
        $phoneNumber = "<a href=\"tel://" . str_replace("+1","",$s['phoneNumber']) . "\">(" . $match[1] . ") " . $match[2] . "-". $match[3] . "</a>";
        echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . '<br />' . $s['message'] . '<br />';
}

echo '<br />';
echo '</body></html>';

?>
Dave
 

Members online

Forum statistics

Threads
26,687
Messages
174,410
Members
20,257
Latest member
Dempan
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.
Back
Top