How to put SIP participants on hold?
# ask-ai
b
How to put SIP participants on hold?
t
Thanks for reaching out, Vishnu. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand that you're looking for a "hold" feature for SIP participants in LiveKit. While there isn't a dedicated hold function, you can achieve a similar experience using the warm transfer workflow. This method keeps the SIP participant in the original room while the agent reaches out to another party, like a supervisor, in a separate room. Here’s a simple way to set this up: 1. Keep the SIP participant in the original room to simulate being on hold. 2. Use the
CreateSIPParticipant
API to connect the agent with another party in a new room. 3. When you're ready, use the
MoveParticipant
API to bring the new party into the original room, effectively ending the hold. This approach helps keep the SIP participant connected but inactive until you’re ready to continue. If you’d like, I’m here to walk you through any part of this or answer any questions you have! Sources: examples/voice_agents/error_callback.py
b
can I create a room with more than one SIP participants and no agent?
t
Absolutely! You can definitely create a room with multiple SIP participants in LiveKit without needing an agent to be there. SIP participants can join a room directly using dispatch rules like Direct Dispatch, which helps route calls to a specific room name. There’s no requirement for an agent to be present in the room. Rooms can either be created explicitly through the API or they’ll be created automatically when the first participant (including SIP participants) joins. If you’d like, I’m here to help with any more details or guide you through setting this up—just let me know! Sources: Connecting to LiveKit | LiveKit docs | test/lktest/livekit.go | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | Agent dispatch | LiveKit Docs
b
what about putting participants in such rooms on hold and back?
t
While LiveKit doesn’t offer a built-in "hold" API specifically for SIP participants, you can definitely create this feature within your application. Here’s a friendly guide on how to manage hold for multiple SIP participants in a room: 1. Mute the audio input and output for the participants so they’re gently isolated from the room’s audio. 2. Use the
BackgroundAudioPlayer
to play some hold music or messages, keeping things smooth and engaging for the participants. 3. Keep track of each participant’s hold status by using metadata or your application’s state management. 4. For handling multiple participants, the
ListParticipants
API is your friend—it helps you identify SIP participants and apply the hold logic to each one thoughtfully. If you’d like, I’m here to walk you through any part of this or provide more details. Just let me know how I can help! Sources: examples/warm-transfer/warm_transfer.py | SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | Managing participants | LiveKit docs | pkg/sip/inbound.go | Agent-assisted warm transfer | LiveKit Docs
b
1. Mute the audio input and output for the participants so they’re gently isolated from the room’s audio. --- How?
t
Hi there! To help you mute the audio input and output for SIP participants in LiveKit, here’s a simple guide you can follow: • Muting Audio Input (Microphone): ◦ You can use the
MutePublishedTrack
API to mute the participant’s audio track. Just make sure you have the room name, the participant’s identity, and the track SID of their audio track handy. ◦ Set the
muted
parameter to
true
to mute the track. ◦ Keep in mind, this action requires
roomAdmin
permissions. • Muting Audio Output (What They Hear): ◦ If you’re using an agent, you can easily toggle the audio output dynamically with
session.output.set_audio_enabled(False)
in your agent scripts. ◦ For other cases without an agent, there isn’t a direct API to mute audio output for SIP participants, but you can control what they hear by managing the tracks published to the room. If anything isn’t clear or you’d like a hand with the implementation, please don’t hesitate to reach out—I’m here to help! Sources: Managing participants | LiveKit docs | Camera & microphone | LiveKit Docs | Text and transcriptions | LiveKit docs | livekit-agents/livekit/agents/voice/io.py | Subscribing to tracks | LiveKit docs