static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); IncomingPhoneNumberResource.Update( "PN2a0747eba6abf96b7e3c3ff0b4530f6e", voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"), smsUrl: new Uri("http://demo.twilio.com/docs/sms.xml")); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/console // To set up environmental variables, see http://twil.io/secure const string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); const string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); TwilioClient.Init(accountSid, authToken); IncomingPhoneNumberResource.Update( "PN2a0747eba6abf96b7e3c3ff0b4530f6e", voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"), smsUrl: new Uri("http://demo.twilio.com/docs/sms.xml")); }
static void Main(string[] args) { // Find your Account Sid and Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); var incomingPhoneNumber = IncomingPhoneNumberResource.Update( accountSid: "ACzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", pathSid: "PNyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" ); Console.WriteLine(incomingPhoneNumber.FriendlyName); }
public void TestUpdateResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"address_requirements\": \"none\",\"address_sid\": \"ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"api_version\": \"2010-04-01\",\"beta\": false,\"capabilities\": {\"mms\": true,\"sms\": false,\"voice\": true},\"date_created\": \"Thu, 30 Jul 2015 23:19:04 +0000\",\"date_updated\": \"Thu, 30 Jul 2015 23:19:04 +0000\",\"emergency_status\": \"Inactive\",\"emergency_address_sid\": \"ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"(808) 925-5327\",\"identity_sid\": \"RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"origin\": \"origin\",\"phone_number\": \"+18089255327\",\"sid\": \"PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sms_application_sid\": \"\",\"sms_fallback_method\": \"POST\",\"sms_fallback_url\": \"\",\"sms_method\": \"POST\",\"sms_url\": \"\",\"status_callback\": \"\",\"status_callback_method\": \"POST\",\"trunk_sid\": null,\"uri\": \"/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json\",\"voice_application_sid\": \"\",\"voice_caller_id_lookup\": false,\"voice_fallback_method\": \"POST\",\"voice_fallback_url\": null,\"voice_method\": \"POST\",\"voice_url\": null}" )); var response = IncomingPhoneNumberResource.Update("PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.NotNull(response); }
static void Main(string[] args) { // Find your Account Sid and Token at twilio.com/console // To set up environmental variables, see http://twil.io/secure const string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); const string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); TwilioClient.Init(accountSid, authToken); var incomingPhoneNumber = IncomingPhoneNumberResource.Update( accountSid: Environment.GetEnvironmentVariable("TWILIO_SUB_ACCOUNT_SID"), pathSid: "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ); Console.WriteLine(incomingPhoneNumber.FriendlyName); }
static void Main(string[] args) { // Find your Account Sid and Token at twilio.com/console // DANGER! This is insecure. See http://twil.io/secure const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); var incomingPhoneNumber = IncomingPhoneNumberResource.Update( accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", pathSid: "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ); Console.WriteLine(incomingPhoneNumber.FriendlyName); }
public static void UpdateNumber(IncomingPhoneNumberResource phoneNumber) { var accountSid = ConfigUtil.GetEnvironmentVariable("accountSid"); var authToken = ConfigUtil.GetEnvironmentVariable("authToken"); var webHookUrl = ConfigUtil.GetEnvironmentVariable("webHookUrl"); var voiceHookUrl = ConfigUtil.GetEnvironmentVariable("voiceUrl"); TwilioClient.Init(accountSid, authToken); IncomingPhoneNumberResource.Update( accountSid: phoneNumber.AccountSid, pathSid: phoneNumber.Sid, smsUrl: new Uri(webHookUrl), voiceUrl: new Uri(voiceHookUrl) ); }
static void Main(string[] args) { // Find your Account Sid and Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); var incomingPhoneNumber = IncomingPhoneNumberResource.Update( accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", smsUrl: new Uri("http://demo.twilio.com/docs/sms.xml"), voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"), pathSid: "PN2a0747eba6abf96b7e3c3ff0b4530f6e" ); Console.WriteLine(incomingPhoneNumber.FriendlyName); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; // In the case you want to transfer numbers between subaccounts, you need to // know three things - the account SID of the phone number's current owner, // the account SID of the account you'd like to transfer the number to, and // the SID of the phone number you'd like to transfer const string currentOwnerSid = "ACYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"; const string newOwnerSid = "ACZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; const string phoneNumberSid = "PNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"; // Create an authenticated REST client TwilioClient.Init(accountSid, authToken); IncomingPhoneNumberResource.Update(phoneNumberSid, accountSid: newOwnerSid); }
public void TestUpdateRequest() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); var request = new Request( HttpMethod.Post, Twilio.Rest.Domain.Api, "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", "" ); twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { IncomingPhoneNumberResource.Update("PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} twilioRestClient.Received().Request(request); }
public void DisablePhone(VoipPhone phone) { IncomingPhoneNumberResource.Update(phone.Id, voiceUrl: new Uri("https://demo.twilio.com/welcome/voice/"), client: client); }
public void UpdateSettings(VoipPhone phone) { IncomingPhoneNumberResource.Update(phone.Id, voiceUrl: new Uri(phone.Settings.Connect(false)), client: client); }