Skip to content

Could you explain the monitoring dialing status example? #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rinarakaki opened this issue Mar 14, 2025 · 1 comment
Open

Could you explain the monitoring dialing status example? #313

rinarakaki opened this issue Mar 14, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@rinarakaki
Copy link

In this example, when call_status == "active" it immediately returns from (supposedly entrypoint) function, but in my understanding, the call_status should transition like "dialing" → "active" → "hangup". So if you implement like this, it never enters the call_status == "hangup" branch. Could you correct my understanding? Thanks.

start_time = perf_counter()
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 call_status == "hangup":
        # user hung up, we'll exit the job
        logger.info("user hung up, exiting job")
        break
    await asyncio.sleep(0.1)

logger.info("session timed out, exiting job")
ctx.shutdown()

https://docs.livekit.io/agents/quickstarts/outbound-calls/#monitoring-dialing-status

@dennwc dennwc added the documentation Improvements or additions to documentation label Mar 14, 2025
@dennwc
Copy link
Contributor

dennwc commented Mar 14, 2025

I think you are right, we should fix this example code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants