Class: Telnyx::Resources::Calls::Actions

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/calls/actions.rb,
sig/telnyx/resources/calls/actions.rbs

Overview

Call Control command operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Actions

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

Parameters:



1943
1944
1945
# File 'lib/telnyx/resources/calls/actions.rb', line 1943

def initialize(client:)
  @client = client
end

Instance Method Details

#add_ai_assistant_messages(call_control_id, client_state: nil, command_id: nil, messages: nil, trigger_response: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionAddAIAssistantMessagesResponse

Some parameter documentations has been truncated, see Models::Calls::ActionAddAIAssistantMessagesParams for more details.

Add messages to the conversation started by an AI assistant on the call.

Parameters:

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/calls/actions.rb', line 30

def add_ai_assistant_messages(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionAddAIAssistantMessagesParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/ai_assistant_add_messages", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionAddAIAssistantMessagesResponse,
    options: options
  )
end

#answer(call_control_id, assistant: nil, billing_group_id: nil, client_state: nil, command_id: nil, conversation_relay_config: nil, custom_headers: nil, deepfake_detection: nil, preferred_codecs: nil, record: nil, record_channels: nil, record_custom_file_name: nil, record_format: nil, record_max_length: nil, record_timeout_secs: nil, record_track: nil, record_trim: nil, send_silence_when_idle: nil, sip_headers: nil, sound_modifications: nil, stream_bidirectional_codec: nil, stream_bidirectional_mode: nil, stream_bidirectional_target_legs: nil, stream_codec: nil, stream_track: nil, stream_url: nil, transcription: nil, transcription_config: nil, webhook_retries_policies: nil, webhook_url: nil, webhook_url_method: nil, webhook_urls: nil, webhook_urls_method: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionAnswerResponse

Some parameter documentations has been truncated, see Models::Calls::ActionAnswerParams for more details.

Answer an incoming call. You must issue this command before executing subsequent commands on an incoming call.

Expected Webhooks:

  • call.answered
  • call.hold and call.unhold if the call is held/unheld
  • call.deepfake_detection.result if deepfake_detection was enabled
  • call.deepfake_detection.error if deepfake_detection was enabled and an error occurred
  • streaming.started, streaming.stopped or streaming.failed if stream_url was set

When the record parameter is set to record-from-answer, the response will include a recording_id field.

stream_

Parameters:

Returns:

See Also:



134
135
136
137
138
139
140
141
142
143
# File 'lib/telnyx/resources/calls/actions.rb', line 134

def answer(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionAnswerParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/answer", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionAnswerResponse,
    options: options
  )
end

#bridge(call_control_id_to_bridge, call_control_id_to_bridge_with:, client_state: nil, command_id: nil, hold_after_unbridge: nil, mute_dtmf: nil, park_after_unbridge: nil, play_ringtone: nil, prevent_double_bridge: nil, queue: nil, record: nil, record_channels: nil, record_custom_file_name: nil, record_format: nil, record_max_length: nil, record_timeout_secs: nil, record_track: nil, record_trim: nil, ringtone: nil, video_room_context: nil, video_room_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionBridgeResponse

Some parameter documentations has been truncated, see Models::Calls::ActionBridgeParams for more details.

Bridge two call control calls.

Expected Webhooks:

  • call.bridged for Leg A
  • call.bridged for Leg B

call_

Parameters:

  • call_control_id_to_bridge (String)

    Unique identifier and token for controlling the call

  • call_control_id_to_bridge_with (String)

    The Call Control ID of the call you want to bridge with, can't be used together

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • hold_after_unbridge (Boolean)

    Specifies behavior after the bridge ends. If set to true, the current leg will

  • mute_dtmf (Symbol, Telnyx::Models::Calls::ActionBridgeParams::MuteDtmf)

    When enabled, DTMF tones are not passed to the call participant. The webhooks co

  • park_after_unbridge (String)

    Specifies behavior after the bridge ends (i.e. the opposite leg either hangs up

  • play_ringtone (Boolean)

    Specifies whether to play a ringtone if the call you want to bridge with has not

  • prevent_double_bridge (Boolean)

    When set to true, it prevents bridging if the target call is already bridged t

  • queue (String)

    The name of the queue you want to bridge with, can't be used together with

  • record (Symbol, Telnyx::Models::Calls::ActionBridgeParams::Record)

    Start recording automatically after an event. Disabled by default.

  • record_channels (Symbol, Telnyx::Models::Calls::ActionBridgeParams::RecordChannels)

    Defines which channel should be recorded ('single' or 'dual') when record is s

  • record_custom_file_name (String)

    The custom recording file name to be used instead of the default call_leg_id.

  • record_format (Symbol, Telnyx::Models::Calls::ActionBridgeParams::RecordFormat)

    Defines the format of the recording ('wav' or 'mp3') when record is specified.

  • record_max_length (Integer)

    Defines the maximum length for the recording in seconds when record is specifi

  • record_timeout_secs (Integer)

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

  • record_track (Symbol, Telnyx::Models::Calls::ActionBridgeParams::RecordTrack)

    The audio track to be recorded. Can be either both, inbound or outbound. I

  • record_trim (Symbol, Telnyx::Models::Calls::ActionBridgeParams::RecordTrim)

    When set to trim-silence, silence will be removed from the beginning and end o

  • ringtone (Symbol, Telnyx::Models::Calls::ActionBridgeParams::Ringtone)

    Specifies which country ringtone to play when play_ringtone is set to true.

  • video_room_context (String)

    The additional parameter that will be passed to the video conference. It is a te

  • video_room_id (String)

    The ID of the video room you want to bridge with, can't be used together with ca

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

Returns:

See Also:



205
206
207
208
209
210
211
212
213
214
# File 'lib/telnyx/resources/calls/actions.rb', line 205

def bridge(call_control_id_to_bridge, params)
  parsed, options = Telnyx::Calls::ActionBridgeParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/bridge", call_control_id_to_bridge],
    body: parsed,
    model: Telnyx::Models::Calls::ActionBridgeResponse,
    options: options
  )
