Class CallCreator

    • Constructor Detail

      • CallCreator

        public CallCreator​(Endpoint to,
                           Endpoint from,
                           URI url)
        Construct a new CallCreator.
        Parameters:
        to - Phone number, SIP address, or client identifier to call
        from - Twilio number from which to originate the call
        url - The absolute URL that returns TwiML for this call
      • CallCreator

        public CallCreator​(String pathAccountSid,
                           Endpoint to,
                           Endpoint from,
                           URI url)
        Construct a new CallCreator.
        Parameters:
        pathAccountSid - The SID of the Account that will create the resource
        to - Phone number, SIP address, or client identifier to call
        from - Twilio number from which to originate the call
        url - The absolute URL that returns TwiML for this call
      • CallCreator

        public CallCreator​(Endpoint to,
                           Endpoint from,
                           String applicationSid)
        Construct a new CallCreator.
        Parameters:
        to - Phone number, SIP address, or client identifier to call
        from - Twilio number from which to originate the call
        applicationSid - The SID of the Application resource that will handle the call
      • CallCreator

        public CallCreator​(String pathAccountSid,
                           Endpoint to,
                           Endpoint from,
                           String applicationSid)
        Construct a new CallCreator.
        Parameters:
        pathAccountSid - The SID of the Account that will create the resource
        to - Phone number, SIP address, or client identifier to call
        from - Twilio number from which to originate the call
        applicationSid - The SID of the Application resource that will handle the call
    • Method Detail

      • setMethod

        public CallCreator setMethod​(HttpMethod method)
        The HTTP method we should use when calling the `url` parameter's value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored..
        Parameters:
        method - HTTP method to use to fetch TwiML
        Returns:
        this
      • setFallbackUrl

        public CallCreator setFallbackUrl​(URI fallbackUrl)
        The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored..
        Parameters:
        fallbackUrl - Fallback URL in case of error
        Returns:
        this
      • setFallbackUrl

        public CallCreator setFallbackUrl​(String fallbackUrl)
        The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored..
        Parameters:
        fallbackUrl - Fallback URL in case of error
        Returns:
        this
      • setFallbackMethod

        public CallCreator setFallbackMethod​(HttpMethod fallbackMethod)
        The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored..
        Parameters:
        fallbackMethod - HTTP Method to use with fallback_url
        Returns:
        this
      • setStatusCallback

        public CallCreator setStatusCallback​(URI statusCallback)
        The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted)..
        Parameters:
        statusCallback - The URL we should call to send status information to your application
        Returns:
        this
      • setStatusCallback

        public CallCreator setStatusCallback​(String statusCallback)
        The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted)..
        Parameters:
        statusCallback - The URL we should call to send status information to your application
        Returns:
        this
      • setStatusCallbackEvent

        public CallCreator setStatusCallbackEvent​(List<String> statusCallbackEvent)
        The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call?code-sample=code-create-a-call-and-specify-a-statuscallbackevent). If an `application_sid` is present, this parameter is ignored..
        Parameters:
        statusCallbackEvent - The call progress events that we send to the `status_callback` URL.
        Returns:
        this
      • setStatusCallbackEvent

        public CallCreator setStatusCallbackEvent​(String statusCallbackEvent)
        The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call?code-sample=code-create-a-call-and-specify-a-statuscallbackevent). If an `application_sid` is present, this parameter is ignored..
        Parameters:
        statusCallbackEvent - The call progress events that we send to the `status_callback` URL.
        Returns:
        this
      • setStatusCallbackMethod

        public CallCreator setStatusCallbackMethod​(HttpMethod statusCallbackMethod)
        The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored..
        Parameters:
        statusCallbackMethod - HTTP Method to use with status_callback
        Returns:
        this
      • setSendDigits

        public CallCreator setSendDigits​(String sendDigits)
        A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored..
        Parameters:
        sendDigits - The digits to dial after connecting to the number
        Returns:
        this
      • setTimeout

        public CallCreator setTimeout​(Integer timeout)
        The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail..
        Parameters:
        timeout - Number of seconds to wait for an answer
        Returns:
        this
      • setRecord

        public CallCreator setRecord​(Boolean record)
        Set this parameter to `true` to record the phone call. The `recording_url` will be sent to the `status_callback` URL. The default is `false`..
        Parameters:
        record - Whether or not to record the call
        Returns:
        this
      • setRecordingChannels

        public CallCreator setRecordingChannels​(String recordingChannels)
        The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call..
        Parameters:
        recordingChannels - The number of channels in the final recording
        Returns:
        this
      • setRecordingStatusCallback

        public CallCreator setRecordingStatusCallback​(String recordingStatusCallback)
        The URL that we call when the recording is available to be accessed..
        Parameters:
        recordingStatusCallback - The URL that we call when the recording is available to be accessed
        Returns:
        this
      • setRecordingStatusCallbackMethod

        public CallCreator setRecordingStatusCallbackMethod​(HttpMethod recordingStatusCallbackMethod)
        The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`..
        Parameters:
        recordingStatusCallbackMethod - The HTTP method we should use when calling the `recording_status_callback` URL
        Returns:
        this
      • setSipAuthUsername

        public CallCreator setSipAuthUsername​(String sipAuthUsername)
        The username used to authenticate the caller making a SIP call..
        Parameters:
        sipAuthUsername - The username used to authenticate the caller making a SIP call
        Returns:
        this
      • setSipAuthPassword

        public CallCreator setSipAuthPassword​(String sipAuthPassword)
        The password required to authenticate the user account specified in `sip_auth_username`..
        Parameters:
        sipAuthPassword - The password required to authenticate the user account specified in `sip_auth_username`.
        Returns:
        this
      • setMachineDetection

        public CallCreator setMachineDetection​(String machineDetection)
        Detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection)..
        Parameters:
        machineDetection - Enable machine detection or end of greeting detection
        Returns:
        this
      • setMachineDetectionTimeout

        public CallCreator setMachineDetectionTimeout​(Integer machineDetectionTimeout)
        The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds..
        Parameters:
        machineDetectionTimeout - Number of seconds to wait for machine detection
        Returns:
        this
      • setRecordingStatusCallbackEvent

        public CallCreator setRecordingStatusCallbackEvent​(List<String> recordingStatusCallbackEvent)
        The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space..
        Parameters:
        recordingStatusCallbackEvent - The recording status events that will trigger calls to the URL specified in `recording_status_callback`
        Returns:
        this
      • setRecordingStatusCallbackEvent

        public CallCreator setRecordingStatusCallbackEvent​(String recordingStatusCallbackEvent)
        The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space..
        Parameters:
        recordingStatusCallbackEvent - The recording status events that will trigger calls to the URL specified in `recording_status_callback`
        Returns:
        this
      • setTrim

        public CallCreator setTrim​(String trim)
        Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`..
        Parameters:
        trim - Set this parameter to control trimming of silence on the recording.
        Returns:
        this
      • setCallerId

        public CallCreator setCallerId​(String callerId)
        The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `[email protected]`..
        Parameters:
        callerId - The phone number, SIP address, or Client identifier that made this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `[email protected]`.
        Returns:
        this
      • setMachineDetectionSpeechThreshold

        public CallCreator setMachineDetectionSpeechThreshold​(Integer machineDetectionSpeechThreshold)
        The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400..
        Parameters:
        machineDetectionSpeechThreshold - Number of milliseconds for measuring stick for the length of the speech activity
        Returns:
        this
      • setMachineDetectionSpeechEndThreshold

        public CallCreator setMachineDetectionSpeechEndThreshold​(Integer machineDetectionSpeechEndThreshold)
        The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200..
        Parameters:
        machineDetectionSpeechEndThreshold - Number of milliseconds of silence after speech activity
        Returns:
        this
      • setMachineDetectionSilenceTimeout

        public CallCreator setMachineDetectionSilenceTimeout​(Integer machineDetectionSilenceTimeout)
        The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000..
        Parameters:
        machineDetectionSilenceTimeout - Number of milliseconds of initial silence
        Returns:
        this
      • setUrl

        public CallCreator setUrl​(URI url)
        The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls)..
        Parameters:
        url - The absolute URL that returns TwiML for this call
        Returns:
        this
      • setUrl

        public CallCreator setUrl​(String url)
        The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls)..
        Parameters:
        url - The absolute URL that returns TwiML for this call
        Returns:
        this
      • setApplicationSid

        public CallCreator setApplicationSid​(String applicationSid)
        The SID of the Application resource that will handle the call, if the call will be handled by an application..
        Parameters:
        applicationSid - The SID of the Application resource that will handle the call
        Returns:
        this
      • create

        public Call create​(TwilioRestClient client)
        Make the request to the Twilio API to perform the create.
        Specified by:
        create in class Creator<Call>
        Parameters:
        client - TwilioRestClient with which to make the request
        Returns:
        Created Call