Ana içeriğe geç

Connect the agent's browser to this call's audio

POST 

/api/calls/:callId/webrtc

The call-id keyed form of the conversation softphone leg. connectAgent REPLACES the bridge's agent peer, so it must land on the intended call: aimed at the wrong leg it takes the agent's microphone off the conversation they are having.

Only the agent who holds the call may connect it.

LEGS AND EPOCHS (SES-1 F4). Against a bridge advertising the leg_epoch feature EVERY connect takes the fenced path: the SERVER allocates a monotonic epoch for the call and the bridge refuses anything lower or equal with leg_superseded. This is what stops a client waking from doze and retrying a stale connect from silently seizing a call that has since moved to another device — and a refusal there means NOTHING is written here.

Naming a device_id is what lets the leg be ATTRIBUTED, not what makes it fenced. A caller that omits it is fenced exactly the same way and gets a leg with no device bound — otherwise the oldest builds in the fleet would be the only ones able to seize a live leg, which is the one power the fence exists to remove.

The epoch is never accepted from the client. A caller that could choose its own generation could outrank a live leg simply by picking a large number, which is the very attack the fence exists to stop.

MAKE-BEFORE-BREAK runs on both sides. The client half this endpoint depends on and cannot enforce: the browser must already hold a real microphone track before it POSTs, so a takeover that dies at the permission prompt never took anything. The server half: a 200 records the leg as connecting only — the previous device keeps carrying the call until the bridge reports leg_connected, and a leg that never connects (leg_failed) leaves the live one entirely undisturbed.

On a bridge without leg_epoch the behaviour is exactly what it was before F4: the agent peer is replaced, and no leg is recorded. A bridge that cannot fence must not be handed a number it will ignore.

Request​

Responses​

The sidecar's SDP answer, for the browser to complete its leg.