most-horse-87545
05/13/2025, 8:16 AMtall-airline-16756
05/13/2025, 8:16 AMtall-airline-16756
05/13/2025, 8:17 AMsip.callStatus
attribute of the participant. Here is an example of how you can implement this:
start_time = perf_counter()
while perf_counter() - start_time < 30:
call_status = participant.attributes.get("sip.callStatus")
if call_status == "active":
<http://logger.info|logger.info>("User has picked up")
return
elif call_status == "automation":
# Handle DTMF dialing if applicable
pass
elif call_status == "hangup":
<http://logger.info|logger.info>("User hung up, exiting job")
break
await asyncio.sleep(0.1)
<http://logger.info|logger.info>("Session timed out, exiting job")
ctx.shutdown()
When the user disconnects, the sip.callStatus
attribute will change to "hangup", allowing you to detect the disconnection and take appropriate action.
Sources: Making calls using SIP | LiveKit Docs | Making calls using SIP | LiveKit Docs