Class: Telnyx::Resources::Texml

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

Overview

TeXML REST Commands

Defined Under Namespace

Classes: Accounts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Texml

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

Parameters:



162
163
164
165
# File 'lib/telnyx/resources/texml.rb', line 162

def initialize(client:)
  @client = client
  @accounts = Telnyx::Resources::Texml::Accounts.new(client: client)
end

Instance Attribute Details

#accountsTelnyx::Resources::Texml::Accounts (readonly)

TeXML REST Commands



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

def accounts
  @accounts
end

Instance Method Details

#initiate_ai_call(connection_id, ai_assistant_id:, from:, to:, ai_assistant_dynamic_variables: nil, ai_assistant_version: nil, async_amd: nil, async_amd_status_callback: nil, async_amd_status_callback_method: nil, caller_id: nil, conversation_callback: nil, conversation_callback_method: nil, conversation_callbacks: nil, custom_headers: nil, detection_mode: nil, machine_detection: nil, machine_detection_silence_timeout: nil, machine_detection_speech_end_threshold: nil, machine_detection_speech_threshold: nil, machine_detection_timeout: nil, passports: 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, status_callbacks: nil, time_limit: nil, timeout_seconds: nil, trim: nil, request_options: {}) ⇒ Telnyx::Models::TexmlInitiateAICallResponse

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

Initiate an outbound AI call with warm-up support. Validates parameters, builds an internal TeXML with an AI Assistant configuration, encodes instructions into client state, and calls the dial API. The Twiml, Texml, and Url parameters are not allowed and will result in a 422 error.

**Expected callback events:**

Status callbacks: ‘initiated`, `ringing`, `answered`, one terminal status (`completed`, `no-answer`, `busy`, `canceled`, or `failed`), then `analyzed` after post-call processing completes.

Conversation callbacks: ‘conversation_created` and `conversation_ended`.

Recording, AMD, transcription, and deepfake detection callbacks are only sent when those features are enabled.

Parameters:

  • connection_id (String)

    The ID of the TeXML connection to use for the call.

  • ai_assistant_id (String)

    The ID of the AI assistant to use for the call.

  • from (String)

    The phone number of the party initiating the call. Phone numbers are formatted w

  • to (String)

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

  • ai_assistant_dynamic_variables (Hash{Symbol=>String})

    Key-value map of dynamic variables to pass to the AI assistant.

  • ai_assistant_version (String)

    The version of the AI assistant to use.

  • 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::TexmlInitiateAICallParams::AsyncAmdStatusCallbackMethod)

    HTTP request type used for ‘AsyncAmdStatusCallback`.

  • caller_id (String)

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

  • conversation_callback (String)

    URL destination for Telnyx to send AI conversation callback events for this call

  • conversation_callback_method (Symbol, Telnyx::Models::TexmlInitiateAICallParams::ConversationCallbackMethod)

    HTTP request type used for ‘ConversationCallback` and `ConversationCallbacks`.

  • conversation_callbacks (Array<String>)

    Array of URL destinations for AI conversation callback events for this call. Eve

  • custom_headers (Array<Telnyx::Models::TexmlInitiateAICallParams::CustomHeader>)

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

  • detection_mode (Symbol, Telnyx::Models::TexmlInitiateAICallParams::DetectionMode)

    Allows you to choose between Premium and Standard detections.

  • machine_detection (Symbol, Telnyx::Models::TexmlInitiateAICallParams::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.

  • passports (String)

    A string of passport identifiers to associate with the call.

  • 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::TexmlInitiateAICallParams::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 ‘RecordingSt

  • recording_status_callback_method (Symbol, Telnyx::Models::TexmlInitiateAICallParams::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::TexmlInitiateAICallParams::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::TexmlInitiateAICallParams::SipRegion)

    Defines the SIP region to be used for the call.

  • status_callback (String)

    URL destination for Telnyx to send status callback events for this AI call. When

  • status_callback_event (String)

    The status callback events for which Telnyx should send a webhook for this AI ca

  • status_callback_method (Symbol, Telnyx::Models::TexmlInitiateAICallParams::StatusCallbackMethod)

    HTTP request type used for ‘StatusCallback` and `StatusCallbacks` for this AI ca

  • status_callbacks (Array<String>)

    Array of URL destinations for Telnyx to send status callback events for this AI

  • time_limit (Integer)

    The maximum duration of the call in seconds. The minimum value is 30 and the max

  • timeout_seconds (Integer)

    The number of seconds to wait for the called party to answer the call before the

  • trim (Symbol, Telnyx::Models::TexmlInitiateAICallParams::Trim)

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

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

Returns:

See Also:



117
118
119
120
121
122
123
124
125
126
# File 'lib/telnyx/resources/texml.rb', line 117

def initiate_ai_call(connection_id, params)
  parsed, options = Telnyx::TexmlInitiateAICallParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["texml/ai_calls/%1$s", connection_id],
    body: parsed,
    model: Telnyx::Models::TexmlInitiateAICallResponse,
    options: options
  )
end

#secrets(name:, value:, request_options: {}) ⇒ Telnyx::Models::TexmlSecretsResponse

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

Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side. The secrets are not visible in any logs.

Parameters:

  • name (String)

    Name used as a reference for the secret, if the name already exists within the a

  • value (String)

    Secret value which will be used when rendering the TeXML template

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

Returns:

See Also:



148
149
150
151
152
153
154
155
156
157
# File 'lib/telnyx/resources/texml.rb', line 148

def secrets(params)
  parsed, options = Telnyx::TexmlSecretsParams.dump_request(params)
  @client.request(
    method: :post,
    path: "texml/secrets",
    body: parsed,
    model: Telnyx::Models::TexmlSecretsResponse,
    options: options
  )
end