end

#enqueue(call_control_id, queue_name:, client_state: nil, command_id: nil, keep_after_hangup: nil, max_size: nil, max_wait_time_secs: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionEnqueueResponse

Some parameter documentations has been truncated, see Models::Calls::ActionEnqueueParams for more details.

Put the call in a queue.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • queue_name (String)

    The name of the queue the call should be put in. If a queue with a given name do

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • keep_after_hangup (Boolean)

    If set to true, the call will remain in the queue after hangup. In this case bri

  • max_size (Integer)

    The maximum number of calls allowed in the queue at a given time. Can't be modif

  • max_wait_time_secs (Integer)

    The number of seconds after which the call will be removed from the queue.

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

Returns:

See Also:



242
243
244
245
246
247
248
249
250
251
# File 'lib/telnyx/resources/calls/actions.rb', line 242

def enqueue(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionEnqueueParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/enqueue", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionEnqueueResponse,
    options: options
  )
end

#gather(call_control_id, client_state: nil, command_id: nil, gather_id: nil, initial_timeout_millis: nil, inter_digit_timeout_millis: nil, maximum_digits: nil, minimum_digits: nil, terminating_digit: nil, timeout_millis: nil, valid_digits: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionGatherResponse

Some parameter documentations has been truncated, see Models::Calls::ActionGatherParams for more details.

Gather DTMF signals to build interactive menus.

You can pass a list of valid digits. The Answer command must be issued before the gather command.

Expected Webhooks:

  • call.dtmf.received (you may receive many of these webhooks)
  • call.gather.ended

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • gather_id (String)

    An id that will be sent back in the corresponding call.gather.ended webhook. W

  • initial_timeout_millis (Integer)

    The number of milliseconds to wait for the first DTMF.

  • inter_digit_timeout_millis (Integer)

    The number of milliseconds to wait for input between digits.

  • maximum_digits (Integer)

    The maximum number of digits to fetch. This parameter has a maximum value of 128

  • minimum_digits (Integer)

    The minimum number of digits to fetch. This parameter has a minimum value of 1.

  • terminating_digit (String)

    The digit used to terminate input if fewer than maximum_digits digits have bee

  • timeout_millis (Integer)

    The number of milliseconds to wait to complete the request.

  • valid_digits (String)

    A list of all digits accepted as valid.

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

Returns:

See Also:



295
296
297
298
299
300
301
302
303
304
# File 'lib/telnyx/resources/calls/actions.rb', line 295

def gather(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionGatherParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/gather", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionGatherResponse,
    options: options
  )
end

#gather_using_ai(call_control_id, parameters:, assistant: nil, client_state: nil, command_id: nil, gather_ended_speech: nil, greeting: nil, interruption_settings: nil, language: nil, message_history: nil, send_message_history_updates: nil, send_partial_results: nil, transcription: nil, user_response_timeout_ms: nil, voice: nil, voice_settings: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionGatherUsingAIResponse

Some parameter documentations has been truncated, see Models::Calls::ActionGatherUsingAIParams for more details.

Gather parameters defined in the request payload using a voice assistant.

You can pass parameters described as a JSON Schema object and the voice assistant will attempt to gather these informations.

Expected Webhooks:

  • call.ai_gather.ended
  • call.conversation.ended
  • call.ai_gather.partial_results (if send_partial_results is set to true)
  • call.ai_gather.message_history_updated (if send_message_history_updates is set to true)

Parameters:

Returns:

See Also:



361
362
363
364
365
366
367
368
369
370
# File 'lib/telnyx/resources/calls/actions.rb', line 361

def gather_using_ai(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionGatherUsingAIParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/gather_using_ai", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionGatherUsingAIResponse,
    options: options
  )
end

#gather_using_audio(call_control_id, audio_url: nil, client_state: nil, command_id: nil, inter_digit_timeout_millis: nil, invalid_audio_url: nil, invalid_media_name: nil, maximum_digits: nil, maximum_tries: nil, media_name: nil, minimum_digits: nil, terminating_digit: nil, timeout_millis: nil, valid_digits: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionGatherUsingAudioResponse

Some parameter documentations has been truncated, see Models::Calls::ActionGatherUsingAudioParams for more details.

Play an audio file on the call until the required DTMF signals are gathered to build interactive menus.

You can pass a list of valid digits along with an 'invalid_audio_url', which will be played back at the beginning of each prompt. Playback will be interrupted when a DTMF signal is received. The Answer command must be issued before the gather_using_audio` command.

Expected Webhooks:

  • call.playback.started
  • call.playback.ended
  • call.dtmf.received (you may receive many of these webhooks)
  • call.gather.ended

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • audio_url (String)

    The URL of a file to be played back at the beginning of each prompt. The URL can

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • inter_digit_timeout_millis (Integer)

    The number of milliseconds to wait for input between digits.

  • invalid_audio_url (String)

    The URL of a file to play when digits don't match the valid_digits parameter o

  • invalid_media_name (String)

    The media_name of a file to be played back when digits don't match the `valid_di

  • maximum_digits (Integer)

    The maximum number of digits to fetch. This parameter has a maximum value of 128

  • maximum_tries (Integer)

    The maximum number of times the file should be played if there is no input from

  • media_name (String)

    The media_name of a file to be played back at the beginning of each prompt. The

  • minimum_digits (Integer)

    The minimum number of digits to fetch. This parameter has a minimum value of 1.

  • terminating_digit (String)

    The digit used to terminate input if fewer than maximum_digits digits have bee

  • timeout_millis (Integer)

    The number of milliseconds to wait for a DTMF response after file playback ends

  • valid_digits (String)

    A list of all digits accepted as valid.

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

