How would I listen to when a call is hung up by th...
# ask-ai
m
How would I listen to when a call is hung up by the user / agent? I want to do an action when the call is finished.
t
Thanks for reaching out, Alexander. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m happy to help you detect when a call is hung up by a user or agent! You can do this by keeping an eye on changes to the
sip.callStatus
participant attribute using the
participant_attributes_changed
event. When someone ends the call, the
sip.callStatus
attribute will update to
'hangup'
. You can then use this event to trigger whatever action you need. Here’s a simple way to approach it: • Set up an event handler for
participant_attributes_changed
. • Check if the
sip.callStatus
attribute changes to
'hangup'
. • Take your desired action, like cleanup or logging, once the call ends. If you’d like, I’m more than happy to walk you through detailed steps or provide some code examples. Just let me know! Sources: docs/index.yaml | Agents telephony integration | LiveKit Docs