Class: Twilio::REST::Api::V2010::AccountContext::CallList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil) ⇒ CallList

Initialize the CallList

Parameters:

  • version (Version)

    Version that contains the resource



28
29
30
31
32
33
34
35
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 28

def initialize(version, account_sid: nil)
    super(version)
    
    # Path Solution
    @solution = { account_sid:  }
    @uri = "/Accounts/#{@solution[:account_sid]}/Calls.json"
    
end

Instance Method Details

#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, 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, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance

Create the CallInstance

Parameters:

  • to (String) (defaults to: nil)

    The phone number, SIP address, or client identifier to call.

  • from (String) (defaults to: nil)

    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](www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the ‘to` parameter is a phone number, `From` must also be a phone number.

  • method (String) (defaults to: :unset)

    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.

  • fallback_url (String) (defaults to: :unset)

    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.

  • fallback_method (String) (defaults to: :unset)

    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.

  • status_callback (String) (defaults to: :unset)

    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).

  • status_callback_event (Array[String]) (defaults to: :unset)

    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](www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.

  • status_callback_method (String) (defaults to: :unset)

    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.

  • send_digits (String) (defaults to: :unset)

    The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (‘0`-`9`), ’‘A`’, ‘`B`’, ‘`C`’, ‘`D`’, ‘`#`’, and ‘`*`’. You can also use ‘`w`’ to insert a half-second pause and ‘`W`’ to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to ‘W1234#`. Be sure to URL-encode this string because the ’‘#`’ character has special meaning in a URL. If both ‘SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.

  • timeout (String) (defaults to: :unset)

    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.

  • record (Boolean) (defaults to: :unset)

    Whether to record the call. Can be ‘true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.

  • recording_channels (String) (defaults to: :unset)

    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.

  • recording_status_callback (String) (defaults to: :unset)

    The URL that we call when the recording is available to be accessed.

  • recording_status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use when calling the ‘recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.

  • sip_auth_username (String) (defaults to: :unset)

    The username used to authenticate the caller making a SIP call.

  • sip_auth_password (String) (defaults to: :unset)

    The password required to authenticate the user account specified in ‘sip_auth_username`.

  • machine_detection (String) (defaults to: :unset)

    Whether to 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](www.twilio.com/docs/voice/answering-machine-detection).

  • machine_detection_timeout (String) (defaults to: :unset)

    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.

  • recording_status_callback_event (Array[String]) (defaults to: :unset)

    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.

  • trim (String) (defaults to: :unset)

    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`.

  • caller_id (String) (defaults to: :unset)

    The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as ‘name@company.com`.

  • machine_detection_speech_threshold (String) (defaults to: :unset)

    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.

  • machine_detection_speech_end_threshold (String) (defaults to: :unset)

    The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200.

  • machine_detection_silence_timeout (String) (defaults to: :unset)

    The number of milliseconds of initial silence after which an ‘unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000.

  • async_amd (String) (defaults to: :unset)

    Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: ‘true` or `false`.

  • async_amd_status_callback (String) (defaults to: :unset)

    The URL that we should call using the ‘async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax.

  • async_amd_status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use when calling the ‘async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.

  • byoc (String) (defaults to: :unset)

    The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that ‘byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta)

  • call_reason (String) (defaults to: :unset)

    The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party’s phone. (Branded Calls Beta)

  • call_token (String) (defaults to: :unset)

    A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call’s call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call.

  • recording_track (String) (defaults to: :unset)

    The audio track to record for the call. Can be: ‘inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio.

  • time_limit (String) (defaults to: :unset)

    The maximum duration of the call in seconds. Constraints depend on account and configuration.

  • client_notification_url (String) (defaults to: :unset)

    The URL that we should use to deliver ‘push call notification`.

  • url (String) (defaults to: :unset)

    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](www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](www.twilio.com/docs/voice/make-calls).

  • twiml (String) (defaults to: :unset)

    TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both ‘twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters.

  • application_sid (String) (defaults to: :unset)

    The SID of the Application resource that will handle the call, if the call will be handled by an application.

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 75

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, 
    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, 
    machine_detection_speech_threshold: :unset, 
    machine_detection_speech_end_threshold: :unset, 
    machine_detection_silence_timeout: :unset, 
    async_amd: :unset, 
    async_amd_status_callback: :unset, 
    async_amd_status_callback_method: :unset, 
    byoc: :unset, 
    call_reason: :unset, 
    call_token: :unset, 
    recording_track: :unset, 
    time_limit: :unset, 
    client_notification_url: :unset, 
    url: :unset, 
    twiml: :unset, 
    application_sid: :unset
)

    data = Twilio::Values.of({
        'To' => to,
        'From' => from,
        'Method' => method,
        'FallbackUrl' => fallback_url,
        'FallbackMethod' => fallback_method,
        'StatusCallback' => status_callback,
        'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
        'StatusCallbackMethod' => status_callback_method,
        'SendDigits' => send_digits,
        'Timeout' => timeout,
        'Record' => record,
        'RecordingChannels' => recording_channels,
        'RecordingStatusCallback' => recording_status_callback,
        'RecordingStatusCallbackMethod' => recording_status_callback_method,
        'SipAuthUsername' => sip_auth_username,
        'SipAuthPassword' => sip_auth_password,
        'MachineDetection' => machine_detection,
        'MachineDetectionTimeout' => machine_detection_timeout,
        'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
        'Trim' => trim,
        'CallerId' => caller_id,
        'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold,
        'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold,
        'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout,
        'AsyncAmd' => async_amd,
        'AsyncAmdStatusCallback' => async_amd_status_callback,
        'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method,
        'Byoc' => byoc,
        'CallReason' => call_reason,
        'CallToken' => call_token,
        'RecordingTrack' => recording_track,
        'TimeLimit' => time_limit,
        'ClientNotificationUrl' => client_notification_url,
        'Url' => url,
        'Twiml' => twiml,
        'ApplicationSid' => application_sid,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    CallInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
    )
end

#create_with_metadata(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, 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, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance

Create the CallInstanceMetadata

Parameters:

  • to (String) (defaults to: nil)

    The phone number, SIP address, or client identifier to call.

  • from (String) (defaults to: nil)

    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](www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the ‘to` parameter is a phone number, `From` must also be a phone number.

  • method (String) (defaults to: :unset)

    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.

  • fallback_url (String) (defaults to: :unset)

    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.

  • fallback_method (String) (defaults to: :unset)

    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.

  • status_callback (String) (defaults to: :unset)

    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).

  • status_callback_event (Array[String]) (defaults to: :unset)

    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](www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.

  • status_callback_method (String) (defaults to: :unset)

    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.

  • send_digits (String) (defaults to: :unset)

    The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (‘0`-`9`), ’‘A`’, ‘`B`’, ‘`C`’, ‘`D`’, ‘`#`’, and ‘`*`’. You can also use ‘`w`’ to insert a half-second pause and ‘`W`’ to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to ‘W1234#`. Be sure to URL-encode this string because the ’‘#`’ character has special meaning in a URL. If both ‘SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.

  • timeout (String) (defaults to: :unset)

    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.

  • record (Boolean) (defaults to: :unset)

    Whether to record the call. Can be ‘true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.

  • recording_channels (String) (defaults to: :unset)

    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.

  • recording_status_callback (String) (defaults to: :unset)

    The URL that we call when the recording is available to be accessed.

  • recording_status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use when calling the ‘recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.

  • sip_auth_username (String) (defaults to: :unset)

    The username used to authenticate the caller making a SIP call.

  • sip_auth_password (String) (defaults to: :unset)

    The password required to authenticate the user account specified in ‘sip_auth_username`.

  • machine_detection (String) (defaults to: :unset)

    Whether to 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](www.twilio.com/docs/voice/answering-machine-detection).

  • machine_detection_timeout (String) (defaults to: :unset)

    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.

  • recording_status_callback_event (Array[String]) (defaults to: :unset)

    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.

  • trim (String) (defaults to: :unset)

    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`.

  • caller_id (String) (defaults to: :unset)

    The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as ‘name@company.com`.

  • machine_detection_speech_threshold (String) (defaults to: :unset)

    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.

  • machine_detection_speech_end_threshold (String) (defaults to: :unset)

    The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200.

  • machine_detection_silence_timeout (String) (defaults to: :unset)

    The number of milliseconds of initial silence after which an ‘unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000.

  • async_amd (String) (defaults to: :unset)

    Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: ‘true` or `false`.

  • async_amd_status_callback (String) (defaults to: :unset)

    The URL that we should call using the ‘async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax.

  • async_amd_status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use when calling the ‘async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.

  • byoc (String) (defaults to: :unset)

    The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that ‘byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta)

  • call_reason (String) (defaults to: :unset)

    The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party’s phone. (Branded Calls Beta)

  • call_token (String) (defaults to: :unset)

    A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call’s call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call.

  • recording_track (String) (defaults to: :unset)

    The audio track to record for the call. Can be: ‘inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio.

  • time_limit (String) (defaults to: :unset)

    The maximum duration of the call in seconds. Constraints depend on account and configuration.

  • client_notification_url (String) (defaults to: :unset)

    The URL that we should use to deliver ‘push call notification`.

  • url (String) (defaults to: :unset)

    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](www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](www.twilio.com/docs/voice/make-calls).

  • twiml (String) (defaults to: :unset)

    TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both ‘twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters.

  • application_sid (String) (defaults to: :unset)

    The SID of the Application resource that will handle the call, if the call will be handled by an application.

Returns:



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 206

def (
  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, 
  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, 
  machine_detection_speech_threshold: :unset, 
  machine_detection_speech_end_threshold: :unset, 
  machine_detection_silence_timeout: :unset, 
  async_amd: :unset, 
  async_amd_status_callback: :unset, 
  async_amd_status_callback_method: :unset, 
  byoc: :unset, 
  call_reason: :unset, 
  call_token: :unset, 
  recording_track: :unset, 
  time_limit: :unset, 
  client_notification_url: :unset, 
  url: :unset, 
  twiml: :unset, 
  application_sid: :unset
)

    data = Twilio::Values.of({
        'To' => to,
        'From' => from,
        'Method' => method,
        'FallbackUrl' => fallback_url,
        'FallbackMethod' => fallback_method,
        'StatusCallback' => status_callback,
        'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
        'StatusCallbackMethod' => status_callback_method,
        'SendDigits' => send_digits,
        'Timeout' => timeout,
        'Record' => record,
        'RecordingChannels' => recording_channels,
        'RecordingStatusCallback' => recording_status_callback,
        'RecordingStatusCallbackMethod' => recording_status_callback_method,
        'SipAuthUsername' => sip_auth_username,
        'SipAuthPassword' => sip_auth_password,
        'MachineDetection' => machine_detection,
        'MachineDetectionTimeout' => machine_detection_timeout,
        'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
        'Trim' => trim,
        'CallerId' => caller_id,
        'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold,
        'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold,
        'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout,
        'AsyncAmd' => async_amd,
        'AsyncAmdStatusCallback' => async_amd_status_callback,
        'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method,
        'Byoc' => byoc,
        'CallReason' => call_reason,
        'CallToken' => call_token,
        'RecordingTrack' => recording_track,
        'TimeLimit' => time_limit,
        'ClientNotificationUrl' => client_notification_url,
        'Url' => url,
        'Twiml' => twiml,
        'ApplicationSid' => application_sid,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    call_instance = CallInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
    )
    CallInstanceMetadata.new(
        @version,
        call_instance,
        response.headers,
        response.status_code
    )
end

#eachObject

When passed a block, yields CallInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.



429
430
431
432
433
434
435
436
437
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 429

def each
    limits = @version.read_limits

    page = self.page(page_size: limits[:page_size], )

    @version.stream(page,
        limit: limits[:limit],
        page_limit: limits[:page_limit]).each {|x| yield x}
end

#get_page(target_url) ⇒ Page

Retrieve a single page of CallInstance records from the API. Request is executed immediately.

Parameters:

  • target_url (String)

    API-generated URL for the requested results page

Returns:

  • (Page)

    Page of CallInstance



486
487
488
489
490
491
492
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 486

def get_page(target_url)
    response = @version.domain.request(
        'GET',
        target_url
    )
CallPage.new(@version, response, @solution)
end

#list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array

Lists CallInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.

Parameters:

  • to (String) (defaults to: :unset)

    Only show calls made to this phone number, SIP address, Client identifier or SIM SID.

  • from (String) (defaults to: :unset)

    Only include calls from this phone number, SIP address, Client identifier or SIM SID.

  • parent_call_sid (String) (defaults to: :unset)

    Only include calls spawned by calls with this SID.

  • status (Status) (defaults to: :unset)

    The status of the calls to include. Can be: ‘queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`.

  • start_time (Time) (defaults to: :unset)

    Only include calls that started on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date.

  • start_time_before (Time) (defaults to: :unset)

    Only include calls that started before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started before this date.

  • start_time_after (Time) (defaults to: :unset)

    Only include calls that started on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on or after this date.

  • end_time (Time) (defaults to: :unset)

    Only include calls that ended on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date.

  • end_time_before (Time) (defaults to: :unset)

    Only include calls that ended before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended before this date.

  • end_time_after (Time) (defaults to: :unset)

    Only include calls that ended on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on or after this date.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Array)

    Array of up to limit results



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 326

