calm-eye-57311
09/26/2025, 12:11 PMtall-airline-16756
09/26/2025, 12:11 PMtall-airline-16756
09/26/2025, 12:11 PMlivekit-agents! You can do this by using the max_duration parameter in the configuration options for the RealtimeModel when working with the Ultravox plugin. This parameter lets you define how long a call can last before it automatically ends, which is super handy.
Here’s a simple example in Python to guide you:
from livekit.agents import llm
model = llm.RealtimeModel(
model="fixie-ai/ultravox",
voice="Mark",
api_key="your_api_key",
max_duration="30m", # Set maximum call duration to 30 minutes
time_exceeded_message="Time limit reached. Ending call.",
)
If you’re working with the SIP API, you can set the max_call_duration field in the request payloads like CreateSIPParticipantRequest. Here’s how it looks in Node.js:
await client.createSIPParticipant({
fromNumber: "+1234567890",
callTo: "+0987654321",
roomName: "my-room",
maxCallDuration: 1800, // 30 minutes in seconds
});
Please feel free to reach out if you have any questions or need a hand with anything else—I’m here to help!
Sources: livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | rpc/io.pb.go | SIP APIs | LiveKit Docs | Docs::Telephony