Voice mail detection and take action on it.
# ask-ai
c
Voice mail detection and take action on it.
t
Thanks for reaching out, Subham. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thank you for reaching out! Could you please help me understand a bit more about what you mean by "voice mail detection and take action on it"? Are you hoping to detect when a voicemail is left in a LiveKit-powered application, or are you looking to analyze the voicemail content itself? Also, it would be great to know what specific actions you'd like to take once a voicemail is detected. I'm here to help you every step of the way!
c
how to allow interrupt while tool call?
t
I'm glad you're exploring how to allow interruptions during a tool call in LiveKit! Here's a friendly guide to help you set it up smoothly: • Global Interruption Settings: When you initialize the
AgentSession
, you can enable interruptions by using parameters like
allow_interruptions
,
min_interruption_duration
, and
min_interruption_words
. Here's a simple example to get you started:
Copy code
session = AgentSession(
    allow_interruptions=True,
    min_interruption_duration=0.5,
    min_interruption_words=1,
)
Dynamic Handling: While a tool call is running, interruptions can be managed through the
RunContext
. You can check if an interruption has occurred using
run_ctx.speech_handle.interrupted
and respond accordingly. Here's a snippet that shows how this works:
Copy code
@function_tool
async def search_web(self, query: str, run_ctx: RunContext):
    wait_for_result = asyncio.ensure_future(self._a_long_running_task(query))
    await run_ctx.speech_handle.wait_if_not_interrupted([wait_for_result])

    if run_ctx.speech_handle.interrupted:
        wait_for_result.cancel()
        return None
If you'd like, I'm here to help with more details or additional examples—just let me know! Sources: livekit-agents/livekit/agents/voice/agent_activity.py | Agent speech and audio | LiveKit Docs | Agent speech and audio | LiveKit Docs | Turn detection and interruptions | LiveKit Docs