python-sdks icon indicating copy to clipboard operation
python-sdks copied to clipboard

participant did't have the disconnect_reason and sip.callStatus always empty

Open johnson7788 opened this issue 10 months ago • 0 comments

example Code from here: https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py

livekit==0.22.0 livekit-agents==0.12.17 livekit-api==0.8.2

    while perf_counter() - start_time < 30:
        call_status = participant.attributes.get("sip.callStatus")
        if call_status == "active":
            logger.info("user has picked up")
            return
        elif call_status == "automation":
            # if DTMF is used in the `sip_call_to` number, typically used to dial
            # an extension or enter a PIN.
            # during DTMF dialing, the participant will be in the "automation" state
            pass
        elif participant.disconnect_reason == rtc.DisconnectReason.USER_REJECTED:
            logger.info("user rejected the call, exiting job")
            break
        elif participant.disconnect_reason == rtc.DisconnectReason.USER_UNAVAILABLE:
            logger.info("user did not pick up, exiting job")
            break
        await asyncio.sleep(0.1)

johnson7788 avatar Mar 19 '25 02:03 johnson7788