{"items":[{"type":"link","label":"Voice Stream","link":"/docs/voice-2.0/api-reference/stream","routeSlug":"/docs/voice-2.0/api-reference/stream","content":{"contentType":"overview","children":[{"nodeType":"container","panels":[{"title":"Download AsyncAPI description","titleTranslationKey":"download.description.title","children":[{"kind":"download","label":"stream.json","url":"/_bundle/docs/voice-2.0/api-reference/stream.json?download"},{"kind":"download","label":"stream.yaml","url":"/_bundle/docs/voice-2.0/api-reference/stream.yaml?download"}]},{"title":"Overview","titleTranslationKey":"info.title","children":[]}],"children":[{"nodeType":"overview-section-wrapper","children":[{"nodeType":"header","showPageActions":true,"level":1,"label":"Voice Stream 1.0.0"},{"nodeType":"overview-section-wrapper","children":[{"nodeType":"markdoc","content":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"WebSocket-based API for bidirectional voice streaming between the Sinch platform and customer endpoints."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"This service enables real-time audio streaming for outbound calls, supporting use cases such as AI-powered voice assistants,"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"interactive voice applications, and custom telephony integrations."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Key Features:"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"list","attributes":{"ordered":false,"marker":"-"},"children":[{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Bidirectional audio streaming using PCM-encoded audio frames"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Flexible audio chunk sizes (e.g., 20ms frames or larger buffered chunks)"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Stream control commands for audio buffer management and connection keep-alive"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Support for call acceptance, rejection, and busy signaling"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Audio Buffering:"},"children":[]}]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"The platform buffers incoming audio and plays it out to the caller. Use the "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"clear"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" command to discard buffered audio"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"that has not yet been played, enabling real-time interruptions for interactive applications like chatbots. The maximum buffer"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"is 5MBs per call. If exceeded, older data will be discarded."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Connection Flow:"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"list","attributes":{"ordered":true,"marker":"."},"children":[{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Platform initiates connection with "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"ConnectRequest"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Client responds with "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"answer"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":", "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"busy"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":", or "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"reject"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"If answered, bidirectional audio streaming begins"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Either party can send audio frames as binary WebSocket messages"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Client can send control commands ("},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"clear"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":", "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"heartbeat"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":") during the stream"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Connection Loss:"},"children":[]}]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"There is no reconnection mechanism. If the WebSocket connection is lost for any reason, the call is immediately considered hung up and cannot be recovered."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Latency:"},"children":[]}]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"End-to-end audio latency is the sum of network round-trip time and platform buffering delay. Sending smaller frames (e.g. 20ms)"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"reduces buffering delay but increases per-frame overhead; larger frames reduce overhead at the cost of higher latency."},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Audio sent to the platform is queued in the playback buffer before being played out to the caller, so a large backlog of"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"buffered audio will delay playback. Use the "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"clear"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" command to flush unplayed audio when low latency is required,"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"for example to interrupt ongoing playback in conversational applications."},"children":[]}]}]}]}],"sectionId":"/docs/voice-2.0/api-reference/stream"}],"sectionId":"/docs/voice-2.0/api-reference/stream"}]}]}},{"label":"customer/defined","type":"group","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream","httpVerb":"channel","badges":[],"metadata":{"seo":{"title":"customer/defined"}},"content":{"contentType":"item","itemVariant":"channel","meta":{"name":"customer/defined","pointer":"/channels/outboundStream","protocolTag":{"label":"Channel","color":"channel"}},"seo":{"title":"customer/defined"},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":2,"label":"customer/defined","showPageActions":true,"protocolTag":{"label":"Channel","color":"channel"}},{"nodeType":"channel-address","address":"customer/defined"}]},{"nodeType":"container","children":[{"nodeType":"header","level":4,"label":"Messages","labelTranslationKey":"messages","deepLinkSuffix":"messages"},{"nodeType":"item-content","variant":"messages","messages":[{"name":"ConnectRequest","label":"ConnectRequest","schemaId":"components/messages/ConnectRequest/payload","payload":{"$ref":"#/components/schemas/ConnectRequestPayload"},"payloadLabel":"Payload"},{"name":"ConnectResponse","label":"ConnectResponse","schemaId":"components/messages/ConnectResponse/payload","payload":{"$ref":"#/components/schemas/ConnectResponsePayload"},"payloadLabel":"Payload"},{"name":"AudioFrame","label":"Audio frame (binary)","summary":"Raw PCM audio bytes sent as a WebSocket binary message","description":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Raw PCM (Pulse Code Modulation) audio bytes transmitted as a binary WebSocket frame."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Format:"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" 16-bit signed linear PCM, mono (single channel), little-endian byte order."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Frame size:"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" Audio should be sent in 20ms chunks. At 8 kHz this is 320 bytes per frame (160 samples × 2 bytes);"},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"at 16 kHz it is 640 bytes per frame. Larger chunks are accepted but increase latency."},"children":[]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"The sample rate is determined by the value specified in the SVAML "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"connectStream"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" command."},"children":[]}]}]}],"schemaId":"components/messages/AudioFrame/payload","payload":{"$ref":"#/components/schemas/AudioFramePayload"},"payloadLabel":"Payload"},{"name":"StreamControl","label":"StreamControl","summary":"Commands that can be executed on an ongoing stream.","schemaId":"components/messages/StreamControl/payload","payload":{"$ref":"#/components/schemas/StreamControlPayload"},"payloadLabel":"Payload"}],"pointer":"channels/outboundStream/messages"}],"panels":[{"children":[{"kind":"payload","panelLabel":"Payload","schemaId":"components/messages/ConnectRequest/payload","examples":[],"messagesByKey":{"ConnectRequest":{"schemaId":"components/messages/ConnectRequest/payload"},"ConnectResponse":{"schemaId":"components/messages/ConnectResponse/payload"},"AudioFrame":{"schemaId":"components/messages/AudioFrame/payload"},"StreamControl":{"schemaId":"components/messages/StreamControl/payload"}}}]}]}]},"items":[{"label":"Connection initiated from the Sinch Platform","type":"link","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/connect","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/connect","httpVerb":"send","badges":[],"metadata":{"seo":{"title":"Connection initiated from the Sinch Platform","description":"This is the first message sent from the Sinch platform for all outgoing stream connections. This message carries information about the call, including call headers, the Call-ID, Application-ID, etc. Based on the information that this command carries, the customer can make a decision if the request should be accepted or not."}},"content":{"contentType":"item","itemVariant":"channelOperation","meta":{"name":"Connection initiated from the Sinch Platform","pointer":"/operations/connect","protocolTag":{"label":"Send","color":"send"},"action":"send","actionLabel":"Send"},"seo":{"title":"Connection initiated from the Sinch Platform","description":"This is the first message sent from the Sinch platform for all outgoing stream connections.\nThis message carries information about the call, including call headers, the Call-ID, Application-ID, etc.\nBased on the information that this command carries, the customer can make a decision if the request should be accepted or not."},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":4,"label":"Send"},{"nodeType":"header","level":5,"label":"Connection initiated from the Sinch Platform","badges":[],"showPageActions":true,"protocolTag":{"label":"Send","color":"send"}},{"nodeType":"markdoc","content":"Connection initiated from the Sinch Platform"},{"nodeType":"markdoc","content":"This is the first message sent from the Sinch platform for all outgoing stream connections.\nThis message carries information about the call, including call headers, the Call-ID, Application-ID, etc.\nBased on the information that this command carries, the customer can make a decision if the request should be accepted or not."},{"nodeType":"message-links","channelLink":"/channels/outboundstream","messages":[{"name":"ConnectRequest","label":"ConnectRequest"}]}]},{"nodeType":"container","children":[{"nodeType":"feedback","pageSlug":"/channels/outboundstream/operations/connect"}],"panels":[]}],"showDivider":true}},{"label":"Platform sends audio frames to the web-socket server (binary WebSocket messages)","type":"link","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/platformtoclientaudio","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/platformtoclientaudio","httpVerb":"send","badges":[],"metadata":{"seo":{"title":"Platform sends audio frames to the web-socket server (binary WebSocket messages)","description":"Once the server answers the call, audio can flow from the platform to the server as binary WebSocket frames."}},"content":{"contentType":"item","itemVariant":"channelOperation","meta":{"name":"Platform sends audio frames to the web-socket server (binary WebSocket messages)","pointer":"/operations/platformToClientAudio","protocolTag":{"label":"Send","color":"send"},"action":"send","actionLabel":"Send"},"seo":{"title":"Platform sends audio frames to the web-socket server (binary WebSocket messages)","description":"Once the server answers the call, audio can flow from the platform to the server as binary WebSocket frames."},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":5,"label":"Platform sends audio frames to the web-socket server (binary WebSocket messages)","badges":[],"showPageActions":true,"protocolTag":{"label":"Send","color":"send"}},{"nodeType":"markdoc","content":"Platform sends audio frames to the web-socket server (binary WebSocket messages)"},{"nodeType":"markdoc","content":"Once the server answers the call, audio can flow from the platform to the server as binary WebSocket frames."},{"nodeType":"message-links","channelLink":"/channels/outboundstream","messages":[{"name":"AudioFrame","label":"Audio frame (binary)"}]}]},{"nodeType":"container","children":[{"nodeType":"feedback","pageSlug":"/channels/outboundstream/operations/platformtoclientaudio"}],"panels":[]}],"showDivider":true}},{"label":"Client responds with answer/busy/reject command","type":"link","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/connectresponse","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/connectresponse","httpVerb":"receive","badges":[],"metadata":{"seo":{"title":"Client responds with answer/busy/reject command","description":"After receiving the ConnectRequest, the server must respond with one of three commands:"}},"content":{"contentType":"item","itemVariant":"channelOperation","meta":{"name":"Client responds with answer/busy/reject command","pointer":"/operations/connectResponse","protocolTag":{"label":"Receive","color":"receive"},"action":"receive","actionLabel":"Receive"},"seo":{"title":"Client responds with answer/busy/reject command"},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":4,"label":"Receive"},{"nodeType":"header","level":5,"label":"Client responds with answer/busy/reject command","badges":[],"showPageActions":true,"protocolTag":{"label":"Receive","color":"receive"}},{"nodeType":"markdoc","content":"Client responds with answer/busy/reject command"},{"nodeType":"markdoc","content":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"After receiving the ConnectRequest, the server must respond with one of three commands:"},"children":[]}]}]},{"$$mdtype":"Node","type":"list","attributes":{"ordered":false,"marker":"-"},"children":[{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"answer"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Accept and establish the call, enabling bidirectional audio streaming"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"busy"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Indicate the endpoint is busy, which terminates the connection"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"reject"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Decline the call, which terminates the connection"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"This response determines whether the WebSocket connection proceeds to the audio streaming phase or is closed."},"children":[]}]}]}]},{"nodeType":"message-links","channelLink":"/channels/outboundstream","messages":[{"name":"ConnectResponse","label":"ConnectResponse"}]}]},{"nodeType":"container","children":[{"nodeType":"feedback","pageSlug":"/channels/outboundstream/operations/connectresponse"}],"panels":[]}],"showDivider":true}},{"label":"Client sends audio frames to the platform (binary WebSocket messages)","type":"link","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/servertoplatformaudio","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/servertoplatformaudio","httpVerb":"receive","badges":[],"metadata":{"seo":{"title":"Client sends audio frames to the platform (binary WebSocket messages)","description":"Once the server answers the call, audio can flow from the server to the platform as binary WebSocket frames."}},"content":{"contentType":"item","itemVariant":"channelOperation","meta":{"name":"Client sends audio frames to the platform (binary WebSocket messages)","pointer":"/operations/serverToPlatformAudio","protocolTag":{"label":"Receive","color":"receive"},"action":"receive","actionLabel":"Receive"},"seo":{"title":"Client sends audio frames to the platform (binary WebSocket messages)","description":"Once the server answers the call, audio can flow from the server to the platform as binary WebSocket frames."},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":5,"label":"Client sends audio frames to the platform (binary WebSocket messages)","badges":[],"showPageActions":true,"protocolTag":{"label":"Receive","color":"receive"}},{"nodeType":"markdoc","content":"Client sends audio frames to the platform (binary WebSocket messages)"},{"nodeType":"markdoc","content":"Once the server answers the call, audio can flow from the server to the platform as binary WebSocket frames."},{"nodeType":"message-links","channelLink":"/channels/outboundstream","messages":[{"name":"AudioFrame","label":"Audio frame (binary)"}]}]},{"nodeType":"container","children":[{"nodeType":"feedback","pageSlug":"/channels/outboundstream/operations/servertoplatformaudio"}],"panels":[]}],"showDivider":true}},{"label":"Client sends control messages to the platform.","type":"link","link":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/streamcommands","routeSlug":"/docs/voice-2.0/api-reference/stream/channels/outboundstream/operations/streamcommands","httpVerb":"receive","badges":[],"metadata":{"seo":{"title":"Client sends control messages to the platform.","description":"Client can send control commands to manage the audio stream during an active call.Supported commands:"}},"content":{"contentType":"item","itemVariant":"channelOperation","meta":{"name":"Client sends control messages to the platform.","pointer":"/operations/streamCommands","protocolTag":{"label":"Receive","color":"receive"},"action":"receive","actionLabel":"Receive"},"seo":{"title":"Client sends control messages to the platform."},"children":[{"nodeType":"container","children":[{"nodeType":"header","level":5,"label":"Client sends control messages to the platform.","badges":[],"showPageActions":true,"protocolTag":{"label":"Receive","color":"receive"}},{"nodeType":"markdoc","content":"Client sends control messages to the platform."},{"nodeType":"markdoc","content":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Client can send control commands to manage the audio stream during an active call."},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Supported commands:"},"children":[]}]}]},{"$$mdtype":"Node","type":"list","attributes":{"ordered":false,"marker":"-"},"children":[{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"clear"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Discard buffered audio that has not yet been played, enabling real-time interruptions"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"heartbeat"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Keep the connection alive during silence (1-minute no-audio timeout)"},"children":[]}]}]}]}]},{"nodeType":"message-links","channelLink":"/channels/outboundstream","messages":[{"name":"StreamControl","label":"StreamControl"}]}]},{"nodeType":"container","children":[{"nodeType":"feedback","pageSlug":"/channels/outboundstream/operations/streamcommands"}],"panels":[]}],"showDivider":false}}]}],"store":{"schemaStore":{"components/schemas/ConnectRequestPayload":{"id":"components/schemas/ConnectRequestPayload","kind":"json-schema","title":"ConnectRequestPayload","data":{"type":"object","required":["command","version","callId","applicationKey","codec","sampleRate","callHeaders"],"additionalProperties":false,"properties":{"command":{"type":"string","const":"connect","description":"Connect message"},"version":{"type":"integer","const":1,"description":"Protocol version"},"callId":{"type":"string","description":"Call unique identifier"},"applicationKey":{"type":"string","description":"Service unique identifier"},"codec":{"type":"string","const":"PCM","description":"Audio codec used for encoding binary audio frames transmitted over the WebSocket connection.\nAudio frames are 16-bit signed linear PCM, mono (single channel), with little-endian byte order."},"sampleRate":{"type":"integer","enum":[8000,16000,24000,44100,48000,96000],"x-enumDescriptions":{"8000":"8 kHz (standard for PSTN calls)","16000":"16 kHz (wideband audio)","24000":"24 kHz (super-wideband audio)","44100":"44.1 kHz (CD quality audio)","48000":"48 kHz (professional audio quality)","96000":"96 kHz (high-resolution audio)"},"description":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Audio sample rate in Hertz (Hz). The value is negotiated at call setup via the SVAML "},"children":[]},{"$$mdtype":"Node","type":"code","inline":true,"attributes":{"content":"connectStream"},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":" command."},"children":[]},{"$$mdtype":"Node","type":"softbreak","inline":true,"attributes":{},"children":[]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Higher sample rates provide better audio quality but increase bandwidth and processing requirements."},"children":[]}]}]},{"$$mdtype":"Node","type":"list","attributes":{"ordered":false,"marker":"-"},"children":[{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"8000 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Narrowband telephony quality (standard PSTN)"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"16000 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Wideband quality, suitable for most voice applications"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"24000 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": High-quality voice"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"44100 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": CD-quality audio"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"48000 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Professional audio standard"},"children":[]}]}]},{"$$mdtype":"Node","type":"item","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"strong","inline":true,"attributes":{"marker":"**"},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"96000 Hz"},"children":[]}]},{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":": Ultra high-quality audio"},"children":[]}]}]}]},{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"For calls traversing the PSTN, audio is typically sampled at 8 kHz; using a higher value will not improve perceived quality."},"children":[]}]}]}]},"callHeaders":{"type":"object","description":[{"$$mdtype":"Node","type":"paragraph","attributes":{},"children":[{"$$mdtype":"Node","type":"inline","attributes":{},"children":[{"$$mdtype":"Node","type":"text","inline":true,"attributes":{"content":"Arbitrary key/value pairs (header name -> header value)."},"children":[]}]}]}],"additionalProperties":{"type":"string"}}},"example":{"command":"connect","version":1,"callId":"7856b65f-e3b5-4b25-8825-77ee10b57602","applicationKey":"5c90f98a-5002-4f8a-9b02-c1cb552bed95","codec":"PCM","sampleRate":8000,"callHeaders":{"key1":"value1","key2":"value2"}}}},"components/schemas/ConnectResponsePayload":{"id":"components/schemas/ConnectResponsePayload","kind":"json-schema","title":"ConnectResponsePayload","data":{"type":"object","required":["command"],"additionalProperties":false,"properties":{"command":{"type":"string","description":"Response to the incoming connection request.","enum":["answer","busy","reject"],"x-enumDescriptions":{"answer":"Indicates that the call is accepted and answered. This enables the binary stream flow.","busy":"Indicates that the called party was busy. Closes the web-socket connection.","reject":"Indicates that the call was rejected. Closes the web-socket connection."}}},"example":{"command":"answer"}}},"components/schemas/AudioFramePayload":{"id":"components/schemas/AudioFramePayload","kind":"json-schema","title":"AudioFramePayload","data":{"type":"string","format":"binary","contentMediaType":"application/octet-stream"}},"components/schemas/StreamControlPayload":{"id":"components/schemas/StreamControlPayload","kind":"json-schema","title":"StreamControlPayload","data":{"type":"object","description":"Actions that can be performed on an ongoing stream","additionalProperties":false,"properties":{"command":{"type":"string","enum":["clear","heartbeat"],"x-enumDescriptions":{"clear":"Clears the audio buffer on the Sinch platform. Use this command to discard any buffered audio data that has not yet been played out to the caller.","heartbeat":"Indicates that the connection is still active. Use this command during periods of silence to prevent timeout and maintain the stream connection. The no-audio timeout is 1 minute."}}}}},"components/messages/ConnectRequest/payload":{"id":"components/messages/ConnectRequest/payload","kind":"json-schema","title":"ConnectRequest payload","data":{"$ref":"#/components/schemas/ConnectRequestPayload"}},"components/messages/ConnectResponse/payload":{"id":"components/messages/ConnectResponse/payload","kind":"json-schema","title":"ConnectResponse payload","data":{"$ref":"#/components/schemas/ConnectResponsePayload"}},"components/messages/AudioFrame/payload":{"id":"components/messages/AudioFrame/payload","kind":"json-schema","title":"AudioFrame payload","data":{"$ref":"#/components/schemas/AudioFramePayload"}},"components/messages/StreamControl/payload":{"id":"components/messages/StreamControl/payload","kind":"json-schema","title":"StreamControl payload","data":{"$ref":"#/components/schemas/StreamControlPayload"}}},"exampleStore":{},"securitySchemeStore":{},"specType":"asyncapi"},"options":{"mockServer":{"url":"/_mock/docs/voice-2.0/api-reference/stream","position":"off","description":"Mock server"},"disableRouter":true,"downloadUrls":[{"url":"/_bundle/docs/voice-2.0/api-reference/stream.json?download"},{"url":"/_bundle/docs/voice-2.0/api-reference/stream.yaml?download"}],"excludeFromSearch":false,"replayFeatures":{"graphql":false},"specType":"asyncapi","markdocOptions":{"tags":{},"nodes":{},"components":{}},"metadata":{"title":"Voice Stream","description":"WebSocket-based API for bidirectional voice streaming between the Sinch platform and customer endpoints.\n\nThis service enables real-time audio streaming for outbound calls, supporting use cases such as AI-powered voice assistants,\ninteractive voice applications, and custom telephony integrations.\n\n**Key Features:**\n- Bidirectional audio streaming using PCM-encoded audio frames\n- Flexible audio chunk sizes (e.g., 20ms frames or larger buffered chunks)\n- Stream control commands for audio buffer management and connection keep-alive\n- Support for call acceptance, rejection, and busy signaling\n\n**Audio Buffering:**\nThe platform buffers incoming audio and plays it out to the caller. Use the `clear` command to discard buffered audio\nthat has not yet been played, enabling real-time interruptions for interactive applications like chatbots. The maximum buffer\nis 5MBs per call. If exceeded, older data will be discarded.\n\n**Connection Flow:**\n1. Platform initiates connection with `ConnectRequest`\n2. Client responds with `answer`, `busy`, or `reject`\n3. If answered, bidirectional audio streaming begins\n4. Either party can send audio frames as binary WebSocket messages\n5. Client can send control commands (`clear`, `heartbeat`) during the stream\n\n**Connection Loss:**\nThere is no reconnection mechanism. If the WebSocket connection is lost for any reason, the call is immediately considered hung up and cannot be recovered.\n\n**Latency:**\nEnd-to-end audio latency is the sum of network round-trip time and platform buffering delay. Sending smaller frames (e.g. 20ms)\nreduces buffering delay but increases per-frame overhead; larger frames reduce overhead at the cost of higher latency.\nAudio sent to the platform is queued in the playback buffer before being played out to the caller, so a large backlog of\nbuffered audio will delay playback. Use the `clear` command to flush unplayed audio when low latency is required,\nfor example to interrupt ongoing playback in conversational applications."}},"baseSlug":"/docs/voice-2.0/api-reference/stream","routesMapping":{}}