Example #1
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 we should call 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 Mobile </returns>
        public static async System.Threading.Tasks.Task <MobileResource> 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,
                                                                                     MobileResource.EmergencyStatusEnum emergencyStatus = null,
                                                                                     string emergencyAddressSid = null,
                                                                                     string trunkSid            = null,
                                                                                     MobileResource.VoiceReceiveModeEnum voiceReceiveMode = null,
                                                                                     string bundleSid         = null,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateMobileOptions(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));
        }
Example #2
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Mobile parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Mobile </returns>
        public static MobileResource Create(CreateMobileOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Example #3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="phoneNumber"> The phone number you want to purchase. </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="apiVersion"> The Twilio REST API version to use for incoming calls made to this number. </param>
        /// <param name="friendlyName"> A human readable description of the new incoming phone number. </param>
        /// <param name="smsApplicationSid"> The 34 character sid of the application Twilio should use to handle SMSs sent to
        ///                         the new number. </param>
        /// <param name="smsFallbackMethod"> The HTTP method that should be used to request the SmsFallbackUrl. </param>
        /// <param name="smsFallbackUrl"> A URL that Twilio will request if an error occurs requesting or executing the TwiML
        ///                      defined by SmsUrl. </param>
        /// <param name="smsMethod"> The HTTP method that should be used to request the SmsUrl. </param>
        /// <param name="smsUrl"> The URL that Twilio should request when somebody sends an SMS to the phone number. </param>
        /// <param name="statusCallback"> The URL that Twilio will request to pass status parameters to your application.
        ///                      </param>
        /// <param name="statusCallbackMethod"> The HTTP method Twilio will use to make requests to the StatusCallback URL.
        ///                            </param>
        /// <param name="voiceApplicationSid"> The 34 character sid of the application Twilio should use to handle phone calls
        ///                           to the new number. </param>
        /// <param name="voiceCallerIdLookup"> Do a lookup of a caller's name from the CNAM database and post it to your app.
        ///                           </param>
        /// <param name="voiceFallbackMethod"> The HTTP method that should be used to request the VoiceFallbackUrl. </param>
        /// <param name="voiceFallbackUrl"> A URL that Twilio will request if an error occurs requesting or executing the TwiML
        ///                        at Url. </param>
        /// <param name="voiceMethod"> The HTTP method that should be used to request the VoiceUrl. </param>
        /// <param name="voiceUrl"> The URL that Twilio should request when somebody dials the new phone number. </param>
        /// <param name="identitySid"> The identity_sid </param>
        /// <param name="addressSid"> The 34 character sid of the address Twilio should associate with the number. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Mobile </returns>
        public static MobileResource 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 CreateMobileOptions(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));
        }
Example #4
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create Mobile parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Mobile </returns>
        public static async System.Threading.Tasks.Task <MobileResource> CreateAsync(CreateMobileOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateMobileOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/IncomingPhoneNumbers/Mobile.json",
                postParams: options.GetParams()
                ));
 }
Example #6
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 Mobile </returns>
        public static async System.Threading.Tasks.Task <MobileResource> 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 CreateMobileOptions(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));
        }