Returns:

See Also:



425
426
427
428
429
430
431
432
433
434
# File 'lib/telnyx/resources/calls/actions.rb', line 425

def gather_using_audio(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionGatherUsingAudioParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/gather_using_audio", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionGatherUsingAudioResponse,
    options: options
  )
end

#gather_using_speak(call_control_id, payload:, voice:, client_state: nil, command_id: nil, inter_digit_timeout_millis: nil, invalid_payload: nil, language: nil, maximum_digits: nil, maximum_tries: nil, minimum_digits: nil, payload_type: nil, service_level: nil, terminating_digit: nil, timeout_millis: nil, valid_digits: nil, voice_settings: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionGatherUsingSpeakResponse

Some parameter documentations has been truncated, see Models::Calls::ActionGatherUsingSpeakParams for more details.

Convert text to speech and play it on the call until the required DTMF signals are gathered to build interactive menus.

You can pass a list of valid digits along with an 'invalid_payload', which will be played back at the beginning of each prompt. Speech will be interrupted when a DTMF signal is received. The Answer command must be issued before the gather_using_speak command.

Expected Webhooks:

  • call.dtmf.received (you may receive many of these webhooks)
  • call.gather.ended

`valid_

Parameters:

Returns:

See Also:



494
495
496
497
498
499
500
501
502
503
# File 'lib/telnyx/resources/calls/actions.rb', line 494

def gather_using_speak(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionGatherUsingSpeakParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/gather_using_speak", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionGatherUsingSpeakResponse,
    options: options
  )
end

#hangup(call_control_id, client_state: nil, command_id: nil, custom_headers: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionHangupResponse

Some parameter documentations has been truncated, see Models::Calls::ActionHangupParams for more details.

Hang up the call.

Expected Webhooks:

  • call.hangup
  • call.recording.saved

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • custom_headers (Array<Telnyx::Models::CustomSipHeader>)

    Custom headers to be added to the SIP BYE message.

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

Returns:

See Also:



530
531
532
533
534
535
536
537
538
539
# File 'lib/telnyx/resources/calls/actions.rb', line 530

def hangup(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionHangupParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/hangup", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionHangupResponse,
    options: options
  )
end

#join_ai_assistant(call_control_id, conversation_id:, participant:, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionJoinAIAssistantResponse

Some parameter documentations has been truncated, see Models::Calls::ActionJoinAIAssistantParams for more details.

Add a participant to an existing AI assistant conversation. Use this command to bring an additional call leg into a running AI conversation.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • conversation_id (String)

    The ID of the AI assistant conversation to join.

  • participant (Telnyx::Models::Calls::AIAssistantJoinParticipant)
  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



564
565
566
567
568
569
570
571
572
573
# File 'lib/telnyx/resources/calls/actions.rb', line 564

def join_ai_assistant(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionJoinAIAssistantParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/ai_assistant_join", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionJoinAIAssistantResponse,
    options: options
  )
end

#leave_queue(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionLeaveQueueResponse

Some parameter documentations has been truncated, see Models::Calls::ActionLeaveQueueParams for more details.

Removes the call from a queue.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



593
594
595
596
597
598
599
600
601
602
# File 'lib/telnyx/resources/calls/actions.rb', line 593

def leave_queue(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionLeaveQueueParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/leave_queue", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionLeaveQueueResponse,
    options: options
  )
end

#pause_recording(call_control_id, client_state: nil, command_id: nil, recording_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionPauseRecordingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionPauseRecordingParams for more details.

Pause recording the call. Recording can be resumed via Resume recording command.

Expected Webhooks:

There are no webhooks associated with this command.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • recording_id (String)

    Uniquely identifies the resource.

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

Returns:

See Also:



628
629
630
631
632
633
634
635
636
637
# File 'lib/telnyx/resources/calls/actions.rb', line 628

def pause_recording(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionPauseRecordingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/record_pause", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionPauseRecordingResponse,
    options: options
  )
end

#pay(call_control_id, amount: nil, client_state: nil, command_id: nil, connector_name: nil, currency: nil, description: nil, inter_digit_timeout_millis: nil, language: nil, max_attempts: nil, metadata: nil, parameters: nil, payment_method: nil, payment_token: nil, prompts: nil, service_level: nil, timeout_millis: nil, transaction_type: nil, voice: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionPayResponse

Some parameter documentations has been truncated, see Models::Calls::ActionPayParams for more details.

Collect payment details from the caller using DTMF and either charge or tokenize the payment method through a configured Pay connector. Pay pauses active call recordings while sensitive payment details are collected.

When payment_token is supplied, the DTMF collection steps are skipped and the existing token is sent to the connector.

Expected Webhooks:

  • call.payment.progress
  • call.payment.completed

Test mode card numbers: 4111111111111111 (Visa), 5555555555554444 (Mastercard), 378282246310005 (American Express), 6011111111111117 (Discover), 3065930009020004 (Diners Club), 3566002020360505 (JCB), 6200000000000005 (UnionPay), and 6771798021000008 (Maestro). Test-mode connectors reject other card numbers before contacting the configured processor. The UnionPay and Maestro numbers are accepted for processor testing, but Pay currently does not emit a card type for them.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • amount (Float)

    Amount to charge. Required when transaction_type is charge.

  • client_state (String)

    Base64-encoded state included in subsequent webhooks.

  • command_id (String)

    Idempotency key for the command. Telnyx ignores a duplicate command with the sam

  • connector_name (String)

    Name of the Pay connector used to process the transaction.

  • currency (Symbol, Telnyx::Models::Calls::ActionPayParams::Currency)

    Currency used for the transaction. Pay currently supports USD only.

  • description (String)

    Optional description forwarded with the payment transaction.

  • inter_digit_timeout_millis (Integer)

    Time in milliseconds to wait between consecutive DTMF digits.

  • language (String)

    Language used for payment prompts.

  • max_attempts (Integer)

    Maximum number of attempts for each payment collection step.

  • metadata (Hash{Symbol=>Object})

    Metadata forwarded to the Pay connector.

  • parameters (Hash{Symbol=>Object})

    Additional parameters forwarded to the Pay connector.

  • payment_method (Symbol, Telnyx::Models::Calls::ActionPayParams::PaymentMethod)

    Payment method to collect.

  • payment_token (String)

    Existing payment token. When supplied, payment-detail collection is skipped.

  • prompts (Telnyx::Models::Calls::ActionPayParams::Prompts)

    Custom text-to-speech prompts keyed by payment collection step.

  • service_level (String)

    Speech synthesis service level used for payment prompts. Pay defaults to `premiu

  • timeout_millis (Integer)

    Time in milliseconds to wait for DTMF input for each collection step.

  • transaction_type (Symbol, Telnyx::Models::Calls::ActionPayParams::TransactionType)

    Transaction to perform. If omitted, Pay infers tokenize when amount is absen

  • voice (String)

    Voice used for payment prompts. Accepts male, female, or a provider voice in

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

