How do I properly hang up a SIP call using the ser...
# ask-ai
b
How do I properly hang up a SIP call using the server SDK while it's still ringing. When deleting the SIPParticipant the caller is put on hold. Same with deleting a room...
t
Thanks for reaching out, Mike. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're correct to avoid deleting the participant or room — that leaves the PSTN leg open and can put the caller on hold. To properly hang up a SIP call while it is still ringing, transfer the SIP participant to LiveKit's special "hangup" SIP URI using the server SDK's TransferSIPParticipant call. Key steps: • Call TransferSIPParticipant with
transfer_to: "sip:hungup@pstn.livekit.io"
(you can also use
sip:busy@pstn.livekit.io
or
sip:rejected@pstn.livekit.io
). • Ensure the auth token has the
sip.call
grant. • Ensure your SIP trunk/provider supports SIP REFER (e.g., Twilio PSTN Transfer enabled). Example (Go):
Copy code
_, err := sipClient.TransferSIPParticipant(ctx, &livekit.TransferSIPParticipantRequest{
  RoomName:            "your-room-name",
  ParticipantIdentity: "sip-participant-identity",
  TransferTo:          "sip:hungup@pstn.livekit.io",
})
Example (Python):
Copy code
await lkapi.sip.transfer_sip_participant(
  TransferSIPParticipantRequest(
    room_name="your-room-name",
    participant_identity="sip-participant-identity",
    transfer_to="sip:hungup@pstn.livekit.io"
  )
)
Would you like the exact request shape for your language or help checking the
sip.call
grant on your token? Sources: Call forwarding | LiveKit docs