def list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil)
    self.stream(
        to: to,
        from: from,
        parent_call_sid: parent_call_sid,
        status: status,
        start_time: start_time,
        start_time_before: start_time_before,
        start_time_after: start_time_after,
        end_time: end_time,
        end_time_before: end_time_before,
        end_time_after: end_time_after,
        limit: limit,
        page_size: page_size
    ).entries
end

#list_with_metadata(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array

Returns Array of up to limit results.

Parameters:

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Array)

    Array of up to limit results



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 402

def (to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil)
    limits = @version.read_limits(limit, page_size)
    params = Twilio::Values.of({
        'To' => to,
        'From' => from,
        'ParentCallSid' => parent_call_sid,
        'Status' => status,
        'StartTime' =>  Twilio.serialize_iso8601_datetime(start_time),
        'StartTime<' =>  Twilio.serialize_iso8601_datetime(start_time_before),
        'StartTime>' =>  Twilio.serialize_iso8601_datetime(start_time_after),
        'EndTime' =>  Twilio.serialize_iso8601_datetime(end_time),
        'EndTime<' =>  Twilio.serialize_iso8601_datetime(end_time_before),
        'EndTime>' =>  Twilio.serialize_iso8601_datetime(end_time_after),
        
        'PageSize' => limits[:page_size],
    });
    headers = Twilio::Values.of({})

    response = @version.page('GET', @uri, params: params, headers: headers)

    CallPageMetadata.new(@version, response, @solution, limits[:limit])