Returns:

See Also:



707
708
709
710
711
712
713
714
715
716
# File 'lib/telnyx/resources/calls/actions.rb', line 707

def pay(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionPayParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/pay", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionPayResponse,
    options: options
  )
end

#refer(call_control_id, sip_address:, client_state: nil, command_id: nil, custom_headers: nil, sip_auth_password: nil, sip_auth_username: nil, sip_headers: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionReferResponse

Some parameter documentations has been truncated, see Models::Calls::ActionReferParams for more details.

Initiate a SIP Refer on a Call Control call. You can initiate a SIP Refer at any point in the duration of a call.

Expected Webhooks:

  • call.refer.started
  • call.refer.completed
  • call.refer.failed

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • sip_address (String)

    The SIP URI to which the call will be referred to.

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid execution of duplicate commands. Telnyx will ignore subs

  • custom_headers (Array<Telnyx::Models::CustomSipHeader>)

    Custom headers to be added to the SIP INVITE.

  • sip_auth_password (String)

    SIP Authentication password used for SIP challenges.

  • sip_auth_username (String)

    SIP Authentication username used for SIP challenges.

  • sip_headers (Array<Telnyx::Models::SipHeader>)

    SIP headers to be added to the request. Currently only User-to-User header is su

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

Returns:

See Also:



753
754
755
756
757
758
759
760
761
762
# File 'lib/telnyx/resources/calls/actions.rb', line 753

def refer(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionReferParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/refer", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionReferResponse,
    options: options
  )
end

#reject(call_control_id, cause:, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionRejectResponse

Some parameter documentations has been truncated, see Models::Calls::ActionRejectParams for more details.

Reject an incoming call.

Expected Webhooks:

  • call.hangup

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • cause (Symbol, Telnyx::Models::Calls::ActionRejectParams::Cause)

    Cause for call rejection.

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



788
789
790
791
792
793
794
795
796
797
# File 'lib/telnyx/resources/calls/actions.rb', line 788

def reject(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionRejectParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/reject", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionRejectResponse,
    options: options
  )
end

#resume_recording(call_control_id, client_state: nil, command_id: nil, recording_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionResumeRecordingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionResumeRecordingParams for more details.

Resume recording the call.

Expected Webhooks:

There are no webhooks associated with this command.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • recording_id (String)

    Uniquely identifies the resource.

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

Returns:

See Also:



823
824
825
826
827
828
829
830
831
832
# File 'lib/telnyx/resources/calls/actions.rb', line 823

def resume_recording(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionResumeRecordingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/record_resume", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionResumeRecordingResponse,
    options: options
  )
end

#send_dtmf(call_control_id, digits:, client_state: nil, command_id: nil, duration_millis: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionSendDtmfResponse

Some parameter documentations has been truncated, see Models::Calls::ActionSendDtmfParams for more details.

Sends DTMF tones from this leg. DTMF tones will be heard by the other end of the call.

Expected Webhooks:

There are no webhooks associated with this command.

us

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • digits (String)

    DTMF digits to send. Valid digits are 0-9, A-D, *, and #. Pauses can be added

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • duration_millis (Integer)

    Specifies for how many milliseconds each digit will be played in the audio strea

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

Returns:

See Also:



862
863
864
865
866
867
868
869
870
871
# File 'lib/telnyx/resources/calls/actions.rb', line 862

def send_dtmf(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionSendDtmfParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/send_dtmf", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionSendDtmfResponse,
    options: options
  )
end

#send_sip_info(call_control_id, body:, content_type:, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionSendSipInfoResponse

Some parameter documentations has been truncated, see Models::Calls::ActionSendSipInfoParams for more details.

Sends SIP info from this leg.

Expected Webhooks:

  • call.sip_info.received (to be received on the target call leg)

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • body (String)

    Content of the SIP INFO

  • content_type (String)

    Content type of the INFO body. Must be MIME type compliant. There is a 1,400 byt

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



899
900
901
902
903
904
905
906
907
908
# File 'lib/telnyx/resources/calls/actions.rb', line 899

def send_sip_info(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionSendSipInfoParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/send_sip_info", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionSendSipInfoResponse,
    options: options
  )
end

#speak(call_control_id, payload:, voice:, client_state: nil, command_id: nil, language: nil, loop_: nil, payload_type: nil, service_level: nil, stop: nil, target_legs: nil, voice_settings: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionSpeakResponse

