anassfiqhi / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

Error while making Google Voice Call #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

This is the code in my public static void main
1.          String userName = "username@gmail.com";
        String pass = "pwd"; 
        Voice voice = new Voice(userName, pass);
        String originNumber = "123456789";
        String destinationNumber = "909999999";
        String phoneType = "Mobile";
        voice.call(originNumber, destinationNumber, "Mobile");
            voice.sendSMS(destinationNumber, "text");

What is the expected output? What do you see instead?

- The SMS is sent all right. However it throws an error -

Exception in thread "main" java.io.IOException: Server returned HTTP
response code: 500 for URL: https://www.google.com/voice/call/connect/
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown
Source)
    at com.techventus.server.voice.Voice.call(Voice.java:204)
    at googleVoice.CallGoogleVoice.main(CallGoogleVoice.java:28)

What version of the product are you using? On what operating system?
the 1.4 version

Please provide any additional information below.
- the authorization is not an issue I think since SMS is reaching fine.

Do let me know !

thanks in advance !
nadu

Original issue reported on code.google.com by narayana...@gmail.com on 3 Apr 2010 at 2:55

GoogleCodeExporter commented 9 years ago
Nadu, 
The phoneType field actually is a number referring to Google's internal 
phoneType.

1) Home
2) Mobile
3) Work
7) Gizmo

It references the type of phone with which you are calling - not the 
destination 
phone.

If you replaced

 voice.call(originNumber, destinationNumber, "Mobile");

with

 voice.call(originNumber, destinationNumber, "2");

then your code should work.  If you access the Phone object corresponding to 
the 
number you are callng with you can pull out the phoneType.  

Phone[] phoneAr = voice.getSettings.getPhones();

int i = {whatever};

int phoneTypeInt = phoneAr[i].getType();

and finally plug it back in.

voice.call(originNumber, destinationNumber, String.valueOf(phoneTypeInt));

I hope this helps.  Definitely look into the Phone objects if you are still 
confused 
at all.  I think we could rework the code to make things easier.

-JM

Original comment by malone.j...@gmail.com on 3 Apr 2010 at 8:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I am receiving the following when I run the attached file:
Login success - auth token received.
Login success - auth token received.
[id=9;number=+1xxxxxxxxxx;name=Gizmo 
Home;carrier=;type=7;verified=true;enabled=true;formattedNumber=(xxx) 
xxx-xxxx;, 
id=12;number=+1xxxxxxxxxx;name=iPhone;carrier=;type=2;verified=true;enabled=true
;formattedNumber=(xxx) 
xxx-xxxx;]
{"ok":false,"data":{"code":20}}

google-voice-java:
google-voice-java-1.4.jar
Java:
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) Client VM (build 14.3-b01-101, mixed mode, sharing)
OS: 
ProductName:    Mac OS X
ProductVersion: 10.6.3
BuildVersion:   10D573

Original comment by kevindiffily@gmail.com on 4 Apr 2010 at 3:12

Attachments:

GoogleCodeExporter commented 9 years ago
Kevin,
I tested your script and it worked fine for me.  I am assuming your origin 
number was 
your cell phone since you used phoneType = 2?  

The key result is this: {"ok":false,"data":{"code":20}}  That is Google's 
response to 
your call attempt.

When I ran the code I got {"ok":true,"data":{"code":0}}

0 must be a success.  I do not know exactly what code 20 means.  That would be 
something nice to find out.  I think you may have set something incorrectly 
rather 
than it being a problem with the API, but given phone number/password 
constraints 
here it is a little challenging to diagnose your problem.

Good Luck and if you have a good guess as to what code 20 is let us know.

Original comment by malone.j...@gmail.com on 7 Apr 2010 at 6:42

GoogleCodeExporter commented 9 years ago

Original comment by malone.j...@gmail.com on 20 Apr 2010 at 4:57

GoogleCodeExporter commented 9 years ago
hi malone,

i am using it in android. i got successful msg like 
{"ok":true,"data":{"code":0}},

then nothing happened. what can i make call from mobile?

Original comment by themasko...@gmail.com on 7 Apr 2012 at 6:03