end

#page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page

Retrieve a single page of CallInstance records from the API. Request is executed immediately.

Parameters:

  • to (String) (defaults to: :unset)

    Only show calls made to this phone number, SIP address, Client identifier or SIM SID.

  • from (String) (defaults to: :unset)

    Only include calls from this phone number, SIP address, Client identifier or SIM SID.

  • parent_call_sid (String) (defaults to: :unset)

    Only include calls spawned by calls with this SID.

  • status (Status) (defaults to: :unset)

    The status of the calls to include. Can be: ‘queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`.

  • start_time (Time) (defaults to: :unset)

    Only include calls that started on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date.

  • start_time_before (Time) (defaults to: :unset)

    Only include calls that started before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started before this date.

  • start_time_after (Time) (defaults to: :unset)

    Only include calls that started on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on or after this date.

  • end_time (Time) (defaults to: :unset)

    Only include calls that ended on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date.

  • end_time_before (Time) (defaults to: :unset)

    Only include calls that ended before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended before this date.

  • end_time_after (Time) (defaults to: :unset)

    Only include calls that ended on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on or after this date.

  • page_token (String) (defaults to: :unset)

    PageToken provided by the API

  • page_number (Integer) (defaults to: :unset)

    Page Number, this value is simply for client state

  • page_size (Integer) (defaults to: :unset)

    Number of records to return, defaults to 50

Returns:

  • (Page)

    Page of CallInstance



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 456

def page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, page_token: :unset, page_number: :unset,page_size: :unset)
    params = Twilio::Values.of({
        'To' => to,
        'From' => from,
        'ParentCallSid' => parent_call_sid,
        'Status' => status,
        'StartTime' =>  Twilio.serialize_iso8601_datetime(start_time),
        'StartTime<' =>  Twilio.serialize_iso8601_datetime(start_time_before),
        'StartTime>' =>  Twilio.serialize_iso8601_datetime(start_time_after),
        'EndTime' =>  Twilio.serialize_iso8601_datetime(end_time),
        'EndTime<' =>  Twilio.serialize_iso8601_datetime(end_time_before),
        'EndTime>' =>  Twilio.serialize_iso8601_datetime(end_time_after),
        'PageToken' => page_token,
        'Page' => page_number,
        'PageSize' => page_size,
    })
    headers = Twilio::Values.of({})
    
    

    response = @version.page('GET', @uri, params: params, headers: headers)

    CallPage.new(@version, response, @solution)
end

#stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Enumerable

Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.

Parameters:

  • to (String) (defaults to: :unset)

    Only show calls made to this phone number, SIP address, Client identifier or SIM SID.

  • from (String) (defaults to: :unset)

    Only include calls from this phone number, SIP address, Client identifier or SIM SID.

  • parent_call_sid (String) (defaults to: :unset)

    Only include calls spawned by calls with this SID.

  • status (Status) (defaults to: :unset)

    The status of the calls to include. Can be: ‘queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`.

  • start_time (Time) (defaults to: :unset)

    Only include calls that started on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date.

  • start_time_before (Time) (defaults to: :unset)

    Only include calls that started before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started before this date.

  • start_time_after (Time) (defaults to: :unset)

    Only include calls that started on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on or after this date.

  • end_time (Time) (defaults to: :unset)

    Only include calls that ended on this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date.

  • end_time_before (Time) (defaults to: :unset)

    Only include calls that ended before this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended before this date.

  • end_time_after (Time) (defaults to: :unset)

    Only include calls that ended on or after this date. Specify a date as ‘YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on or after this date.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Enumerable)

    Enumerable that will yield up to limit results



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 364

def stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil)
    limits = @version.read_limits(limit, page_size)

    page = self.page(
        to: to,
        from: from,
        parent_call_sid: parent_call_sid,
        status: status,
        start_time: start_time,
        start_time_before: start_time_before,
        start_time_after: start_time_after,
        end_time: end_time,
        end_time_before: end_time_before,
        end_time_after: end_time_after,
        page_size: limits[:page_size], )

    @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end

#to_sObject

Provide a user friendly representation



497
498
499
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 497

def to_s
    '#<Twilio.Api.V2010.CallList>'
end