Some parameter documentations has been truncated, see Models::Calls::ActionSpeakParams for more details.

Convert text to speech and play it back on the call. If multiple speak text commands are issued consecutively, the audio files will be placed in a queue awaiting playback.

Expected Webhooks:

  • call.speak.started
  • call.speak.ended

Parameters:

Returns:

See Also:



953
954
955
956
957
958
959
960
961
962
# File 'lib/telnyx/resources/calls/actions.rb', line 953

def speak(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionSpeakParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/speak", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionSpeakResponse,
    options: options
  )
end

#start_ai_assistant(call_control_id, assistant: nil, client_state: nil, command_id: nil, greeting: nil, interruption_settings: nil, message_history: nil, participants: nil, send_message_history_updates: nil, transcription: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartAIAssistantResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartAIAssistantParams for more details.

Start an AI assistant on the call.

Expected Webhooks:

  • call.conversation.ended
  • call.conversation_insights.generated

Parameters:

Returns:

See Also:



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
# File 'lib/telnyx/resources/calls/actions.rb', line 1001

def start_ai_assistant(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartAIAssistantParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/ai_assistant_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartAIAssistantResponse,
    options: options
  )
end

#start_conversation_relay(call_control_id, assistant: nil, client_state: nil, command_id: nil, conversation_relay_dtmf_detection: nil, conversation_relay_settings: nil, conversation_relay_url: nil, custom_parameters: nil, dtmf_detection: nil, greeting: nil, interruptible: nil, interruptible_greeting: nil, interruption_settings: nil, language: nil, languages: nil, provider: nil, structured_provider: nil, transcription: nil, transcription_engine: nil, transcription_engine_config: nil, tts_provider: nil, url: nil, voice: nil, voice_settings: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartConversationRelayResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartConversationRelayParams for more details.

Start a Conversation Relay session on an active call. Conversation Relay connects the call audio to your WebSocket so your application can exchange realtime messages with the caller while Telnyx handles speech recognition and text-to-speech. Only one AI Assistant or Conversation Relay session can be active on a call at a time.

Expected Webhooks:

  • call.conversation.ended - Sent when the Conversation Relay session ends. If the customer WebSocket disconnects, the webhook payload reason is customer_disconnect.

Parameters:

Returns:

See Also:



1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
# File 'lib/telnyx/resources/calls/actions.rb', line 1082

def start_conversation_relay(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartConversationRelayParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/conversation_relay_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartConversationRelayResponse,
    options: options
  )
end

#start_forking(call_control_id, client_state: nil, command_id: nil, rx: nil, stream_type: nil, tx: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartForkingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartForkingParams for more details.

Call forking allows you to stream the media from a call to a specific target in realtime. This stream can be used to enable realtime audio analysis to support a variety of use cases, including fraud detection, or the creation of AI-generated audio responses. Requests must specify either the target attribute or the rx and tx attributes.

Expected Webhooks:

  • call.fork.started
  • call.fork.stopped

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • rx (String)

    The network target, udp:ip_address:port, where the call's incoming RTP media p

  • stream_type (Symbol, Telnyx::Models::Calls::ActionStartForkingParams::StreamType)

    Optionally specify a media type to stream. If decrypted selected, Telnyx will

  • tx (String)

    The network target, udp:ip_address:port, where the call's outgoing RTP media p

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

Returns:

See Also:



1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
# File 'lib/telnyx/resources/calls/actions.rb', line 1126

def start_forking(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartForkingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/fork_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartForkingResponse,
    options: options
  )
end

#start_noise_suppression(call_control_id, client_state: nil, command_id: nil, direction: nil, noise_suppression_engine: nil, noise_suppression_engine_config: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartNoiseSuppressionResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartNoiseSuppressionParams for more details.

Noise Suppression Start (BETA)

Parameters:

Returns:

See Also:



1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
# File 'lib/telnyx/resources/calls/actions.rb', line 1161

def start_noise_suppression(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartNoiseSuppressionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/suppression_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartNoiseSuppressionResponse,
    options: options
  )
end

#start_playback(call_control_id, audio_type: nil, audio_url: nil, cache_audio: nil, client_state: nil, command_id: nil, loop_: nil, media_name: nil, overlay: nil, playback_content: nil, stop: nil, target_legs: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartPlaybackResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartPlaybackParams for more details.

Play an audio file on the call. If multiple play audio commands are issued consecutively, the audio files will be placed in a queue awaiting playback.

Notes:

  • When overlay is enabled, target_legs is limited to self.
  • A customer cannot Play Audio with overlay=true unless there is a Play Audio with overlay=false actively playing.

Expected Webhooks:

  • call.playback.started
  • call.playback.ended

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • audio_type (Symbol, Telnyx::Models::Calls::ActionStartPlaybackParams::AudioType)

    Specifies the type of audio provided in audio_url or playback_content.

  • audio_url (String)

    The URL of a file to be played back on the call. The URL can point to either a W

  • cache_audio (Boolean)

    Caches the audio file. Useful when playing the same audio file multiple times du

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • loop_ (String, Integer)

    The number of times the audio file should be played. If supplied, the value must

  • media_name (String)

    The media_name of a file to be played back on the call. The media_name must poin

  • overlay (Boolean)

    When enabled, audio will be mixed on top of any other audio that is actively bei

  • playback_content (String)

    Allows a user to provide base64 encoded mp3 or wav. Note: when using this parame

  • stop (String)

    When specified, it stops the current audio being played. Specify current to st

  • target_legs (String)

    Specifies the leg or legs on which audio will be played. If supplied, the value

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

Returns:

See Also:



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
# File 'lib/telnyx/resources/calls/actions.rb', line 1220

