Class: Twilio::TwiML::Connect

Inherits:
TwiML
  • Object
show all
Defined in:
lib/twilio-ruby/twiml/voice_response.rb

Overview

<Connect> TwiML Verb

Instance Attribute Summary

Attributes inherited from TwiML

#name

Instance Method Summary collapse

Methods inherited from TwiML

#add_child, #add_text, #append, #comment, to_lower_camel_case, #to_s, #xml

Constructor Details

#initialize(**keyword_args) {|_self| ... } ⇒ Connect

Returns a new instance of Connect.

Yields:

  • (_self)

Yield Parameters:



2010
2011
2012
2013
2014
2015
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2010

def initialize(**keyword_args)
  super(**keyword_args)
  @name = 'Connect'

  yield(self) if block_given?
end

Instance Method Details

#ai_session(ai_connector: nil, ai_session_configuration: nil, **keyword_args) ⇒ Object

Create a new <AiSession> element

ai_connector

The unique name or installed add-on sid that identifies the installed addon resource for the AI Connector

ai_session_configuration

The unique name or id of the AiSession Configuration resource.

keyword_args

additional attributes



2158
2159
2160
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2158

def ai_session(ai_connector: nil, ai_session_configuration: nil, **keyword_args)
  append(AiSession.new(ai_connector: ai_connector, ai_session_configuration: ai_session_configuration, **keyword_args))
end

#assistant(id: nil, language: nil, tts_language: nil, transcription_language: nil, tts_provider: nil, voice: nil, transcription_provider: nil, speech_model: nil, profanity_filter: nil, dtmf_detection: nil, welcome_greeting: nil, partial_prompts: nil, welcome_greeting_interruptible: nil, interruptible: nil, preemptible: nil, hints: nil, intelligence_service: nil, report_input_during_agent_speech: nil, elevenlabs_text_normalization: nil, interrupt_sensitivity: nil, debug: nil, **keyword_args) {|assistant| ... } ⇒ Object

Create a new <Assistant> element

id

The assistant ID of the AI Assistant

language

Language to be used for both text-to-speech and transcription

tts_language

Language to be used for text-to-speech

transcription_language

Language to be used for transcription

tts_provider

Provider to be used for text-to-speech

voice

Voice to be used for text-to-speech

transcription_provider

Provider to be used for transcription

speech_model

Speech model to be used for transcription

profanity_filter

Whether profanities should be filtered out of the speech transcription

dtmf_detection

Whether DTMF tones should be detected and reported in speech transcription

welcome_greeting

The sentence to be played automatically when the session is connected

partial_prompts

Whether partial prompts should be reported to WebSocket server before the caller finishes speaking

welcome_greeting_interruptible

“Whether and how the input from a caller, such as speaking or DTMF can interrupt the welcome greeting

interruptible

Whether and how the input from a caller, such as speaking or DTMF can interrupt the play of text-to-speech

preemptible

Whether subsequent text-to-speech or play media can interrupt the on-going play of text-to-speech or media

hints

Phrases to help better accuracy in speech recognition of these pharases

intelligence_service

The Conversational Intelligence Service id or unique name to be used for the session

report_input_during_agent_speech

Whether prompts should be reported to WebSocket server when text-to-speech playing and interrupt is disabled

elevenlabs_text_normalization

When using ElevenLabs as TTS provider, this parameter allows you to enable or disable its text normalization feature

interrupt_sensitivity

Set the sensitivity of the interrupt feature for speech. The value can be low, medium, or high

debug

Multiple debug options to be used for troubleshooting

keyword_args

additional attributes

Yields:



2146
2147
2148
2149
2150
2151
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2146

def assistant(id: nil, language: nil, tts_language: nil, transcription_language: nil, tts_provider: nil, voice: nil, transcription_provider: nil, speech_model: nil, profanity_filter: nil, dtmf_detection: nil, welcome_greeting: nil, partial_prompts: nil, welcome_greeting_interruptible: nil, interruptible: nil, preemptible: nil, hints: nil, intelligence_service: nil, report_input_during_agent_speech: nil, elevenlabs_text_normalization: nil, interrupt_sensitivity: nil, debug: nil, **keyword_args)
  assistant = Assistant.new(id: id, language: language, tts_language: tts_language, transcription_language: transcription_language, tts_provider: tts_provider, voice: voice, transcription_provider: transcription_provider, speech_model: speech_model, profanity_filter: profanity_filter, dtmf_detection: dtmf_detection, welcome_greeting: welcome_greeting, partial_prompts: partial_prompts, welcome_greeting_interruptible: welcome_greeting_interruptible, interruptible: interruptible, preemptible: preemptible, hints: hints, intelligence_service: intelligence_service, report_input_during_agent_speech: report_input_during_agent_speech, elevenlabs_text_normalization: elevenlabs_text_normalization, interrupt_sensitivity: interrupt_sensitivity, debug: debug, **keyword_args)

  yield(assistant) if block_given?
  append(assistant)
