Class: Telnyx::Resources::Texml::Accounts::Calls

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/texml/accounts/calls.rb,
lib/telnyx/resources/texml/accounts/calls/siprec.rb,
lib/telnyx/resources/texml/accounts/calls/streams.rb,
lib/telnyx/resources/texml/accounts/calls/recordings.rb,
lib/telnyx/resources/texml/accounts/calls/recordings_json.rb

Defined Under Namespace

Classes: Recordings, RecordingsJson, Siprec, Streams

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Calls

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Calls.

Parameters:



360
361
362
363
364
365
366
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 360

def initialize(client:)
  @client = client
  @recordings_json = Telnyx::Resources::Texml::Accounts::Calls::RecordingsJson.new(client: client)
  @recordings = Telnyx::Resources::Texml::Accounts::Calls::Recordings.new(client: client)
  @siprec = Telnyx::Resources::Texml::Accounts::Calls::Siprec.new(client: client)
  @streams = Telnyx::Resources::Texml::Accounts::Calls::Streams.new(client: client)
end

Instance Attribute Details

#recordingsTelnyx::Resources::Texml::Accounts::Calls::Recordings (readonly)



12
13
14
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 12

def recordings
  @recordings
end

#recordings_jsonTelnyx::Resources::Texml::Accounts::Calls::RecordingsJson (readonly)



9
10
11
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 9

def recordings_json
  @recordings_json
end

#siprecTelnyx::Resources::Texml::Accounts::Calls::Siprec (readonly)



15
16
17
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 15

def siprec
  @siprec
end

#streamsTelnyx::Resources::Texml::Accounts::Calls::Streams (readonly)



18
19
20
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 18

def streams
  @streams
end

Instance Method Details

#calls(account_sid, application_sid:, from:, to:, async_amd: nil, async_amd_status_callback: nil, async_amd_status_callback_method: nil, caller_id: nil, cancel_playback_on_detect_message_end: nil, cancel_playback_on_machine_detection: nil, custom_headers: nil, detection_mode: nil, fallback_url: nil, machine_detection: nil, machine_detection_silence_timeout: nil, machine_detection_speech_end_threshold: nil, machine_detection_speech_threshold: nil, machine_detection_timeout: nil, preferred_codecs: nil, record: nil, recording_channels: nil, recording_status_callback: nil, recording_status_callback_event: nil, recording_status_callback_method: nil, recording_timeout: nil, recording_track: nil, send_recording_url: nil, sip_auth_password: nil, sip_auth_username: nil, sip_region: nil, status_callback: nil, status_callback_event: nil, status_callback_method: nil, supervise_call_sid: nil, supervising_role: nil, trim: nil, url: nil, url_method: nil, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallCallsResponse

Some parameter documentations has been truncated, see Models::Texml::Accounts::CallCallsParams for more details.

Initiate an outbound TeXML call. Telnyx will request TeXML from the XML Request URL configured for the connection in the Mission Control Portal.

