---
title: "Mix an audio stream into a room"
method: POST
path: "/legs/{id}/streams/{streamId}/room"
tags: ["Legs"]
---

# Mix an audio stream into a room

`POST /legs/{id}/streams/{streamId}/room`

Attaches one of the leg's secondary streams to a room, which may differ from the leg's own room — that is what lets an original audio stream and a translated one be mixed separately. A leg never hears its own other streams, whatever the routing matrix says.

## Request body

- AttachStreamRoomRequest
  - `room_id` string, required — Room to mix this stream into. May differ from the leg's own room.
  - `role` string — Routing role for the stream inside that room. The room's routing matrix decides who hears it.

## Response `200`

Updated stream

- LegStreamView
  - `id` string, required — Stream identifier, stable for the life of the dialog. The primary stream is always "0".
  - `mid` string — The stream's SDP a=mid token (RFC 5888), used to correlate it across offer/answer.
  - `index` integer, required — Position of the stream's m= line in the SDP. Fixed for the life of the dialog (RFC 3264 §8).
  - `primary` boolean, required — True for the call's main bidirectional audio stream, which cannot be removed or attached to a room independently.
  - `state` 'pending' | 'active' | 'removed', required — Negotiation state.
  - `direction` 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive', required — Negotiated media direction from this server's point of view.
  - `desired_direction` 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive' — Direction requested by the application. Survives hold/unhold, unlike the negotiated direction.
  - `codec` string — Codec negotiated for this stream. Streams on one leg may use different codecs.
  - `sample_rate` integer — Native sample rate of the stream's codec, in Hz.
  - `local_port` integer — Local RTP port. Each stream binds its own port; a shared transport is undefined without BUNDLE (RFC 9143).
  - `remote_addr` string — Remote RTP address media is currently sent to.
  - `label` string — The stream's a=label value (RFC 4574), for correlating it with external metadata.
  - `content` string — The stream's a=content value (RFC 4796), e.g. "main" for original audio and "alt" for a translated feed.
  - `lang` string — The stream's a=lang value (RFC 8866): a BCP 47 language tag such as "en" or "es-ES".
  - `room_id` string — Room this stream's audio is mixed into. A secondary stream may sit in a different room than its leg.
  - `role` string — Routing role of this stream within its room. Streams carry their own role, independent of their leg's.

## Other responses

- `400` — Invalid JSON, missing room_id, not a SIP leg, or the primary stream
- `404` — Leg, stream, or room not found
- `409` — Stream carries no audio in either direction

---

[API](https://skmtc.net/voiceblender/apis/voiceblender-api.md) · [All operations](https://skmtc.net/voiceblender/apis/voiceblender-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/voiceblender/voiceblender-api/versions/ad30827d3b57/schema)