end

#autopilot(name, **keyword_args) ⇒ Object

Create a new <Autopilot> element

name

Autopilot assistant sid or unique name

keyword_args

additional attributes



2030
2031
2032
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2030

def autopilot(name, **keyword_args)
  append(Autopilot.new(name, **keyword_args))
end

#conversation(service_instance_sid: nil, inbound_autocreation: nil, routing_assignment_timeout: nil, inbound_timeout: nil, url: nil, method: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, recording_status_callback_event: nil, status_callback: nil, status_callback_method: nil, status_callback_event: nil, **keyword_args) ⇒ Object

Create a new <Conversation> element

service_instance_sid

Service instance Sid

inbound_autocreation

Inbound autocreation

routing_assignment_timeout

Routing assignment timeout

inbound_timeout

Inbound timeout

url

TwiML URL

method

TwiML URL method

record

Record

trim

Trim

recording_status_callback

Recording status callback URL

recording_status_callback_method

Recording status callback URL method

recording_status_callback_event

Recording status callback events

status_callback

Status callback URL

status_callback_method

Status callback URL method

status_callback_event

Events to call status callback URL

keyword_args

additional attributes



2082
2083
2084
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2082

def conversation(service_instance_sid: nil, inbound_autocreation: nil, routing_assignment_timeout: nil, inbound_timeout: nil, url: nil, method: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, recording_status_callback_event: nil, status_callback: nil, status_callback_method: nil, status_callback_event: nil, **keyword_args)
  append(Conversation.new(service_instance_sid: service_instance_sid, inbound_autocreation: inbound_autocreation, routing_assignment_timeout: routing_assignment_timeout, inbound_timeout: inbound_timeout, url: url, method: method, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, recording_status_callback_event: recording_status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, status_callback_event: status_callback_event, **keyword_args))
end

#conversation_relay(url: nil, language: nil, tts_language: nil, transcription_language: nil, tts_provider: nil, voice: nil, transcription_provider: nil, speech_model: nil, profanity_filter: nil, dtmf_detection: nil, welcome_greeting: nil, partial_prompts: nil, welcome_greeting_interruptible: nil, interruptible: nil, preemptible: nil, hints: nil, intelligence_service: nil, report_input_during_agent_speech: nil, elevenlabs_text_normalization: nil, interrupt_sensitivity: nil, debug: nil, backgroundNoiseReduction: nil, speechTimeout: nil, deepgramSmartFormat: nil, ignoreBackchannel: nil, events: nil, **keyword_args) {|conversation_relay| ... } ⇒ Object

Create a new <ConversationRelay> element

url

URL of the remote service where the session is connected to

language

Language to be used for both text-to-speech and transcription

tts_language

Language to be used for text-to-speech

transcription_language

Language to be used for transcription

tts_provider

Provider to be used for text-to-speech

voice

Voice to be used for text-to-speech

transcription_provider

Provider to be used for transcription

speech_model

Speech model to be used for transcription

profanity_filter

Whether profanities should be filtered out of the speech transcription

dtmf_detection

Whether DTMF tones should be detected and reported in speech transcription

welcome_greeting

The sentence to be played automatically when the session is connected

partial_prompts

Whether partial prompts should be reported to WebSocket server before the caller finishes speaking

welcome_greeting_interruptible

“Whether and how the input from a caller, such as speaking or DTMF can interrupt the welcome greeting

interruptible

Whether and how the input from a caller, such as speaking or DTMF can interrupt the play of text-to-speech

preemptible

Whether subsequent text-to-speech or play media can interrupt the on-going play of text-to-speech or media

hints

Phrases to help better accuracy in speech recognition of these pharases

intelligence_service

The Conversational Intelligence Service id or unique name to be used for the session

report_input_during_agent_speech

Whether prompts should be reported to WebSocket server when text-to-speech playing and interrupt is disabled

elevenlabs_text_normalization

When using ElevenLabs as TTS provider, this parameter allows you to enable or disable its text normalization feature

interrupt_sensitivity

Set the sensitivity of the interrupt feature for speech. The value can be low, medium, or high

debug

Multiple debug options to be used for troubleshooting

backgroundNoiseReduction

This parameters enables background noise filtering on the audio stream before it reaches the STT engine, improving transcription accuracy in noisy environments

speechTimeout

Set the duration of silence that indicates the end of speech

deepgramSmartFormat

This parameter enables Deepgram’s smart formatting feature, which automatically applies punctuation, capitalization, and formatting (e.g. numbers, dates, currency) to transcripts

ignoreBackchannel

