コード例 #1
0
        /// <summary>
        /// Create a new outgoing call to phones, SIP-enabled endpoints or Twilio Client connections
        /// </summary>
        /// <param name="options"> Create Call parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Call </returns>
        public static CallResource Create(CreateCallOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
コード例 #2
0
        /// <summary>
        /// Create a new outgoing call to phones, SIP-enabled endpoints or Twilio Client connections
        /// </summary>
        /// <param name="to"> Phone number, SIP address or client identifier to call </param>
        /// <param name="from"> Twilio number from which to originate the call </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="url"> Url from which to fetch TwiML </param>
        /// <param name="applicationSid"> ApplicationSid that configures from where to fetch TwiML </param>
        /// <param name="method"> HTTP method to use to fetch TwiML </param>
        /// <param name="fallbackUrl"> Fallback URL in case of error </param>
        /// <param name="fallbackMethod"> HTTP Method to use with FallbackUrl </param>
        /// <param name="statusCallback"> Status Callback URL </param>
        /// <param name="statusCallbackEvent"> The status_callback_event </param>
        /// <param name="statusCallbackMethod"> HTTP Method to use with StatusCallback </param>
        /// <param name="sendDigits"> Digits to send </param>
        /// <param name="ifMachine"> Action to take if a machine has answered the call </param>
        /// <param name="timeout"> Number of seconds to wait for an answer </param>
        /// <param name="record"> Whether or not to record the Call </param>
        /// <param name="recordingChannels"> The recording_channels </param>
        /// <param name="recordingStatusCallback"> The recording_status_callback </param>
        /// <param name="recordingStatusCallbackMethod"> The recording_status_callback_method </param>
        /// <param name="sipAuthUsername"> The sip_auth_username </param>
        /// <param name="sipAuthPassword"> The sip_auth_password </param>
        /// <param name="machineDetection"> Enable machine detection or end of greeting detection </param>
        /// <param name="machineDetectionTimeout"> Number of miliseconds to wait for machine detection </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Call </returns>
        public static async System.Threading.Tasks.Task <CallResource> CreateAsync(IEndpoint to,
                                                                                   Types.PhoneNumber from,
                                                                                   string pathAccountSid = null,
                                                                                   Uri url = null,
                                                                                   string applicationSid         = null,
                                                                                   Twilio.Http.HttpMethod method = null,
                                                                                   Uri fallbackUrl = null,
                                                                                   Twilio.Http.HttpMethod fallbackMethod = null,
                                                                                   Uri statusCallback = null,
                                                                                   List <string> statusCallbackEvent           = null,
                                                                                   Twilio.Http.HttpMethod statusCallbackMethod = null,
                                                                                   string sendDigits              = null,
                                                                                   string ifMachine               = null,
                                                                                   int?timeout                    = null,
                                                                                   bool?record                    = null,
                                                                                   string recordingChannels       = null,
                                                                                   string recordingStatusCallback = null,
                                                                                   Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
                                                                                   string sipAuthUsername      = null,
                                                                                   string sipAuthPassword      = null,
                                                                                   string machineDetection     = null,
                                                                                   int?machineDetectionTimeout = null,
                                                                                   ITwilioRestClient client    = null)
        {
            var options = new CreateCallOptions(to, from)
            {
                PathAccountSid = pathAccountSid, Url = url, ApplicationSid = applicationSid, Method = method, FallbackUrl = fallbackUrl, FallbackMethod = fallbackMethod, StatusCallback = statusCallback, StatusCallbackEvent = statusCallbackEvent, StatusCallbackMethod = statusCallbackMethod, SendDigits = sendDigits, IfMachine = ifMachine, Timeout = timeout, Record = record, RecordingChannels = recordingChannels, RecordingStatusCallback = recordingStatusCallback, RecordingStatusCallbackMethod = recordingStatusCallbackMethod, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, MachineDetection = machineDetection, MachineDetectionTimeout = machineDetectionTimeout
            };

            return(await CreateAsync(options, client));
        }
コード例 #3
0
        /// <summary>
        /// Create a new outgoing call to phones, SIP-enabled endpoints or Twilio Client connections
        /// </summary>
        ///
        /// <param name="options"> Create Call parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Call </returns>
        public static async System.Threading.Tasks.Task <CallResource> CreateAsync(CreateCallOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
コード例 #4
0
 private static Request BuildCreateRequest(CreateCallOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Calls.json",
                client.Region,
                postParams: options.GetParams()
                ));
 }