def start_playback(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartPlaybackParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/playback_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartPlaybackResponse,
    options: options
  )
end

#start_recording(call_control_id, channels:, format_:, client_state: nil, command_id: nil, custom_file_name: nil, max_length: nil, play_beep: nil, recording_track: nil, timeout_secs: nil, transcription: nil, transcription_engine: nil, transcription_language: nil, transcription_max_speaker_count: nil, transcription_min_speaker_count: nil, transcription_profanity_filter: nil, transcription_speaker_diarization: nil, trim: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartRecordingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartRecordingParams for more details.

Start recording the call. Recording will stop on call hang-up, or can be initiated via the Stop Recording command.

Expected Webhooks:

  • call.recording.saved
  • call.recording.transcription.saved
  • call.recording.error

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • channels (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::Channels)

    When dual, final audio file will be stereo recorded with the first leg on chan

  • format_ (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::Format)

    The audio file format used when storing the call recording. Can be either mp3

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • custom_file_name (String)

    The custom recording file name to be used instead of the default call_leg_id.

  • max_length (Integer)

    Defines the maximum length for the recording in seconds. The minimum value is 0.

  • play_beep (Boolean)

    If enabled, a beep sound will be played at the start of a recording.

  • recording_track (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::RecordingTrack)

    The audio track to be recorded. Can be either both, inbound or outbound. I

  • timeout_secs (Integer)

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

  • transcription (Boolean)

    Enable post recording transcription. The default value is false.

  • transcription_engine (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::TranscriptionEngine)

    Engine to use for speech recognition. A - Google, B - Telnyx, `deepgram/

  • transcription_language (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::TranscriptionLanguage)

    Language code for transcription. Note: Not all languages are supported by all tr

  • transcription_max_speaker_count (Integer)

    Defines maximum number of speakers in the conversation. Applies to google engi

  • transcription_min_speaker_count (Integer)

    Defines minimum number of speakers in the conversation. Applies to google engi

  • transcription_profanity_filter (Boolean)

    Enables profanity_filter. Applies to google engine only.

  • transcription_speaker_diarization (Boolean)

    Enables speaker diarization. Applies to google engine only.

  • trim (Symbol, Telnyx::Models::Calls::ActionStartRecordingParams::Trim)

    When set to trim-silence, silence will be removed from the beginning and end o

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

Returns:

See Also:



1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
# File 'lib/telnyx/resources/calls/actions.rb', line 1286

def start_recording(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionStartRecordingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/record_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartRecordingResponse,
    options: options
  )
end

#start_siprec(call_control_id, client_state: nil, connector_name: nil, include_metadata_custom_headers: nil, secure: nil, session_timeout_secs: nil, sip_transport: nil, siprec_track: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartSiprecResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartSiprecParams for more details.

Start siprec session to configured in SIPREC connector SRS.

Expected Webhooks:

  • siprec.started
  • siprec.stopped
  • siprec.failed

Parameters:

Returns:

See Also:



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/telnyx/resources/calls/actions.rb', line 1331

def start_siprec(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartSiprecParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/siprec_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartSiprecResponse,
    options: options
  )
end

#start_streaming(call_control_id, client_state: nil, command_id: nil, custom_parameters: nil, dialogflow_config: nil, enable_dialogflow: nil, stream_auth_token: nil, stream_bidirectional_codec: nil, stream_bidirectional_mode: nil, stream_bidirectional_sampling_rate: nil, stream_bidirectional_target_legs: nil, stream_codec: nil, stream_track: nil, stream_url: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartStreamingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartStreamingParams for more details.

Start streaming the media from a call to a specific WebSocket address or Dialogflow connection in near-realtime. Audio will be delivered as base64-encoded RTP payload (raw audio), wrapped in JSON payloads.

Please find more details about media streaming messages specification under the link.

stream_

Parameters:

Returns:

See Also:



1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
# File 'lib/telnyx/resources/calls/actions.rb', line 1388

def start_streaming(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartStreamingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/streaming_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartStreamingResponse,
    options: options
  )
end

#start_transcription(call_control_id, client_state: nil, command_id: nil, transcription_engine: nil, transcription_engine_config: nil, transcription_tracks: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStartTranscriptionResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStartTranscriptionParams for more details.

Start real-time transcription. Transcription will stop on call hang-up, or can be initiated via the Transcription stop command.

Expected Webhooks:

  • call.transcription

Parameters:

Returns:

See Also:



1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
# File 'lib/telnyx/resources/calls/actions.rb', line 1428

def start_transcription(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStartTranscriptionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/transcription_start", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStartTranscriptionResponse,
    options: options
  )
end

#stop_ai_assistant(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopAIAssistantResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopAIAssistantParams for more details.

Stop an AI assistant on the call.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
# File 'lib/telnyx/resources/calls/actions.rb', line 1457

def stop_ai_assistant(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopAIAssistantParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/ai_assistant_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopAIAssistantResponse,
    options: options
  )
end

#stop_conversation_relay(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopConversationRelayResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopConversationRelayParams for more details.

Stop the active Conversation Relay session on a call.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to subsequent webhooks. It must be a valid Base-64 e

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
# File 'lib/telnyx/resources/calls/actions.rb', line 1486

def stop_conversation_relay(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopConversationRelayParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/conversation_relay_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopConversationRelayResponse,
    options: options
  )
end

#stop_forking(call_control_id, client_state: nil, command_id: nil, stream_type: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopForkingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopForkingParams for more details.

Stop forking a call.

Expected Webhooks:

  • call.fork.stopped

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • stream_type (Symbol, Telnyx::Models::Calls::ActionStopForkingParams::StreamType)

    Optionally specify a stream_type. This should match the stream_type that was

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

Returns:

See Also:



1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
# File 'lib/telnyx/resources/calls/actions.rb', line 1521

def stop_forking(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopForkingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/fork_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopForkingResponse,
    options: options
  )
end

#stop_gather(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopGatherResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopGatherParams for more details.

Stop current gather.

Expected Webhooks:

  • call.gather.ended

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
# File 'lib/telnyx/resources/calls/actions.rb', line 1554

def stop_gather(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopGatherParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/gather_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopGatherResponse,
    options: options
  )
end

#stop_noise_suppression(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopNoiseSuppressionResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopNoiseSuppressionParams for more details.

Noise Suppression Stop (BETA)

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
# File 'lib/telnyx/resources/calls/actions.rb', line 1583

def stop_noise_suppression(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopNoiseSuppressionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/suppression_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopNoiseSuppressionResponse,
    options: options
  )
end

#stop_playback(call_control_id, client_state: nil, command_id: nil, overlay: nil, stop: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopPlaybackResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopPlaybackParams for more details.

Stop audio being played on the call.

Expected Webhooks:

  • call.playback.ended or call.speak.ended

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • overlay (Boolean)

    When enabled, it stops the audio being played in the overlay queue.

  • stop (String)

    Use current to stop the current audio being played. Use all to stop the curr

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

Returns:

See Also:



1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
# File 'lib/telnyx/resources/calls/actions.rb', line 1620

def stop_playback(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopPlaybackParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/playback_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopPlaybackResponse,
    options: options
  )
end

#stop_recording(call_control_id, client_state: nil, command_id: nil, recording_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopRecordingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopRecordingParams for more details.

Stop recording the call.

Expected Webhooks:

  • call.recording.saved

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • recording_id (String)

    Uniquely identifies the resource.

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

Returns:

See Also:



1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
# File 'lib/telnyx/resources/calls/actions.rb', line 1655

def stop_recording(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopRecordingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/record_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopRecordingResponse,
    options: options
  )
end

#stop_siprec(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopSiprecResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopSiprecParams for more details.

Stop SIPREC session.

Expected Webhooks:

  • siprec.stopped

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'lib/telnyx/resources/calls/actions.rb', line 1688

def stop_siprec(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopSiprecParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/siprec_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopSiprecResponse,
    options: options
  )
end

#stop_streaming(call_control_id, client_state: nil, command_id: nil, stream_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopStreamingResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopStreamingParams for more details.

Stop streaming a call to a WebSocket.

Expected Webhooks:

  • streaming.stopped

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • stream_id (String)

    Identifies the stream. If the stream_id is not provided the command stops all

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

Returns:

See Also:



1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
# File 'lib/telnyx/resources/calls/actions.rb', line 1723

def stop_streaming(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopStreamingParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/streaming_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopStreamingResponse,
    options: options
  )
end

#stop_transcription(call_control_id, client_state: nil, command_id: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionStopTranscriptionResponse

Some parameter documentations has been truncated, see Models::Calls::ActionStopTranscriptionParams for more details.

Stop real-time transcription.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

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

Returns:

See Also:



1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
# File 'lib/telnyx/resources/calls/actions.rb', line 1752

def stop_transcription(call_control_id, params = {})
  parsed, options = Telnyx::Calls::ActionStopTranscriptionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/transcription_stop", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionStopTranscriptionResponse,
    options: options
  )
end

#switch_supervisor_role(call_control_id, role:, request_options: {}) ⇒ Telnyx::Models::Calls::ActionSwitchSupervisorRoleResponse

Some parameter documentations has been truncated, see Models::Calls::ActionSwitchSupervisorRoleParams for more details.

Switch the supervisor role for a bridged call. This allows switching between different supervisor modes during an active call

Parameters:

Returns:

See Also:



1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
# File 'lib/telnyx/resources/calls/actions.rb', line 1780

def switch_supervisor_role(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionSwitchSupervisorRoleParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/switch_supervisor_role", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionSwitchSupervisorRoleResponse,
    options: options
  )
end

#transfer(call_control_id, to:, answering_machine_detection: nil, answering_machine_detection_config: nil, audio_url: nil, client_state: nil, command_id: nil, custom_headers: nil, early_media: nil, from: nil, from_display_name: nil, media_encryption: nil, media_name: nil, mute_dtmf: nil, park_after_unbridge: nil, preferred_codecs: nil, privacy: nil, record: nil, record_channels: nil, record_custom_file_name: nil, record_format: nil, record_max_length: nil, record_timeout_secs: nil, record_track: nil, record_trim: nil, route_to_mobile: nil, send_digits_on_answer: nil, sip_auth_password: nil, sip_auth_username: nil, sip_headers: nil, sip_region: nil, sip_transport_protocol: nil, sound_modifications: nil, target_leg_client_state: nil, time_limit_secs: nil, timeout_secs: nil, webhook_retries_policies: nil, webhook_url: nil, webhook_url_method: nil, webhook_urls: nil, webhook_urls_method: nil, request_options: {}) ⇒ Telnyx::Models::Calls::ActionTransferResponse

Some parameter documentations has been truncated, see Models::Calls::ActionTransferParams for more details.

Transfer a call to a new destination. If the transfer is unsuccessful, a call.hangup webhook for the other call (Leg B) will be sent indicating that the transfer could not be completed. The original call will remain active and may be issued additional commands, potentially transfering the call to an alternate destination.

Expected Webhooks:

  • call.initiated
  • call.bridged to Leg B
  • call.answered or call.hangup
  • call.machine.detection.ended if answering_machine_detection was requested
  • call.machine.greeting.ended if answering_machine_detection was requested to detect the end of machine greeting
  • call.machine.premium.detection.ended if answering_machine_detection=premium was requested
  • call.machine.premium.greeting.ended if answering_machine_detection=premium was requested and a beep was detected

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • to (String)

    The DID or SIP URI to dial out to. For SIP URI destinations, append `;secure=tru

  • answering_machine_detection (Symbol, Telnyx::Models::Calls::ActionTransferParams::AnsweringMachineDetection)

    Enables Answering Machine Detection. When a call is answered, Telnyx runs real-t

  • answering_machine_detection_config (Telnyx::Models::Calls::ActionTransferParams::AnsweringMachineDetectionConfig)

    Optional configuration parameters to modify 'answering_machine_detection' perfor

  • audio_url (String)

    The URL of a file to be played back when the transfer destination answers before

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • command_id (String)

    Use this field to avoid duplicate commands. Telnyx will ignore any command with

  • custom_headers (Array<Telnyx::Models::CustomSipHeader>)

    Custom headers to be added to the SIP INVITE.

  • early_media (Boolean)

    If set to false, early media will not be passed to the originating leg.

  • from (String)

    The from number to be used as the caller id presented to the destination (to

  • from_display_name (String)

    The from_display_name string to be used as the caller id name (SIP From Displa

  • media_encryption (Symbol, Telnyx::Models::Calls::ActionTransferParams::MediaEncryption)

    Defines whether media should be encrypted on the new call leg. For SIP URI desti

  • media_name (String)

    The media_name of a file to be played back when the transfer destination answers

  • mute_dtmf (Symbol, Telnyx::Models::Calls::ActionTransferParams::MuteDtmf)

    When enabled, DTMF tones are not passed to the call participant. The webhooks co

  • park_after_unbridge (String)

    Specifies behavior after the bridge ends (i.e. the opposite leg either hangs up

  • preferred_codecs (String)

    The list of comma-separated codecs in order of preference to be used during the

  • privacy (Symbol, Telnyx::Models::Calls::ActionTransferParams::Privacy)

    Indicates the privacy level to be used for the call. When set to id, caller ID

  • record (Symbol, Telnyx::Models::Calls::ActionTransferParams::Record)

    Start recording automatically after an event. Disabled by default.

  • record_channels (Symbol, Telnyx::Models::Calls::ActionTransferParams::RecordChannels)

    Defines which channel should be recorded ('single' or 'dual') when record is s

  • record_custom_file_name (String)

    The custom recording file name to be used instead of the default call_leg_id.

  • record_format (Symbol, Telnyx::Models::Calls::ActionTransferParams::RecordFormat)

    Defines the format of the recording ('wav' or 'mp3') when record is specified.

  • record_max_length (Integer)

    Defines the maximum length for the recording in seconds when record is specifi

  • record_timeout_secs (Integer)

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

  • record_track (Symbol, Telnyx::Models::Calls::ActionTransferParams::RecordTrack)

    The audio track to be recorded. Can be either both, inbound or outbound. I

  • record_trim (Symbol, Telnyx::Models::Calls::ActionTransferParams::RecordTrim)

    When set to trim-silence, silence will be removed from the beginning and end o

  • route_to_mobile (Boolean)

    When set to true, routes the call directly to the mobile device associated with

  • send_digits_on_answer (String)

    DTMF digits to send automatically after the transfer destination answers. Useful

  • sip_auth_password (String)

    SIP Authentication password used for SIP challenges.

  • sip_auth_username (String)

    SIP Authentication username used for SIP challenges.

  • sip_headers (Array<Telnyx::Models::SipHeader>)

    SIP headers to be added to the SIP INVITE. Currently only User-to-User header is

  • sip_region (Symbol, Telnyx::Models::Calls::ActionTransferParams::SipRegion)

    Defines the SIP region to be used for the call.

  • sip_transport_protocol (Symbol, Telnyx::Models::Calls::ActionTransferParams::SipTransportProtocol)

    Defines SIP transport protocol to be used on the call.

  • sound_modifications (Telnyx::Models::SoundModifications)

    Use this field to modify sound effects, for example adjust the pitch.

  • target_leg_client_state (String)

    Use this field to add state to every subsequent webhook for the new leg. It must

  • time_limit_secs (Integer)

    Sets the maximum duration of a Call Control Leg in seconds. If the time limit is

  • timeout_secs (Integer)

    The number of seconds that Telnyx will wait for the call to be answered by the d

  • webhook_retries_policies (Hash{Symbol=>Telnyx::Models::Calls::ActionTransferParams::WebhookRetriesPolicy})

    A map of event types to retry policies. Each retry policy contains an array of `

  • webhook_url (String)

    Use this field to override the URL for which Telnyx will send subsequent webhook

  • webhook_url_method (Symbol, Telnyx::Models::Calls::ActionTransferParams::WebhookURLMethod)

    HTTP request type used for webhook_url.

  • webhook_urls (Hash{Symbol=>String})

    A map of event types to webhook URLs. When an event of the specified type occurs

  • webhook_urls_method (Symbol, Telnyx::Models::Calls::ActionTransferParams::WebhookURLsMethod)

    HTTP request method to invoke webhook_urls.

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

Returns:

See Also:



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
# File 'lib/telnyx/resources/calls/actions.rb', line 1902

def transfer(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionTransferParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["calls/%1$s/actions/transfer", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionTransferResponse,
    options: options
  )
end

#update_client_state(call_control_id, client_state:, request_options: {}) ⇒ Telnyx::Models::Calls::ActionUpdateClientStateResponse

Some parameter documentations has been truncated, see Models::Calls::ActionUpdateClientStateParams for more details.

Updates client state

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

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

Returns:

See Also:



1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
# File 'lib/telnyx/resources/calls/actions.rb', line 1929

def update_client_state(call_control_id, params)
  parsed, options = Telnyx::Calls::ActionUpdateClientStateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["calls/%1$s/actions/client_state_update", call_control_id],
    body: parsed,
    model: Telnyx::Models::Calls::ActionUpdateClientStateResponse,
    options: options
  )
end