i use a fnction tool called detected_answering_mac...
# ask-ai
b
i use a fnction tool called detected_answering_machine to see if we are on voicemail but the llm does not use the function or msscall it orally
t
Thanks for reaching out, timothe. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! Just to make sure I understand correctly, is the
detected_answering_machine
function not being called at all, or is it being called but not working as expected? Also, are you using any fallback options like silence detection alongside the LLM-based detection? I’m here to help you get this sorted out! Sources: livekit-agents/livekit/agents/voice/agent_activity.py | agent.py | How to detect and handle silence during calls | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik... | Community & Support | livekit/livekit_composite | DeepWiki
b
what happens if someone doesn't have a voicemail and it keeps ringing
t
I understand how frustrating it can be when calls keep ringing without reaching voicemail. A helpful way to manage this is by setting a
ringing_timeout
parameter when making outbound calls. This will automatically end the call after a set time (like 30 seconds) if no one answers. Here’s a simple example you can try:
Copy code
await lkapi.sip.create_sip_participant(
    api.CreateSIPParticipantRequest(
        sip_trunk_id=SIP_TRUNK_ID,
        sip_call_to=phone_number,
        room_name=room_name,
        participant_identity="caller",
        ringing_timeout=Duration(seconds=30),  # Timeout after 30 seconds
        wait_until_answered=True  # Return only after call is answered or times out
    )
)
If you’d like, I’m here to help you set this up or even explore other options like silence detection for after the call is answered. Just let me know how you’d like to proceed! Sources: SIP APIs | LiveKit Docs | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik... | How to detect and handle silence during calls | examples/warm-transfer/warm_transfer.py | Agent Testing & CI/CD | livekit/livekit_composite | DeepWiki
b
File "/home/ubuntu/agent_tel/agent.py", line 1086, in entrypoint Oct 27 145654 vps-564aa809 python3[3354368]: ringing_timeout=Duration(seconds=5), # Timeout after 30 seconds Oct 27 145654 vps-564aa809 python3[3354368]: ^^^^^^^^ Oct 27 145654 vps-564aa809 python3[3354368]: NameError: name 'Duration' is not defined {"pid": 3354384, "job_id": "AJ_TV94jbFMrH2r"}
t
It looks like you're encountering the error
NameError: name 'Duration' is not defined
because the
Duration
type from the protobuf library hasn’t been imported properly. No worries, this is a common hiccup! To fix this in Python, you just need to import
Duration
from the protobuf module and use it like this:
Copy code
from google.protobuf.duration_pb2 import Duration

# Create a Duration object
timeout = Duration()
timeout.FromSeconds(30)  # Set timeout to 30 seconds

# Use it in your SIP participant creation
client.create_sip_participant(
    sip_number="+1234567890",
    room_name="my-room",
    ringing_timeout=timeout
)
Also, please make sure the protobuf library is installed on your system. If you run into any more questions or need a hand with anything else, just let me know—I’m here to help! Sources: SIP APIs | LiveKit Docs | protobufs/livekit_sip.proto | livekit-protocol/livekit/protocol/sip.pyi | packages/livekit-server-sdk/src/SipClient.ts | livekit-api/src/access_token.rs