Parameters:

  • account_sid (String)

    The id of the account the resource belongs to.

  • application_sid (String)

    The ID of the TeXML Application.

  • from (String)

    The phone number of the party that initiated the call. Phone numbers are formatt

  • to (String)

    The phone number of the called party. Phone numbers are formatted with a ‘+` and

  • async_amd (Boolean)

    Select whether to perform answering machine detection in the background. By defa

  • async_amd_status_callback (String)

    URL destination for Telnyx to send AMD callback events to for the call.

  • async_amd_status_callback_method (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::AsyncAmdStatusCallbackMethod)

    HTTP request type used for ‘AsyncAmdStatusCallback`. The default value is inheri

  • caller_id (String)

    To be used as the caller id name (SIP From Display Name) presented to the destin

  • cancel_playback_on_detect_message_end (Boolean)

    Whether to cancel ongoing playback on ‘greeting ended` detection. Defaults to `t

  • cancel_playback_on_machine_detection (Boolean)

    Whether to cancel ongoing playback on ‘machine` detection. Defaults to `true`.

  • custom_headers (Array<Telnyx::Models::Texml::Accounts::CallCallsParams::CustomHeader>)

    Custom HTTP headers to be sent with the call. Each header should be an object wi

  • detection_mode (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::DetectionMode)

    Allows you to chose between Premium and Standard detections.

  • fallback_url (String)

    A failover URL for which Telnyx will retrieve the TeXML call instructions if the

  • machine_detection (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::MachineDetection)

    Enables Answering Machine Detection.

  • machine_detection_silence_timeout (Integer)

    If initial silence duration is greater than this value, consider it a machine. I

  • machine_detection_speech_end_threshold (Integer)

    Silence duration threshold after a greeting message or voice for it be considere

  • machine_detection_speech_threshold (Integer)

    Maximum threshold of a human greeting. If greeting longer than this value, consi

  • machine_detection_timeout (Integer)

    Maximum timeout threshold in milliseconds for overall detection.

  • preferred_codecs (String)

    The list of comma-separated codecs to be offered on a call.

  • record (Boolean)

    Whether to record the entire participant’s call leg. Defaults to ‘false`.

  • recording_channels (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::RecordingChannels)

    The number of channels in the final recording. Defaults to ‘mono`.

  • recording_status_callback (String)

    The URL the recording callbacks will be sent to.

  • recording_status_callback_event (String)

    The changes to the recording’s state that should generate a call to ‘RecoridngSt

  • recording_status_callback_method (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::RecordingStatusCallbackMethod)

    HTTP request type used for ‘RecordingStatusCallback`. Defaults to `POST`.

  • recording_timeout (Integer)

    The number of seconds that Telnyx will wait for the recording to be stopped if s

  • recording_track (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::RecordingTrack)

    The audio track to record for the call. The default is ‘both`.

  • send_recording_url (Boolean)

    Whether to send RecordingUrl in webhooks.

  • sip_auth_password (String)

    The password to use for SIP authentication.

  • sip_auth_username (String)

    The username to use for SIP authentication.

  • sip_region (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::SipRegion)

    Defines the SIP region to be used for the call.

  • status_callback (String)

    URL destination for Telnyx to send status callback events to for the call.

  • status_callback_event (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::StatusCallbackEvent)

    The call events for which Telnyx should send a webhook. Multiple events can be d

  • status_callback_method (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::StatusCallbackMethod)

    HTTP request type used for ‘StatusCallback`.

  • supervise_call_sid (String)

    The call control ID of the existing call to supervise. When provided, the create

  • supervising_role (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::SupervisingRole)

    The supervising role for the new leg. Determines the audio behavior: barge (hear

  • trim (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::Trim)

    Whether to trim any leading and trailing silence from the recording. Defaults to

  • url (String)

    The URL from which Telnyx will retrieve the TeXML call instructions.

  • url_method (Symbol, Telnyx::Models::Texml::Accounts::CallCallsParams::URLMethod)

    HTTP request type used for ‘Url`. The default value is inherited from TeXML Appl

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



186
187
188
189
190
191
192
193
194
195
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 186

def calls(, params)
  parsed, options = Telnyx::Texml::Accounts::CallCallsParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["texml/Accounts/%1$s/Calls", ],
    body: parsed,
    model: Telnyx::Models::Texml::Accounts::CallCallsResponse,
    options: options
  )
end

#retrieve(call_sid, account_sid:, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallRetrieveResponse

Returns an individual call identified by its CallSid. This endpoint is eventually consistent.

Parameters:

  • call_sid (String)

    The CallSid that identifies the call to update.

  • account_sid (String)

    The id of the account the resource belongs to.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 34

def retrieve(call_sid, params)
  parsed, options = Telnyx::Texml::Accounts::CallRetrieveParams.dump_request(params)
   =
    parsed.delete(:account_sid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["texml/Accounts/%1$s/Calls/%2$s", , call_sid],
    model: Telnyx::Models::Texml::Accounts::CallRetrieveResponse,
    options: options
  )
end

#retrieve_calls(account_sid, end_time: nil, end_time_gt: nil, end_time_lt: nil, from: nil, page: nil, page_size: nil, page_token: nil, start_time: nil, start_time_gt: nil, start_time_lt: nil, status: nil, to: nil, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallRetrieveCallsResponse

Some parameter documentations has been truncated, see Models::Texml::Accounts::CallRetrieveCallsParams for more details.

Returns multiple call resouces for an account. This endpoint is eventually consistent.

Parameters:

  • account_sid (String)

    The id of the account the resource belongs to.

  • end_time (String)

    Filters calls by their end date. Expected format is YYYY-MM-DD

  • end_time_gt (String)

    Filters calls by their end date (after). Expected format is YYYY-MM-DD

  • end_time_lt (String)

    Filters calls by their end date (before). Expected format is YYYY-MM-DD

  • from (String)

    Filters calls by the from number.

  • page (Integer)

    The number of the page to be displayed, zero-indexed, should be used in conjucti

  • page_size (Integer)

    The number of records to be displayed on a page

  • page_token (String)

    Used to request the next page of results.

  • start_time (String)

    Filters calls by their start date. Expected format is YYYY-MM-DD.

  • start_time_gt (String)

    Filters calls by their start date (after). Expected format is YYYY-MM-DD

  • start_time_lt (String)

    Filters calls by their start date (before). Expected format is YYYY-MM-DD

  • status (Symbol, Telnyx::Models::Texml::Accounts::CallRetrieveCallsParams::Status)

    Filters calls by status.

  • to (String)

    Filters calls by the to number.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 236

def retrieve_calls(, params = {})
  parsed, options = Telnyx::Texml::Accounts::CallRetrieveCallsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["texml/Accounts/%1$s/Calls", ],
    query: parsed.transform_keys(
      end_time: "EndTime",
      end_time_gt: "EndTime_gt",
      end_time_lt: "EndTime_lt",
      from: "From",
      page: "Page",
      page_size: "PageSize",
      page_token: "PageToken",
      start_time: "StartTime",
      start_time_gt: "StartTime_gt",
      start_time_lt: "StartTime_lt",
      status: "Status",
      to: "To"
    ),
    model: Telnyx::Models::Texml::Accounts::CallRetrieveCallsResponse,
    options: options
  )
end

#siprec_json(call_sid, account_sid:, connector_name: nil, include_metadata_custom_headers: nil, name: nil, secure: nil, session_timeout_secs: nil, sip_transport: nil, status_callback: nil, status_callback_method: nil, track: nil, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallSiprecJsonResponse

Some parameter documentations has been truncated, see Models::Texml::Accounts::CallSiprecJsonParams for more details.

Starts siprec session with specified parameters for call idientified by call_sid.

Parameters:

Returns:

See Also:



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 295

def siprec_json(call_sid, params)
  parsed, options = Telnyx::Texml::Accounts::CallSiprecJsonParams.dump_request(params)
   =
    parsed.delete(:account_sid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["texml/Accounts/%1$s/Calls/%2$s/Siprec.json", , call_sid],
    headers: {"content-type" => "application/x-www-form-urlencoded"},
    body: parsed,
    model: Telnyx::Models::Texml::Accounts::CallSiprecJsonResponse,
    options: options
  )
end

#streams_json(call_sid, account_sid:, bidirectional_codec: nil, bidirectional_mode: nil, name: nil, status_callback: nil, status_callback_method: nil, track: nil, url: nil, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallStreamsJsonResponse

Some parameter documentations has been truncated, see Models::Texml::Accounts::CallStreamsJsonParams for more details.

Starts streaming media from a call to a specific WebSocket address.

Parameters:

Returns:

See Also:



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 341

def streams_json(call_sid, params)
  parsed, options = Telnyx::Texml::Accounts::CallStreamsJsonParams.dump_request(params)
   =
    parsed.delete(:account_sid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["texml/Accounts/%1$s/Calls/%2$s/Streams.json", , call_sid],
    headers: {"content-type" => "application/x-www-form-urlencoded"},
    body: parsed,
    model: Telnyx::Models::Texml::Accounts::CallStreamsJsonResponse,
    options: options
  )
end

#update(call_sid, account_sid:, fallback_method: nil, fallback_url: nil, method_: nil, status: nil, status_callback: nil, status_callback_method: nil, texml: nil, url: nil, request_options: {}) ⇒ Telnyx::Models::Texml::Accounts::CallUpdateResponse

Some parameter documentations has been truncated, see Models::Texml::Accounts::CallUpdateParams for more details.

Update TeXML call. Please note that the keys present in the payload MUST BE formatted in CamelCase as specified in the example.

Parameters:

  • call_sid (String)

    Path param: The CallSid that identifies the call to update.

  • account_sid (String)

    Path param: The id of the account the resource belongs to.

  • fallback_method (Symbol, Telnyx::Models::Texml::Accounts::UpdateCall::FallbackMethod)

    Body param: HTTP request type used for ‘FallbackUrl`.

  • fallback_url (String)

    Body param: A failover URL for which Telnyx will retrieve the TeXML call instruc

  • method_ (Symbol, Telnyx::Models::Texml::Accounts::UpdateCall::Method)

    Body param: HTTP request type used for ‘Url`.

  • status (String)

    Body param: The value to set the call status to. Setting the status to completed

  • status_callback (String)

    Body param: URL destination for Telnyx to send status callback events to for the

  • status_callback_method (Symbol, Telnyx::Models::Texml::Accounts::UpdateCall::StatusCallbackMethod)

    Body param: HTTP request type used for ‘StatusCallback`.

  • texml (String)

    Body param: TeXML to replace the current one with.

  • url (String)

    Body param: The URL where TeXML will make a request to retrieve a new set of TeX

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/telnyx/resources/texml/accounts/calls.rb', line 81

def update(call_sid, params)
  parsed, options = Telnyx::Texml::Accounts::CallUpdateParams.dump_request(params)
   =
    parsed.delete(:account_sid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["texml/Accounts/%1$s/Calls/%2$s", , call_sid],
    headers: {"content-type" => "application/x-www-form-urlencoded"},
    body: parsed,
    model: Telnyx::Models::Texml::Accounts::CallUpdateResponse,
    options: options
  )
end