# outboundStream

Method: CHANNEL
Version: 1.0.1

## Message:

  - `ConnectRequest` (unknown)

  - `AnswerResponse` (unknown)

  - `TextMessage` (unknown)

  - `TextResponseMessage` (unknown)

  - `InterruptDetect` (unknown)

  - `Interrupt` (unknown)

  - `DtmfReceive` (unknown)

  - `DtmfSend` (unknown)

  - `PlaybackEvent` (unknown)

## Message payload:

  - `command` (string, required)
    Connect message
    Enum: "connect"

  - `version` (integer, required)
    Protocol version
    Enum: "1"

  - `callId` (string, required)
    Unique Call ID

  - `serviceId` (string, required)
    Service Unique ID

  - `sttLanguage` (string, required)
    BCP-47 language tag used for speech-to-text transcription of the inbound audio.

This is the language set in the SVAML command when the voice relay session was initiated.
    Example: en-US

  - `ttsVoice` (string, required)
    Name of the default voice that will be used when synthesizing speech.

This is the TTS voice name set in the SVAML command when the voice relay session was initiated.

  - `interruptionsEnabled` (boolean, required)
    Indicates if automatic interruption on detected speech is enabled for this session.

  - `callHeaders` (object, required)
    Arbitrary key/value pairs (header name -> header value).

  - `command` (string, required)
    Enum: "answer"

  - `command` (string, required)
    Enum: "text"

  - `text` (string, required)
    Transcribed text from the voice channel. This is the speech-to-text output of the incoming audio.

  - `sttLanguage` (string, required)
    BCP-47 language tag used for speech-to-text transcription of the inbound audio.

  - `isCorrection` (boolean, required)
    Indicates whether this message corrects a previous transcription. 

This occurs when additional speech is detected after a pause, refining the earlier transcription result.

  - `command` (string, required)
    Enum: "text"

  - `text` (string, required)
    Plain text or SSML to synthesize and play on the active voice channel.
When streaming, send this field in multiple messages with `isLast: false` until
the final chunk, which must have `isLast: true`.
When using SSML, tags must not span across message boundaries within a batch.
Each chunk must be independently valid XML if SSML is used.

  - `format` (string)
    Enum: "TEXT", "SSML"

  - `ttsVoice` (string)
    Name of the TTS voice to use for this batch.

Only the value from the first message in a batch takes effect; this field is ignored
on subsequent messages in the same batch. If omitted, the default voice configured
when the session was initiated is used.

  - `isLast` (boolean, required)
    Indicates whether this is the final message in the current TTS batch.
Set to `false` on all intermediate chunks and `true` on the last chunk to signal
the end of the batch and trigger an audio flush. The next message with `isLast: false`
begins a new batch.

  - `isInterruptible` (boolean)
    Controls whether speech detected on the voice channel can automatically interrupt
this TTS batch.
Overrides the `enableInterruptions` setting from the session for this batch only.
Even when set to `false`, playback can still be stopped by explicitly sending an
`interrupt` command over the WebSocket. Defaults to `true` when not specified.

  - `command` (string, required)
    Enum: "interrupt"

  - `reason` (string, required)
    The reason that triggered the interrupt message.
    Enum: "speech-detected"

  - `command` (string, required)
    Enum: "interrupt"

  - `command` (string, required)
    Enum: "dtmf"

  - `sequence` (string, required)
    A single or multiple DTMF tones.

  - `command` (string, required)
    Enum: "dtmf"

  - `sequence` (string, required)
    A single or multiple DTMF tones.

  - `command` (string, required)
    Identifies the type of playback event.
    Enum: "textPlaybackStart", "textPlaybackStop", "textPlaybackCancel"

  - `batchSequence` (integer, required)
    Auto-incrementing sequence number that identifies the TTS batch this event relates to.
The sequence starts at `0` for the first batch sent after the session is accepted and
increments by `1` for each subsequent batch. Use this value to correlate playback
events with the `textResponse` messages sent from the server.

