Nouns

<ConversationRelay>

Bridge the call to your AI voice agent over a JSON WebSocket — the platform runs speech recognition and synthesis in-line.

Used inside <Connect>.

Example

<Response>
  <Connect action="https://app.example.com/relay-done">
    <ConversationRelay url="wss://bot.example.com/relay"
                       voice="alice" language="en-US"
                       welcomeGreeting="Hi! How can I help you today?"/>
  </Connect>
</Response>

Attributes

Attribute Default Behaviour
url required wss:// endpoint of your application's JSON WebSocket. Your endpoint receives finalized transcripts and replies with text to speak — it never touches raw audio.
voice engine default Synthesis voice used when speaking your application's responses.
language en-US Language for the session's speech recognition and synthesis.
welcomeGreeting unset Greeting spoken to the caller when the relay session begins.

Notes

  • Messages your server receives: setup (once, with sessionId / callSid / language), prompt (each finalized caller utterance: voicePrompt / lang / last), interrupt (caller spoke over playing audio: utteranceUntilInterrupt / durationUntilInterruptMs / latestUserPartial), dtmf (keypress: digit).
  • Messages your server sends: text (token to synthesize; interruptible defaults true, preemptible defaults false, last marks the final segment), play (source URL, same interruptible/preemptible flags), end (optional handoffData surfaced verbatim on the action callback).
  • preemptible=true lets a newer text/play message abort an in-flight playback — useful when your language model corrects itself mid-response.
  • When the relay ends, the <Connect> action URL receives RelayStatus (completed/failed), RelayDuration (seconds), and HandoffData; the returned VoiceML runs on the still-live call — redirect to an agent or hang up.
  • The relay needs both a speech recognizer and a synthesis engine configured on your account (or the platform defaults); missing configuration surfaces a clear error before any WebSocket connection is attempted.
  • Not yet available: mark-event sync points, mid-session language switching, and play loop counts greater than 1.