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

            return(FromJson(response.Content));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new Domain
        /// </summary>
        /// <param name="options"> Create Domain parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Domain </returns>
        public static DomainResource Create(CreateDomainOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Create a new Domain
        /// </summary>
        ///
        /// <param name="domainName"> The unique address on Twilio to route SIP traffic </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> A user-specified, human-readable name for the trigger. </param>
        /// <param name="authType"> The types of authentication mapped to the domain </param>
        /// <param name="voiceUrl"> URL Twilio will request when receiving a call </param>
        /// <param name="voiceMethod"> HTTP method to use with voice_url </param>
        /// <param name="voiceFallbackUrl"> URL Twilio will request if an error occurs in executing TwiML </param>
        /// <param name="voiceFallbackMethod"> HTTP method used with voice_fallback_url </param>
        /// <param name="voiceStatusCallbackUrl"> URL that Twilio will request with status updates </param>
        /// <param name="voiceStatusCallbackMethod"> The voice_status_callback_method </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Domain </returns>
        public static async System.Threading.Tasks.Task <DomainResource> CreateAsync(string domainName, string pathAccountSid = null, string friendlyName = null, string authType = null, Uri voiceUrl = null, Twilio.Http.HttpMethod voiceMethod = null, Uri voiceFallbackUrl = null, Twilio.Http.HttpMethod voiceFallbackMethod = null, Uri voiceStatusCallbackUrl = null, Twilio.Http.HttpMethod voiceStatusCallbackMethod = null, ITwilioRestClient client = null)
        {
            var options = new CreateDomainOptions(domainName)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, AuthType = authType, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, VoiceStatusCallbackUrl = voiceStatusCallbackUrl, VoiceStatusCallbackMethod = voiceStatusCallbackMethod
            };

            return(await CreateAsync(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new Domain
        /// </summary>
        ///
        /// <param name="domainName"> The unique address on Twilio to route SIP traffic </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> A user-specified, human-readable name for the trigger. </param>
        /// <param name="authType"> The types of authentication mapped to the domain </param>
        /// <param name="voiceUrl"> URL Twilio will request when receiving a call </param>
        /// <param name="voiceMethod"> HTTP method to use with voice_url </param>
        /// <param name="voiceFallbackUrl"> URL Twilio will request if an error occurs in executing TwiML </param>
        /// <param name="voiceFallbackMethod"> HTTP method used with voice_fallback_url </param>
        /// <param name="voiceStatusCallbackUrl"> URL that Twilio will request with status updates </param>
        /// <param name="voiceStatusCallbackMethod"> The voice_status_callback_method </param>
        /// <param name="sipRegistration"> The sip_registration </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Domain </returns>
        public static DomainResource Create(string domainName, string pathAccountSid = null, string friendlyName = null, string authType = null, Uri voiceUrl = null, Twilio.Http.HttpMethod voiceMethod = null, Uri voiceFallbackUrl = null, Twilio.Http.HttpMethod voiceFallbackMethod = null, Uri voiceStatusCallbackUrl = null, Twilio.Http.HttpMethod voiceStatusCallbackMethod = null, bool?sipRegistration = null, ITwilioRestClient client = null)
        {
            var options = new CreateDomainOptions(domainName)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, AuthType = authType, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, VoiceStatusCallbackUrl = voiceStatusCallbackUrl, VoiceStatusCallbackMethod = voiceStatusCallbackMethod, SipRegistration = sipRegistration
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateDomainOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/SIP/Domains.json",
                postParams: options.GetParams()
                ));
 }
Esempio n. 6
0
        /// <summary>
        /// Create a new Domain
        /// </summary>
        /// <param name="domainName"> The unique address on Twilio to route SIP traffic </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="voiceUrl"> The URL we should call when receiving a call </param>
        /// <param name="voiceMethod"> The HTTP method to use with voice_url </param>
        /// <param name="voiceFallbackUrl"> The URL we should call when an error occurs in executing TwiML </param>
        /// <param name="voiceFallbackMethod"> The HTTP method to use with voice_fallback_url </param>
        /// <param name="voiceStatusCallbackUrl"> The URL that we should call to pass status updates </param>
        /// <param name="voiceStatusCallbackMethod"> The HTTP method we should use to call `voice_status_callback_url` </param>
        /// <param name="sipRegistration"> Whether SIP registration is allowed </param>
        /// <param name="emergencyCallingEnabled"> Whether emergency calling is enabled for the domain. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Domain </returns>
        public static async System.Threading.Tasks.Task <DomainResource> CreateAsync(string domainName,
                                                                                     string pathAccountSid = null,
                                                                                     string friendlyName   = null,
                                                                                     Uri voiceUrl          = null,
                                                                                     Twilio.Http.HttpMethod voiceMethod = null,
                                                                                     Uri voiceFallbackUrl = null,
                                                                                     Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                                                                     Uri voiceStatusCallbackUrl = null,
                                                                                     Twilio.Http.HttpMethod voiceStatusCallbackMethod = null,
                                                                                     bool?sipRegistration         = null,
                                                                                     bool?emergencyCallingEnabled = null,
                                                                                     ITwilioRestClient client     = null)
        {
            var options = new CreateDomainOptions(domainName)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, VoiceStatusCallbackUrl = voiceStatusCallbackUrl, VoiceStatusCallbackMethod = voiceStatusCallbackMethod, SipRegistration = sipRegistration, EmergencyCallingEnabled = emergencyCallingEnabled
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Create a new Domain
        /// </summary>
        /// <param name="domainName"> The unique address on Twilio to route SIP traffic </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="voiceUrl"> The URL we should call when receiving a call </param>
        /// <param name="voiceMethod"> The HTTP method to use with voice_url </param>
        /// <param name="voiceFallbackUrl"> The URL we should call when an error occurs in executing TwiML </param>
        /// <param name="voiceFallbackMethod"> The HTTP method to use with voice_fallback_url </param>
        /// <param name="voiceStatusCallbackUrl"> The URL that we should call to pass status updates </param>
        /// <param name="voiceStatusCallbackMethod"> The HTTP method we should use to call `voice_status_callback_url` </param>
        /// <param name="sipRegistration"> Whether SIP registration is allowed </param>
        /// <param name="emergencyCallingEnabled"> Whether emergency calling is enabled for the domain. </param>
        /// <param name="secure"> Whether secure SIP is enabled for the domain </param>
        /// <param name="byocTrunkSid"> The SID of the BYOC Trunk resource. </param>
        /// <param name="emergencyCallerSid"> Whether an emergency caller sid is configured for the domain. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Domain </returns>
        public static DomainResource Create(string domainName,
                                            string pathAccountSid = null,
                                            string friendlyName   = null,
                                            Uri voiceUrl          = null,
                                            Twilio.Http.HttpMethod voiceMethod = null,
                                            Uri voiceFallbackUrl = null,
                                            Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                            Uri voiceStatusCallbackUrl = null,
                                            Twilio.Http.HttpMethod voiceStatusCallbackMethod = null,
                                            bool?sipRegistration         = null,
                                            bool?emergencyCallingEnabled = null,
                                            bool?secure               = null,
                                            string byocTrunkSid       = null,
                                            string emergencyCallerSid = null,
                                            ITwilioRestClient client  = null)
        {
            var options = new CreateDomainOptions(domainName)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, VoiceStatusCallbackUrl = voiceStatusCallbackUrl, VoiceStatusCallbackMethod = voiceStatusCallbackMethod, SipRegistration = sipRegistration, EmergencyCallingEnabled = emergencyCallingEnabled, Secure = secure, ByocTrunkSid = byocTrunkSid, EmergencyCallerSid = emergencyCallerSid
            };

            return(Create(options, client));
        }