Join an in-progress call with full audio, and leave without tearing it down.
conference
The claim
A third party joins a call in progress and everyone hears them. It is the loud counterpart to whispering: no target, no mute, and a beep so the customer knows somebody arrived.
Why it holds
The part worth getting right is the exit. A visitor who hangs up must leave the call running.
How it works
The same join_conference that coaches, with the coaching turned off.
FunctionResult("Joining.").join_conference(
name=room,
muted=False, # heard by everyone
coach=None, # aimed at nobody in particular
end_on_exit=False, # a visitor, not the host
start_on_enter=False,
beep="onEnter",
)
Two fields decide what kind of arrival this is. coach aims audio at one leg; without it, speech goes to the room. muted keeps you out of the mix; without it, you are in it. Barging is both of those off, and whispering (whisper-to-an-agent-mid-call) is both on.
end_on_exit is the field that protects the call. Left at its default of false, the supervisor can drop off and the agent and customer keep talking. Set it true and every barge-in ends with the customer hung up on. The SDK helper omits fields already at their default, so end_on_exit does not appear in the emitted document at all.
beep: "onEnter" is a deliberate choice rather than a leftover. Somebody new can now hear the customer, and the customer should get some signal of it.
Two checks run before anything is emitted, and the order matters. The caller’s number has to be on the supervisor list, then the room has to be on the floor list. Both are sets in code, because barging is audible to a customer and neither is something the model gets to widen.
Limitations
The caller check is caller ID, and caller ID can be spoofed. It is a floor, not a door: require-verification-before-unlocking-tools is the same shape with a PIN behind it.
There is no notice to the agent that a supervisor arrived, other than the beep the customer also hears.
What to change first
Set end_on_exit=True and barge into a call, then hang up. The customer is disconnected, which is the failure this field exists to prevent.