Hey how do we set a maximum call duration ? is thi...
# ask-ai
a
Hey how do we set a maximum call duration ? is this configurable ?
t
Thanks for reaching out, Ayush. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you with setting a maximum call duration! It depends on the type of session you're working with: • SIP Calls: You have the option to configure the maximum call duration using the
max_call_duration
parameter. This can be done through the Server SDK, gRPC API, or SIP trunk configuration. The maximum duration is capped at 24 hours, but you’re free to set any value below that limit. • Regular WebRTC Sessions: While there isn’t a direct setting for maximum call duration here, you can manage room timeouts using related configurations like
empty_timeout
or
departure_timeout
. If you’re working specifically with SIP integration, just let me know! I’d be glad to walk you through the details and support you further. Sources: livekit-agents/livekit/agents/voice/agent_session.py | Quotas and limits | LiveKit docs | SIP APIs | LiveKit Docs | packages/livekit-server-sdk/src/SipClient.ts | protobufs/rpc/io.proto
a
yes i have twilio integration, how do i have a max call duration.
t
I'm happy to help you set a maximum call duration for your Twilio SIP integration in LiveKit! You can easily do this by using the
max_call_duration
parameter when you create a SIP participant. This way, your call will automatically end once it reaches the duration you’ve specified. Here’s a quick example using the LiveKit Server SDK (Node.js):
Copy code
await livekitService.createSIPParticipant({
  fromNumber: '+1234567890',
  to: '+0987654321',
  roomName: 'my-room',
  maxCallDuration: 3600, // 1 hour in seconds
});
This setup works smoothly with Twilio and doesn’t require any extra configuration on their side. If you have any questions or need a hand with anything else, just let me know—I’m here to help! Sources: SIP APIs | LiveKit Docs | protobufs/rpc/io.proto | pkg/sip/participant.go | packages/livekit-server-sdk/src/SipClient.ts
a
okay and sometimes my agent is leaving calls blank, its not sayinh anything while i dont see errors in logs, whats the issue
t
I understand how frustrating blank calls with no audio can be, especially when there are no errors showing up in the logs. Let's explore a few common reasons this might happen and some steps you can try to resolve it: • Media Port or SDP Negotiation Failures: Sometimes, issues during the SDP exchange, like closed media ports or negotiation failures, can lead to silent calls. It’s worth double-checking this part. • Agent Name Mismatch: Make sure the agent name in
WorkerOptions
exactly matches the one in your dispatch rule configuration. Even small mismatches can cause silent calls. • Authentication Issues: It’s a good idea to verify that your SIP trunk credentials are correctly set and match those provided by your SIP provider. • Call Routing Misconfigurations: Confirm that your dispatch rules are set up properly to route calls to the right agent. Sometimes a small misconfiguration here can cause problems. Also, taking a look at external logs from your SIP provider (like Twilio) alongside your LiveKit logs can often reveal issues that don’t show up internally. If you’d like, I’m here to help you work through any of these steps or answer any questions you have! Sources: pkg/sip/server.go | SIP troubleshooting guide | LiveKit Docs | Create and configure a Plivo SIP trunk | LiveKit Docs
a
No, i mean out of 10 calls sometimes may be a call has blank i.e the agent says nothing ?
t
I understand how frustrating it can be to experience intermittent blank calls where the agent says nothing. Let’s work through some common areas that might be causing this together: • Agent Dispatch Configuration: It’s important to make sure the
agent_name
matches exactly between the
WorkerOptions
and the dispatch rule configuration. Sometimes a mismatch here can lead to those silent calls. • Insufficient Agent Instances: Running multiple agent instances per
agent_name
can really help manage traffic spikes and prevent resource issues. Setting up auto-scaling and load balancing can add an extra layer of reliability. • Trunk Authentication: Double-check your SIP trunk credentials and ensure they comply with any regional regulations. Using region pinning can be a helpful tool here if needed. • Network and Audio Quality: Enabling noise and echo cancellation tools like Krisp can improve call clarity. Also, it’s a good idea to check for any network latency or packet loss between your agent server and LiveKit. • SIP Endpoint Configuration: Make sure the SIP endpoint and transport settings align with your provider’s requirements to avoid any misconfigurations. By looking into these areas, you should see a reduction in those blank calls. Please feel free to reach out if you’d like me to guide you through any specific step—I’m here to help! Sources: SIP troubleshooting guide | LiveKit Docs | Agents telephony integration | LiveKit Docs | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik...
a
in my code i am doing logger.info(f"Connecting to room {self.ctx.room.name}") await self.ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY) await self._handle_call_flow(metadata, user_identity) subscribing to audio and after that later in the code i call session.start is this the reason for blank or is it okay ?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
Outbound voice agent not producing audio despite successful connections Using LiveKit Python SDK for outbound SIP calls with OpenAI/Deepgram. Issues: 1. Agent connects but doesn't speak first (appointment reminder calls need proactive greeting) 2. User says "Hello" 3x - transcription works (logs show "User input transcribed: Hello?") but agent never responds 3.
session.say()
executes without errors but user hears no audio output 4. Session starts successfully, no LLM/TTS errors logged Setup: • SIP participant created via
create_sip_participant
•
AgentSession
with
BaseVoiceAgent
using OpenAI LLM + Deepgram TTS/STT •
auto_subscribe=AutoSubscribe.AUDIO_ONLY
Question: Why is audio not transmitted despite successful session.say() calls and working transcription? Is there an audio pipeline connection issue between AgentSession and SIP participant? Code structure: Call connects → session.start() → monitor_active_call() → session.say() [no audio heard]
Okay i also want to have multi lingual agents, how do i go about it ?