This parameter brief caller acknowledgments (e.g. “yeah”, “uh-huh”) are ignored and will not interrupt the agent while it is speaking.

events

This parameter allows you to enable event subscriptions

keyword_args

additional attributes

Yields:



2115
2116
2117
2118
2119
2120
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2115

def conversation_relay(url: nil, language: nil, tts_language: nil, transcription_language: nil, tts_provider: nil, voice: nil, transcription_provider: nil, speech_model: nil, profanity_filter: nil, dtmf_detection: nil, welcome_greeting: nil, partial_prompts: nil, welcome_greeting_interruptible: nil, interruptible: nil, preemptible: nil, hints: nil, intelligence_service: nil, report_input_during_agent_speech: nil, elevenlabs_text_normalization: nil, interrupt_sensitivity: nil, debug: nil, backgroundNoiseReduction: nil, speechTimeout: nil, deepgramSmartFormat: nil, ignoreBackchannel: nil, events: nil, **keyword_args)
  conversation_relay = ConversationRelay.new(url: url, language: language, tts_language: tts_language, transcription_language: transcription_language, tts_provider: tts_provider, voice: voice, transcription_provider: transcription_provider, speech_model: speech_model, profanity_filter: profanity_filter, dtmf_detection: dtmf_detection, welcome_greeting: welcome_greeting, partial_prompts: partial_prompts, welcome_greeting_interruptible: welcome_greeting_interruptible, interruptible: interruptible, preemptible: preemptible, hints: hints, intelligence_service: intelligence_service, report_input_during_agent_speech: report_input_during_agent_speech, elevenlabs_text_normalization: elevenlabs_text_normalization, interrupt_sensitivity: interrupt_sensitivity, debug: debug, backgroundNoiseReduction: backgroundNoiseReduction, speechTimeout: speechTimeout, deepgramSmartFormat: deepgramSmartFormat, ignoreBackchannel: ignoreBackchannel, events: events, **keyword_args)

  yield(conversation_relay) if block_given?
  append(conversation_relay)
end

#conversation_relay_session(connector: nil, session_configuration: nil, **keyword_args) ⇒ Object

Create a new <ConversationRelaySession> element

connector

The unique name or installed add-on sid that identifies the installed addon resource for the ConversationRelaySession Connector

session_configuration

The unique name or id of the ConversationRelaySession Configuration resource.

keyword_args

additional attributes



2167
2168
2169
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2167

def conversation_relay_session(connector: nil, session_configuration: nil, **keyword_args)
  append(ConversationRelaySession.new(connector: connector, session_configuration: session_configuration, **keyword_args))
end

#room(name, participant_identity: nil, **keyword_args) ⇒ Object

Create a new <Room> element

name

Room name

participant_identity

Participant identity when connecting to the Room

keyword_args

additional attributes



2022
2023
2024
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2022

def room(name, participant_identity: nil, **keyword_args)
  append(Room.new(name, participant_identity: participant_identity, **keyword_args))
end

#stream(name: nil, connector_name: nil, url: nil, track: nil, status_callback: nil, status_callback_method: nil, **keyword_args) {|stream| ... } ⇒ Object

Create a new <Stream> element

name

Friendly name given to the Stream

connector_name

Unique name for Stream Connector

url

URL of the remote service where the Stream is routed

track

Track to be streamed to remote service

status_callback

Status Callback URL

status_callback_method

Status Callback URL method

keyword_args

additional attributes

Yields:



2043
2044
2045
2046
2047
2048
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2043

def stream(name: nil, connector_name: nil, url: nil, track: nil, status_callback: nil, status_callback_method: nil, **keyword_args)
  stream = Stream.new(name: name, connector_name: connector_name, url: url, track: track, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args)

  yield(stream) if block_given?
  append(stream)
end

#virtual_agent(connector_name: nil, language: nil, sentiment_analysis: nil, status_callback: nil, status_callback_method: nil, **keyword_args) {|virtual_agent| ... } ⇒ Object

Create a new <VirtualAgent> element

connector_name

Defines the conversation profile Dialogflow needs to use

language

Language to be used by Dialogflow to transcribe speech

sentiment_analysis

Whether sentiment analysis needs to be enabled or not

status_callback

URL to post status callbacks from Twilio

status_callback_method

HTTP method to use when requesting the status callback URL

keyword_args

additional attributes

Yields:



2058
2059
2060
2061
2062
2063
# File 'lib/twilio-ruby/twiml/voice_response.rb', line 2058

def virtual_agent(connector_name: nil, language: nil, sentiment_analysis: nil, status_callback: nil, status_callback_method: nil, **keyword_args)
  virtual_agent = VirtualAgent.new(connector_name: connector_name, language: language, sentiment_analysis: sentiment_analysis, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args)

  yield(virtual_agent) if block_given?
  append(virtual_agent)
end