{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jambonz.org/schema/verbs/stream",
  "minVersion": "0.9.6",
  "title": "Stream",
  "description": "Streams real-time call audio to an external websocket endpoint. Functionally equivalent to 'listen' — this is an alias provided for naming clarity when the intent is audio streaming rather than recording.",
  "type": "object",
  "properties": {
    "verb": {
      "const": "stream"
    },
    "id": {
      "type": "string",
      "description": "An optional unique identifier for this verb instance."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "The websocket URL to stream audio to."
    },
    "actionHook": {
      "$ref": "../components/actionHook",
      "description": "A webhook invoked when the stream ends."
    },
    "wsAuth": {
      "$ref": "../components/auth",
      "description": "Authentication credentials for the websocket connection."
    },
    "mixType": {
      "type": "string",
      "enum": [
        "mono",
        "stereo",
        "mixed"
      ],
      "description": "How to mix audio channels."
    },
    "metadata": {
      "type": "object",
      "description": "Metadata to send with the initial connection.",
      "additionalProperties": true
    },
    "sampleRate": {
      "type": "number",
      "description": "Audio sample rate in Hz.",
      "examples": [
        8000,
        16000
      ]
    },
    "finishOnKey": {
      "type": "string",
      "description": "DTMF key that ends the stream."
    },
    "maxLength": {
      "type": "number",
      "description": "Maximum duration in seconds."
    },
    "passDtmf": {
      "type": "boolean",
      "description": "Forward DTMF events to the websocket."
    },
    "playBeep": {
      "type": "boolean",
      "description": "Play a beep before streaming begins."
    },
    "disableBidirectionalAudio": {
      "type": "boolean",
      "description": "Disable receiving audio from the websocket."
    },
    "bidirectionalAudio": {
      "$ref": "../components/bidirectionalAudio",
      "description": "Bidirectional audio configuration."
    },
    "timeout": {
      "type": "number",
      "description": "Inactivity timeout in seconds."
    },
    "transcribe": {
      "$ref": "transcribe",
      "description": "Nested transcribe verb — enables simultaneous real-time transcription of the streamed audio."
    },
    "earlyMedia": {
      "type": "boolean",
      "description": "Stream audio before the call is answered."
    },
    "channel": {
      "type": "number",
      "description": "Specific audio channel to stream. Used when streaming a single channel of a multi-channel call."
    }
  },
  "required": [
    "url"
  ],
  "examples": [
    {
      "verb": "stream",
      "url": "wss://myapp.example.com/audio",
      "sampleRate": 16000,
      "mixType": "stereo"
    }
  ]
}
