/// <summary>
        /// create
        /// </summary>
        /// <param name="phoneNumber"> The phone number to purchase in E.164 format </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="apiVersion"> The API version to use for incoming calls made to the new phone number </param>
        /// <param name="friendlyName"> A string to describe the new phone number </param>
        /// <param name="smsApplicationSid"> The SID of the application to handle SMS messages </param>
        /// <param name="smsFallbackMethod"> HTTP method used with sms_fallback_url </param>
        /// <param name="smsFallbackUrl"> The URL we call when an error occurs while executing TwiML </param>
        /// <param name="smsMethod"> The HTTP method to use with sms_url </param>
        /// <param name="smsUrl"> The URL we should call when the new phone number receives an incoming SMS message </param>
        /// <param name="statusCallback"> The URL to send status information to your application </param>
        /// <param name="statusCallbackMethod"> The HTTP method we should use to call status_callback </param>
        /// <param name="voiceApplicationSid"> The SID of the application to handle the new phone number </param>
        /// <param name="voiceCallerIdLookup"> Whether to lookup the caller's name </param>
        /// <param name="voiceFallbackMethod"> The HTTP method used with voice_fallback_url </param>
        /// <param name="voiceFallbackUrl"> The URL we will call when an error occurs in TwiML </param>
        /// <param name="voiceMethod"> The HTTP method used with the voice_url </param>
        /// <param name="voiceUrl"> The URL we should call when the phone number receives a call </param>
        /// <param name="identitySid"> The SID of the Identity resource to associate with the new phone number </param>
        /// <param name="addressSid"> The SID of the Address resource associated with the phone number </param>
        /// <param name="emergencyStatus"> Status determining whether the new phone number is enabled for emergency calling
        ///                       </param>
        /// <param name="emergencyAddressSid"> The emergency address configuration to use for emergency calling </param>
        /// <param name="trunkSid"> SID of the trunk to handle calls to the new phone number </param>
        /// <param name="voiceReceiveMode"> Incoming call type: fax or voice </param>
        /// <param name="bundleSid"> The SID of the Bundle resource associated with number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of TollFree </returns>
        public static async System.Threading.Tasks.Task <TollFreeResource> CreateAsync(Types.PhoneNumber phoneNumber,
                                                                                       string pathAccountSid    = null,
                                                                                       string apiVersion        = null,
                                                                                       string friendlyName      = null,
                                                                                       string smsApplicationSid = null,
                                                                                       Twilio.Http.HttpMethod smsFallbackMethod = null,
                                                                                       Uri smsFallbackUrl = null,
                                                                                       Twilio.Http.HttpMethod smsMethod = null,
                                                                                       Uri smsUrl         = null,
                                                                                       Uri statusCallback = null,
                                                                                       Twilio.Http.HttpMethod statusCallbackMethod = null,
                                                                                       string voiceApplicationSid = null,
                                                                                       bool?voiceCallerIdLookup   = null,
                                                                                       Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                                                                       Uri voiceFallbackUrl = null,
                                                                                       Twilio.Http.HttpMethod voiceMethod = null,
                                                                                       Uri voiceUrl       = null,
                                                                                       string identitySid = null,
                                                                                       string addressSid  = null,
                                                                                       TollFreeResource.EmergencyStatusEnum emergencyStatus = null,
                                                                                       string emergencyAddressSid = null,
                                                                                       string trunkSid            = null,
                                                                                       TollFreeResource.VoiceReceiveModeEnum voiceReceiveMode = null,
                                                                                       string bundleSid         = null,
                                                                                       ITwilioRestClient client = null)
        {
            var options = new CreateTollFreeOptions(phoneNumber)
            {
                PathAccountSid = pathAccountSid, ApiVersion = apiVersion, FriendlyName = friendlyName, SmsApplicationSid = smsApplicationSid, SmsFallbackMethod = smsFallbackMethod, SmsFallbackUrl = smsFallbackUrl, SmsMethod = smsMethod, SmsUrl = smsUrl, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceApplicationSid = voiceApplicationSid, VoiceCallerIdLookup = voiceCallerIdLookup, VoiceFallbackMethod = voiceFallbackMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceMethod = voiceMethod, VoiceUrl = voiceUrl, IdentitySid = identitySid, AddressSid = addressSid, EmergencyStatus = emergencyStatus, EmergencyAddressSid = emergencyAddressSid, TrunkSid = trunkSid, VoiceReceiveMode = voiceReceiveMode, BundleSid = bundleSid
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create TollFree parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of TollFree </returns>
        public static TollFreeResource Create(CreateTollFreeOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
示例#3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="phoneNumber"> The phone number to purchase in E.164 format </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="apiVersion"> The API version to use for incoming calls made to the new phone number </param>
        /// <param name="friendlyName"> A string to describe the new phone number </param>
        /// <param name="smsApplicationSid"> The SID of the application to handle SMS messages </param>
        /// <param name="smsFallbackMethod"> HTTP method used with sms_fallback_url </param>
        /// <param name="smsFallbackUrl"> The URL we call when an error occurs while executing TwiML </param>
        /// <param name="smsMethod"> The HTTP method to use with sms_url </param>
        /// <param name="smsUrl"> The URL we should call when the new phone number receives an incoming SMS message </param>
        /// <param name="statusCallback"> The URL to send status information to your application </param>
        /// <param name="statusCallbackMethod"> The HTTP method we should use to call status_callback </param>
        /// <param name="voiceApplicationSid"> The SID of the application to handle the new phone number </param>
        /// <param name="voiceCallerIdLookup"> Whether to lookup the caller's name </param>
        /// <param name="voiceFallbackMethod"> The HTTP method used with voice_fallback_url </param>
        /// <param name="voiceFallbackUrl"> The URL we will call when an error occurs in TwiML </param>
        /// <param name="voiceMethod"> The HTTP method used with the voice_url </param>
        /// <param name="voiceUrl"> The URL we should call when the phone number receives a call </param>
        /// <param name="identitySid"> The SID of the Identity resource to associate with the new phone number </param>
        /// <param name="addressSid"> The SID of the Address resource associated with the phone number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of TollFree </returns>
        public static TollFreeResource Create(Types.PhoneNumber phoneNumber,
                                              string pathAccountSid    = null,
                                              string apiVersion        = null,
                                              string friendlyName      = null,
                                              string smsApplicationSid = null,
                                              Twilio.Http.HttpMethod smsFallbackMethod = null,
                                              Uri smsFallbackUrl = null,
                                              Twilio.Http.HttpMethod smsMethod = null,
                                              Uri smsUrl         = null,
                                              Uri statusCallback = null,
                                              Twilio.Http.HttpMethod statusCallbackMethod = null,
                                              string voiceApplicationSid = null,
                                              bool?voiceCallerIdLookup   = null,
                                              Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                              Uri voiceFallbackUrl = null,
                                              Twilio.Http.HttpMethod voiceMethod = null,
                                              Uri voiceUrl             = null,
                                              string identitySid       = null,
                                              string addressSid        = null,
                                              ITwilioRestClient client = null)
        {
            var options = new CreateTollFreeOptions(phoneNumber)
            {
                PathAccountSid = pathAccountSid, ApiVersion = apiVersion, FriendlyName = friendlyName, SmsApplicationSid = smsApplicationSid, SmsFallbackMethod = smsFallbackMethod, SmsFallbackUrl = smsFallbackUrl, SmsMethod = smsMethod, SmsUrl = smsUrl, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceApplicationSid = voiceApplicationSid, VoiceCallerIdLookup = voiceCallerIdLookup, VoiceFallbackMethod = voiceFallbackMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceMethod = voiceMethod, VoiceUrl = voiceUrl, IdentitySid = identitySid, AddressSid = addressSid
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateTollFreeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/IncomingPhoneNumbers/TollFree.json",
                postParams: options.GetParams()
                ));
 }
示例#5
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="phoneNumber"> The phone_number </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="apiVersion"> The api_version </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="smsApplicationSid"> The sms_application_sid </param>
        /// <param name="smsFallbackMethod"> The sms_fallback_method </param>
        /// <param name="smsFallbackUrl"> The sms_fallback_url </param>
        /// <param name="smsMethod"> The sms_method </param>
        /// <param name="smsUrl"> The sms_url </param>
        /// <param name="statusCallback"> The status_callback </param>
        /// <param name="statusCallbackMethod"> The status_callback_method </param>
        /// <param name="voiceApplicationSid"> The voice_application_sid </param>
        /// <param name="voiceCallerIdLookup"> The voice_caller_id_lookup </param>
        /// <param name="voiceFallbackMethod"> The voice_fallback_method </param>
        /// <param name="voiceFallbackUrl"> The voice_fallback_url </param>
        /// <param name="voiceMethod"> The voice_method </param>
        /// <param name="voiceUrl"> The voice_url </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of TollFree </returns>
        public static async System.Threading.Tasks.Task <TollFreeResource> CreateAsync(Types.PhoneNumber phoneNumber, string pathAccountSid = null, string apiVersion = null, string friendlyName = null, string smsApplicationSid = null, Twilio.Http.HttpMethod smsFallbackMethod = null, Uri smsFallbackUrl = null, Twilio.Http.HttpMethod smsMethod = null, Uri smsUrl = null, Uri statusCallback = null, Twilio.Http.HttpMethod statusCallbackMethod = null, string voiceApplicationSid = null, bool?voiceCallerIdLookup = null, Twilio.Http.HttpMethod voiceFallbackMethod = null, Uri voiceFallbackUrl = null, Twilio.Http.HttpMethod voiceMethod = null, Uri voiceUrl = null, ITwilioRestClient client = null)
        {
            var options = new CreateTollFreeOptions(phoneNumber)
            {
                PathAccountSid = pathAccountSid, ApiVersion = apiVersion, FriendlyName = friendlyName, SmsApplicationSid = smsApplicationSid, SmsFallbackMethod = smsFallbackMethod, SmsFallbackUrl = smsFallbackUrl, SmsMethod = smsMethod, SmsUrl = smsUrl, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceApplicationSid = voiceApplicationSid, VoiceCallerIdLookup = voiceCallerIdLookup, VoiceFallbackMethod = voiceFallbackMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceMethod = voiceMethod, VoiceUrl = voiceUrl
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create TollFree parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of TollFree </returns>
        public static async System.Threading.Tasks.Task <TollFreeResource> CreateAsync(CreateTollFreeOptions options,
                                                                                       ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }