示例#1
0
        public VoipPhone GetPhone(string phoneSid)
        {
            var phone = IncomingPhoneNumberResource.Fetch(phoneSid, client: client);

            var result = new TwilioPhone(client)
            {
                Id = phone.Sid, Number = phone.PhoneNumber.ToString(), Settings = new TwilioVoipSettings()
            };

            if (phone.VoiceUrl == null)
            {
                result.Settings.VoiceUrl = result.Settings.Connect(false);
            }

            return(result);
        }
示例#2
0
        public VoipPhone GetPhone(string phoneSid)
        {
            var phone = client.GetIncomingPhoneNumber(phoneSid);

            ThrowIfError(phone);

            var result = new TwilioPhone(client)
            {
                Id = phone.Sid, Number = phone.PhoneNumber, Settings = new TwilioVoipSettings()
            };

            if (string.IsNullOrEmpty(phone.VoiceUrl))
            {
                phone.VoiceUrl = result.Settings.Connect(false);
            }

            result.Settings.VoiceUrl = phone.VoiceUrl;

            return(result);
        }