Exemple #1
0
        public void Call(string number, ForwardingPhone fwd)
        {
            if (string.IsNullOrEmpty(Token_RNR_SE_MustEncode))
            {
                Trace.WriteLine("Can't make calls, no RNR_SE token");
                throw new InvalidOperationException(@"No RNR_SE Token, can't make calls.  (See %localappdata%\GVNotifierWPF\log.txt for details)");
            }

            number = Util.StripNumber(number);
            this.TryLogThrow("GoogleVoice/Account/Call: " + number,
                             () => {
                // NOTE:  the HTML5 call API will return a callback number, instead of starting
                // a callback - I can't see a way we can use that, so we must take a dependency
                // on the old site (or the old mobile site, if possible)
                HttpResult ret = http.Post("https://www.google.com/voice/call/connect/",
                                           new Dictionary <string, string>
                {
                    { "outgoingNumber", number },
                    { "forwardingNumber", fwd.Number },
                    { "phoneType", fwd.PhoneType.ToString() },
                    { "_rnr_se", Token_RNR_SE_MustEncode },
                    { "subscriberNumber", "undefined" },
                    { "remember", "0" },
                });
            });
        }
Exemple #2
0
        public void LoadPhones()
        {
            try
            {
                HttpResult ret  = GVPost("https://www.google.com/voice/m/x?m=set&v=" + AppVersion);
                string     json = ret.Page.Split('\n')[1];
                JObject    o    = JObject.Parse(json);

                Number = (o["settings_response"]["general_info"]["primary_did"] as JValue).Value.ToString();
                Trace.WriteLine("My Number: " + Number);

                foreach (var p in o["settings_response"]["user_preferences"]["forwarding"])
                {
                    ForwardingPhone fp = new ForwardingPhone(
                        (p["phone_number"] as JValue).Value.ToString(),
                        (p["name"] as JValue).Value.ToString(),
                        (p["type"] as JValue).Value.ToString());
                    ForwardingPhones.Add(fp);
                    Trace.WriteLine("My Phone: " + fp);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("GoogleVoice/Account/LoadPhones *** " + ex);
            }
        }