amper5and / node-google-voice Goto Github PK
View Code? Open in Web Editor NEWDeprecated. Use voice.js instead (https://github.com/amper5and/voice.js).
License: The Unlicense
Deprecated. Use voice.js instead (https://github.com/amper5and/voice.js).
License: The Unlicense
I discovered today, that processMessages seems to be hanging when loading the Placed box - tried it from my PC as well as from my TouchPad, and both were just freezing. I don't know if there's something extremely unusual going on with the HTML that Google is sending there, or what, since it's only happening on one of my two accounts. I traced it down to freezing at the creation of the jsdom(), so I came up with this optimization ..
function processMessages(messages, html){
var msgArray = [];
var anySms = false;
for(var msgId in messages)
{
if(isMessage(messages[msgId], 'sms'))
{
anySms = true;
break;
}
}
if(anySms) {
var document = jsdom.jsdom(html,jsdom.level(2, 'html'));
}
for(var msgId in messages){
var msg = messages[msgId];
if(isMessage(msg,'sms')){
msg.thread = [];
var thread = document.getElementById(msgId).getElementsByClassName('gc-message-sms-row');
thread.forEach = Array.prototype.forEach;
thread.forEach(function(text){
msg.thread.push({
time: getField('time', text),
from: getField('from', text),
text: getField('text', text)
});
});
}
if(isMessage(msg,'voicemail') || isMessage(msg,'recorded')){
msg.url = voicemailMp3BaseUrl + msgId;
}
msgArray.push(msg);
}
return msgArray;
};
Basically, since the DOM parser is only needed for processing SMS messages, I only start it up if there's actually an SMS in the list of messages that need to be processed. As it takes quite some time for the JSDOM to startup and process, that really cuts down on processing time for loading boxes that don't have SMS. Also, using the level 2 parser seems to be slightly faster than the level 3, and supplies the getElementsByClassName that is needed.
Any chance someone can verify that marking multiple messages as read works?
GVclient.set('read', { id: conversationIds });
where conversationIds is an array of conversation id strings, does not seem to be getting it for me, and I just want to verify wether it's something i'm doing wrong, or if this is not working in general.
I'm grabbing the contact image URLs out of the contacts that are transmitted along with the pages, but we don't seem to be getting access to them with our requested credentials - the only way that I've found so far, is to run a login to the mobile version of the site, and then use it's credentials .. any thoughts? I tried running the voicemail download on the images to grab them, and doing the call myself with the https module, and neither got me anywhere other than a "404" .. and i'm sure I had the correct URLs, as I could grab the images with those URLs from a browser, but only as long as I was logged in.
Receiving parse error when testing your client.get('sms',{limit:1}...
example
Response
Error: { name: 'GvError', code: 39, message: 'PARSE_ERROR' }
Error Location google-voice.js #L404
Hey!
I was actually trying to make an app (according to the README) that makes a gvoice call. But when I make a client.connect() call with valid arguments it throws the following error:
/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/google-voice.js:undefined:undefined<script>:30: ReferenceError: _gvRun is not defined _gvRun(_gcData, 'en_US', true); ^ ReferenceError: _gvRun is not defined at /Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/google-voice.js:undefined:undefined<script>:30:7 at /Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/node_modules/contextify/lib/contextify.js:10:24 at Object.javascript (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/languages/javascript.js:5:14) at Object._eval (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:1282:46) at /Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:48:20 at Object.check (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:277:11) at Object.check (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:280:23) at /Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:295:12 at success (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:117:11) at IncomingMessage. (/Applications/XAMPP/xamppfiles/htdocs/sandbox/pyvoice/node_modules/google-voice/node_modules/jsdom/lib/jsdom/level2/html.js:128:9) Call placed with status: {"ok":false,"data":{"code":20}}
Could you please clarify this? BTW I already have Google Voice with a valid Google number and account language settings set to English (US).
TIA
getMessages('inbox', null, function...) is requesting inbox, followed by inbox p1, inbox p2, and at that point, node throws an out of memory error (on embedded webOS device, not in Windows). p1 has around about 100 texts on it, p2 around 160 or so.
same query with { limit: 5} appears to request inbox, followed by inbox p1.
looks like getMessages uses the first page request to figure out how many pages it's going to be getting, and then retrieves those pages -- but it's already received the first page by nature of making that first call. I'm not sure how best to restructure that to not get page 1 a second time. My first thought is to make a named function for the callback from the second getXMLPage call in getMessages(), and call it with the original page info ..
Also not sure if you might have any good ideas on reducing memory consumption - it doesn't look like its obviously wasting a lot of memory, and i'm checking to see if there's some way I can increase the amount of memory allocated to the process.
I know it's probably better to do a pull request, but I haven't got around to cloning and such yet .. and I wanted to give back a little since you've been helping me so much.
A tester reported that he had a completely blank transcription, and that it was causing my app to evidence some breakage. I don't know how to re-create it, so I don't really know exactly what the JS/HTML looks like to see if that's causing any breakage in the parser itself.
I normally get "Unable to transcribe" as the transcription text, but somehow or other ,he's managed an empty text, or non-existent.
Details:
At least before the bug was fixed that was causing it to load 3 pages in for a single call, I was getting a OOM crash when used in webOS, and it was loading 2 pages with approximately 260 text messages on them between the two.
The only error message is "FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory".
Apparently webOS only allocates around-about 22MB or so for a single Node process, and my gut feeling is that this is related to the XML2JS module.
Is it possible to return the messageId on send success?
In one of the connect functions that I've added (which otherwise works fine), there are instances where I need to send an empty string as a parameter. Specifying an empty string, however, just results in that parameter being thrown away- any idea if there's something I can do in here already to preserve an empty parameter when passed in?
/voice/contacts/editContact/
POST
possible parameters appear to be:
isCustomGreeting=[1|0] ?
greetingId=int
disabledPhoneIds= ? (probably numbers?)
directConnect=[1|0](screen calls if 0, do not screen if 1)
isCustomDirectConnect= ?
isCustomForwarding=[1|0](if 1, forward to something specific?)
id=[contact id number]
response= ? ("VOICEMAIL" was the specific parameter I saw, as I was forcing a number to Voicemail)
selectedGroupId= ? (in my case, it was a long integer)
Hi there :) I've just started toying with this, and have been building my project .. and I find that it would be really handy if there were a call that would simply retrieve the AuthCode and the RNR. The code already has support for supplying the RNR bit myself, but what I'd like to do is send the login at one point, and store the AuthCode and RNR for later use, so that we can save on data calls.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.