lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.8.1 vs lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.9.0
- old
+ new
@@ -1,22 +1,25 @@
##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
+#
+# frozen_string_literal: true
module Twilio
module REST
class Api < Domain
class V2010 < Version
class AccountContext < InstanceContext
class CallList < ListResource
##
# Initialize the CallList
# @param [Version] version Version that contains the resource
- # @param [String] account_sid The unique id of the Account responsible for
- # creating this Call
+ # @param [String] account_sid The unique id of the
+ # [Account](https://www.twilio.com/docs/api/rest/account) responsible for creating
+ # this call.
# @return [CallList] CallList
def initialize(version, account_sid: nil)
super(version)
# Path Solution
@@ -30,68 +33,101 @@
##
# Retrieve a single page of CallInstance records from the API.
# Request is executed immediately.
# @param [String] to The phone number, SIP address or client identifier to call.
# @param [String] from The phone number or client identifier to use as the caller
- # id. If using a phone number, it must be a Twilio number or a Verified outgoing
- # caller id for your account.
- # @param [String] method The HTTP method Twilio should use when requesting the
- # URL. Defaults to `POST`. If an `ApplicationSid` was provided, this parameter is
- # ignored.
+ # id. If using a phone number, it must be a Twilio number or a Verified [outgoing
+ # caller id](https://www.twilio.com/docs/api/voice/outgoing-caller-ids) for your
+ # account. If the `To` parameter is a phone number, `From` must also be a phone
+ # number.
+ # @param [String] method The HTTP method Twilio should use when making its request
+ # to the above `Url` parameter's value. Defaults to `POST`. If an `ApplicationSid`
+ # parameter is present, this parameter is ignored.
# @param [String] fallback_url A URL that Twilio will request if an error occurs
- # requesting or executing the TwiML at `Url`. If an `ApplicationSid` was provided,
- # this parameter is ignored.
+ # requesting or executing the TwiML at `Url`. If an `ApplicationSid` parameter is
+ # present, this parameter is ignored.
# @param [String] fallback_method The HTTP method that Twilio should use to
# request the `FallbackUrl`. Must be either `GET` or `POST`. Defaults to `POST`.
- # If an `ApplicationSid` was provided, this parameter is ignored.
- # @param [String] status_callback A URL that Twilio will request when the call
- # ends to notify your app. If an `ApplicationSid` was provided, this parameter is
- # ignored.
- # @param [String] status_callback_event The status_callback_event
- # @param [String] status_callback_method The HTTP method that Twilio should use to
- # request the `StatusCallback`. Defaults to `POST`. If an `ApplicationSid` was
- # provided, this parameter is ignored.
+ # If an `ApplicationSid` parameter is present, this parameter is ignored.
+ # @param [String] status_callback A URL that Twilio will send asynchronous webhook
+ # requests to on every call event specified in the `StatusCallbackEvent`
+ # parameter. If no event is present, Twilio will send `completed` by default. If
+ # an `ApplicationSid` parameter is present, this parameter is ignored. URLs must
+ # contain a valid hostname (underscores are not permitted).
+ # @param [String] status_callback_event The call progress events that Twilio will
+ # send webhooks on. Available values are `initiated`, `ringing`, `answered`, and
+ # `completed`. If you want to receive multiple events, please provide multiple
+ # `StatusCallbackEvent` values as individual parameters in the `POST` request. See
+ # the code sample for [monitoring call
+ # progress](https://www.twilio.com/docs/api/voice/making-calls#make-a-call-and-monitor-progress-events). If no event is specified, defaults to `completed`. If an `ApplicationSid` is present, this parameter is ignored.
+ # @param [String] status_callback_method The HTTP method Twilio should use when
+ # requesting the above URL. Defaults to `POST`. If an `ApplicationSid` parameter
+ # is present, this parameter is ignored.
# @param [String] send_digits A string of keys to dial after connecting to the
- # number. 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, dial extension 1234
- # and then the pound key, use `ww1234#`.
+ # 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,
+ # dial extension 1234 and then the pound key, use `SendDigits=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.
# @param [String] if_machine Tell Twilio to try and determine if a machine (like
# voicemail) or a human has answered the call. Possible value are `Continue` and
# `Hangup`.
# @param [String] timeout The integer number of seconds that Twilio should allow
# the phone to ring before assuming there is no answer. Default is `60` seconds,
- # the maximum is `999` seconds. Note, you could set this to a low value, such as
- # `15`, to hangup before reaching an answering machine or voicemail.
+ # the maximum is `600` seconds. For some call flows Twilio will add a 5 second
+ # buffer to the timeout value provided, so if you enter a timeout value of 10
+ # seconds, you could see actual timeout closer to 15 seconds. Note, you could set
+ # this to a low value, such as `15`, to hangup before reaching an answering
+ # machine or voicemail.
# @param [Boolean] record Set this parameter to true to record the entirety of a
# phone call. The RecordingUrl will be sent to the StatusCallback URL. Defaults to
# false.
- # @param [String] recording_channels The recording_channels
- # @param [String] recording_status_callback The recording_status_callback
- # @param [String] recording_status_callback_method The
- # recording_status_callback_method
+ # @param [String] recording_channels `mono` or `dual`Set this parameter to specify
+ # the number of channels in the final recording. Defaults to `mono`. In
+ # mono-channel, both legs of the call are mixed down into a single channel within
+ # a single recording file. With dual-channel, both legs use separate channels
+ # within a single recording file. For dual-channel, the parent call will always
+ # be in the first channel and the child call will always be in the second channel.
+ # @param [String] recording_status_callback A URL that Twilio will send a webhook
+ # request to when the recording is available for access.
+ # @param [String] recording_status_callback_method The HTTP method Twilio should
+ # use when requesting the above URL. Defaults to `POST`.
# @param [String] sip_auth_username The sip_auth_username
# @param [String] sip_auth_password The sip_auth_password
- # @param [String] machine_detection Twilio will try to detect if a human, fax
- # machine or answering machine has answered the call. Possible value are `Enable`
- # and `DetectMessageEnd`.
- # @param [String] machine_detection_timeout The integer number of miliseconds that
- # Twilio should wait while machine_detection is performned before timing out.
- # @param [String] recording_status_callback_event The
- # recording_status_callback_event
- # @param [String] trim Set this parameter to control trimming of silence on the
- # recording. Possible values are `trim-silence` or `do-not-trim`. Defaults to
+ # @param [String] machine_detection Detect if a human, answering machine or fax
+ # has picked up the call. Use `Enable` if you would like Twilio to return an
+ # `AnsweredBy` value as soon as it identifies the called party. If you would like
+ # to leave a message on an answering machine specify `DetectMessageEnd`. If both
+ # SendDigits and MachineDetection parameters are provided, then MachineDetection
+ # will be ignored. [Detailed documentation is
+ # here](https://www.twilio.com/docs/api/voice/answering-machine-detection).
+ # @param [String] machine_detection_timeout The number of seconds that Twilio
+ # should attempt to perform answering machine detection before timing out and
+ # firing a voice request with `AnsweredBy` of `unknown`. Defaults to 30 seconds.
+ # @param [String] recording_status_callback_event The recording status changes
+ # that Twilio will send webhooks on to the URL specified in
+ # RecordingStatusCallback. The available values are `in-progress`, `completed`,
+ # `failed`. To specify multiple values separate them with a space. Defaults are
+ # `completed`, `failed`. If any values are specified, the defaults are no longer
+ # applicable.
+ # @param [String] trim `trim-silence` or `do-not-trim`Set this parameter to define
+ # whether leading and trailing silence is trimmed from the recording. Defaults to
# `trim-silence`.
# @param [String] caller_id 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 `name@company.com`.
# @param [String] url The fully qualified URL that should be consulted when the
# call connects. Just like when you set a URL on a phone number for handling
- # inbound calls.
- # @param [String] application_sid The 34 character sid of the application Twilio
+ # inbound calls. See the [Url
+ # Parameter](https://www.twilio.com/docs/api/voice/making-calls#url-parameter) details in [Making Calls](https://www.twilio.com/docs/voice/make-calls) for more details.
+ # @param [String] application_sid The 34 character SID of the application Twilio
# should use to handle this phone call. If this parameter is present, Twilio will
- # ignore all of the voice URLs passed and use the URLs set on the application.
+ # ignore all of the voice URLs passed and use the URLs set on the application. See
+ # the [ApplicationSid
+ # Parameter](https://www.twilio.com/docs/api/voice/making-calls#applicationsid-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls) for more details.
# @return [CallInstance] Newly created CallInstance
def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, if_machine: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, url: :unset, application_sid: :unset)
data = Twilio::Values.of({
'To' => to,
'From' => from,
@@ -130,15 +166,19 @@
##
# Lists CallInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
# memory before returning.
- # @param [String] to Only show calls to this phone number or Client identifier
- # @param [String] from Only show calls from this phone number or Client identifier
+ # @param [String] to Only show calls to this phone number, SIP address, Client
+ # identifier or SIM SID.
+ # @param [String] from Only show calls from this phone number, SIP address, Client
+ # identifier or SIM SID.
# @param [String] parent_call_sid Only show calls spawned by the call with this
- # Sid
- # @param [call.Status] status Only show calls currently in this status
+ # SID.
+ # @param [call.Status] status Only show calls currently in this status. May be
+ # `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`,
+ # or `no-answer`.
# @param [Time] start_time_before StartTime to filter on
# @param [Time] start_time StartTime to filter on
# @param [Time] start_time_after StartTime to filter on
# @param [Time] end_time_before EndTime to filter on
# @param [Time] end_time EndTime to filter on
@@ -169,15 +209,19 @@
##
# Streams CallInstance records from the API as an Enumerable.
# This operation lazily loads records as efficiently as possible until the limit
# is reached.
- # @param [String] to Only show calls to this phone number or Client identifier
- # @param [String] from Only show calls from this phone number or Client identifier
+ # @param [String] to Only show calls to this phone number, SIP address, Client
+ # identifier or SIM SID.
+ # @param [String] from Only show calls from this phone number, SIP address, Client
+ # identifier or SIM SID.
# @param [String] parent_call_sid Only show calls spawned by the call with this
- # Sid
- # @param [call.Status] status Only show calls currently in this status
+ # SID.
+ # @param [call.Status] status Only show calls currently in this status. May be
+ # `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`,
+ # or `no-answer`.
# @param [Time] start_time_before StartTime to filter on
# @param [Time] start_time StartTime to filter on
# @param [Time] start_time_after StartTime to filter on
# @param [Time] end_time_before EndTime to filter on
# @param [Time] end_time EndTime to filter on
@@ -224,15 +268,19 @@
end
##
# Retrieve a single page of CallInstance records from the API.
# Request is executed immediately.
- # @param [String] to Only show calls to this phone number or Client identifier
- # @param [String] from Only show calls from this phone number or Client identifier
+ # @param [String] to Only show calls to this phone number, SIP address, Client
+ # identifier or SIM SID.
+ # @param [String] from Only show calls from this phone number, SIP address, Client
+ # identifier or SIM SID.
# @param [String] parent_call_sid Only show calls spawned by the call with this
- # Sid
- # @param [call.Status] status Only show calls currently in this status
+ # SID.
+ # @param [call.Status] status Only show calls currently in this status. May be
+ # `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`,
+ # or `no-answer`.
# @param [Time] start_time_before StartTime to filter on
# @param [Time] start_time StartTime to filter on
# @param [Time] start_time_after StartTime to filter on
# @param [Time] end_time_before EndTime to filter on
# @param [Time] end_time EndTime to filter on
@@ -371,26 +419,36 @@
CallInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
end
##
# Update the CallInstance
- # @param [String] url A valid URL that returns TwiML. Twilio will immediately
- # redirect the call to the new TwiML upon execution.
- # @param [String] method The HTTP method Twilio should use when requesting the
- # URL. Defaults to `POST`.
- # @param [call.UpdateStatus] status Either `canceled` or `completed`. Specifying
- # `canceled` will attempt to hangup calls that are queued or ringing but not
- # affect calls already in progress. Specifying `completed` will attempt to hang up
- # a call even if it's already in progress.
+ # @param [String] url The fully qualified URL that should be consulted when the
+ # call connects. Just like when you set a URL on a phone number for handling
+ # inbound calls. See the [Url
+ # Parameter](https://www.twilio.com/docs/api/voice/making-calls#url-parameter)
+ # section below for more details.
+ # @param [String] method The HTTP method Twilio should use when making its request
+ # to the above `Url` parameter's value. Defaults to `POST`. If an `ApplicationSid`
+ # parameter is present, this parameter is ignored.
+ # @param [call.UpdateStatus] status Either `canceled` or `completed`.
+ # Specifying `canceled` will attempt to hang up calls that are queued or ringing
+ # but not affect calls already in progress. Specifying `completed` will attempt to
+ # hang up a call even if it's already in progress.
# @param [String] fallback_url A URL that Twilio will request if an error occurs
- # requesting or executing the TwiML at `Url`.
+ # requesting or executing the TwiML at `Url`. If an `ApplicationSid` parameter is
+ # present, this parameter is ignored.
# @param [String] fallback_method The HTTP method that Twilio should use to
# request the `FallbackUrl`. Must be either `GET` or `POST`. Defaults to `POST`.
- # @param [String] status_callback A URL that Twilio will request when the call
- # ends to notify your app.
- # @param [String] status_callback_method The HTTP method that Twilio should use to
- # request the `StatusCallback`. Defaults to `POST`.
+ # If an `ApplicationSid` parameter is present, this parameter is ignored.
+ # @param [String] status_callback A URL that Twilio will send asynchronous webhook
+ # requests to on every call event specified in the `StatusCallbackEvent`
+ # parameter. If no event is present, Twilio will send `completed` by default. If
+ # an `ApplicationSid` parameter is present, this parameter is ignored. URLs must
+ # contain a valid hostname (underscores are not permitted).
+ # @param [String] status_callback_method The HTTP method Twilio should use when
+ # requesting the above URL. Defaults to `POST`. If an `ApplicationSid` parameter
+ # is present, this parameter is ignored.
# @return [CallInstance] Updated CallInstance
def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset)
data = Twilio::Values.of({
'Url' => url,
'Method' => method,
@@ -473,12 +531,13 @@
class CallInstance < InstanceResource
##
# Initialize the CallInstance
# @param [Version] version Version that contains the resource
# @param [Hash] payload payload that contains response from Twilio
- # @param [String] account_sid The unique id of the Account responsible for
- # creating this Call
+ # @param [String] account_sid The unique id of the
+ # [Account](https://www.twilio.com/docs/api/rest/account) responsible for creating
+ # this call.
# @param [String] sid The Call Sid that uniquely identifies the Call to fetch
# @return [CallInstance] CallInstance
def initialize(version, payload, account_sid: nil, sid: nil)
super(version)
@@ -574,11 +633,11 @@
def direction
@properties['direction']
end
##
- # @return [String] The duration
+ # @return [String] The length of the call in seconds.
def duration
@properties['duration']
end
##
@@ -646,11 +705,11 @@
def start_time
@properties['start_time']
end
##
- # @return [call.Status] The status
+ # @return [call.Status] A string representing the status of the call.
def status
@properties['status']
end
##
@@ -691,25 +750,35 @@
context.fetch
end
##
# Update the CallInstance
- # @param [String] url A valid URL that returns TwiML. Twilio will immediately
- # redirect the call to the new TwiML upon execution.
- # @param [String] method The HTTP method Twilio should use when requesting the
- # URL. Defaults to `POST`.
- # @param [call.UpdateStatus] status Either `canceled` or `completed`. Specifying
- # `canceled` will attempt to hangup calls that are queued or ringing but not
- # affect calls already in progress. Specifying `completed` will attempt to hang up
- # a call even if it's already in progress.
+ # @param [String] url The fully qualified URL that should be consulted when the
+ # call connects. Just like when you set a URL on a phone number for handling
+ # inbound calls. See the [Url
+ # Parameter](https://www.twilio.com/docs/api/voice/making-calls#url-parameter)
+ # section below for more details.
+ # @param [String] method The HTTP method Twilio should use when making its request
+ # to the above `Url` parameter's value. Defaults to `POST`. If an `ApplicationSid`
+ # parameter is present, this parameter is ignored.
+ # @param [call.UpdateStatus] status Either `canceled` or `completed`.
+ # Specifying `canceled` will attempt to hang up calls that are queued or ringing
+ # but not affect calls already in progress. Specifying `completed` will attempt to
+ # hang up a call even if it's already in progress.
# @param [String] fallback_url A URL that Twilio will request if an error occurs
- # requesting or executing the TwiML at `Url`.
+ # requesting or executing the TwiML at `Url`. If an `ApplicationSid` parameter is
+ # present, this parameter is ignored.
# @param [String] fallback_method The HTTP method that Twilio should use to
# request the `FallbackUrl`. Must be either `GET` or `POST`. Defaults to `POST`.
- # @param [String] status_callback A URL that Twilio will request when the call
- # ends to notify your app.
- # @param [String] status_callback_method The HTTP method that Twilio should use to
- # request the `StatusCallback`. Defaults to `POST`.
+ # If an `ApplicationSid` parameter is present, this parameter is ignored.
+ # @param [String] status_callback A URL that Twilio will send asynchronous webhook
+ # requests to on every call event specified in the `StatusCallbackEvent`
+ # parameter. If no event is present, Twilio will send `completed` by default. If
+ # an `ApplicationSid` parameter is present, this parameter is ignored. URLs must
+ # contain a valid hostname (underscores are not permitted).
+ # @param [String] status_callback_method The HTTP method Twilio should use when
+ # requesting the above URL. Defaults to `POST`. If an `ApplicationSid` parameter
+ # is present, this parameter is ignored.
# @return [CallInstance] Updated CallInstance
def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset)
context.update(
url: url,
method: method,
\ No newline at end of file