Hi everyone, I've configured a Voice AI agent wit...
# ask-ai
d
Hi everyone, I've configured a Voice AI agent with Twilio SIP, but when the call starts, the initial speech is in Spanish or French. How can I fix this?
t
Thanks for reaching out, Ibragim. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To address the issue of your Voice AI agent starting in Spanish or French during calls, you need to configure the language settings in the agent's Speech-to-Text (STT) and Text-to-Speech (TTS) components. Here's how you can do it: • For STT components, set the language using ISO-639-1 format codes. For example, to use Spanish with Deepgram STT:
Copy code
session = AgentSession(
    turn_detection=MultilingualModel(),
    stt=deepgram.STT(model="nova-2", language="es"),
    # ... vad, stt, tts, llm, etc.
)
• If you want the agent to dynamically switch languages during a conversation, you can implement a method to update both STT and TTS language settings. For example:
Copy code
async def _switch_language(self, language_code: str) -> None:
    if self.tts is not None:
        self.tts.update_options(language=language_code)
    
    if self.stt is not None:
        deepgram_language = self.deepgram_language_codes.get(language_code, language_code)
        self.stt.update_options(language=deepgram_language)
    
    self.current_language = language_code
• Ensure you map standard language codes to provider-specific ones if needed. For example, with Deepgram:
Copy code
self.deepgram_language_codes = {
    "en": "en",
    "es": "es", 
    "fr": "fr-CA",
    "de": "de",
    "it": "it"
}
• For Twilio SIP integration, the language settings are managed in the agent code as described above. The SIP integration itself handles telephony routing and does not affect language configuration. Adjust these settings in your agent's configuration to ensure the desired language is used at the start of the call.
d
In livekit cloud dashboard i can see one session is still active even calls are disconnected, why this happens?
t
Hey there! I totally get why you might be seeing some lingering sessions in your LiveKit Cloud dashboard. Let me break this down in a friendly way. Sometimes, after your call wraps up, you might notice that a session stays active. That's because agents and recording services can hang around for a short bit after everyone else has left. But no worries – there's a super simple fix! Here's what you can do: • Delete the room when the human participant leaves: This is like giving a friendly "goodbye" that makes sure everyone – agents and recording services included – gets disconnected cleanly. •
Use the server API's deleteRoom function:
Think of this as your "all done" button that closes out the session for everyone and tidies things up on the server. My recommendation? Go ahead and delete the room when your call is finished. This keeps your dashboard nice and tidy, and prevents any unnecessary active sessions from sticking around. Easy peasy! 😊
d
how can I delete the room ?
t
To delete a room in LiveKit, no worries! I'll walk you through a few super simple ways to do this. Whether you're coding in your favorite language or prefer using the CLI, we've got you covered! 😊 • Using Server SDKs: ◦ *Node.js:*`await roomClient.deleteRoom("myroom");` ◦ *Python:*`delete_request = DeleteRoomRequest(room="myroom") await room_service.delete_room(delete_request)` ◦ *Go:*`_, _ = roomClient.DeleteRoom(context.Background(), &livekit.DeleteRoomRequest{ Room: "myroom", })` ◦ *Rust:*`room_client.delete_room("myroom").await?;` ◦ *Kotlin:*`val call = roomServiceClient.deleteRoom("myroom") call.execute()` • *Using LiveKit CLI:*`lk room delete ROOM_NAME` Quick Setup Tips: 1. First, set up your RoomServiceClient with your LiveKit server details - it's super easy! 2. Just make sure you've got the
roomCreate
permission, and you're good to go. Here's a friendly heads up: When you delete a room, the server will close it out completely - disconnecting all participants and removing it from the room store. This works whether the room is packed or totally empty. Pretty straightforward, right? 👍 Sources: Managing rooms | LiveKit Docs | livekit-api/livekit/api/room_service.py | livekit-api/src/services/room.rs | src/main/kotlin/io/livekit/server/RoomServiceClient.kt | protobufs/rpc/room.proto
d
If there are concurency calls like 4-5 calls at the same time, wouldnt deleting room affect those calls?
t
Hey there! Let me break down what happens when you delete a room in LiveKit. Don't worry—it's pretty straightforward and won't disrupt anyone else's video calls. • Only participants in the deleted room are disconnected: Think of it like closing one specific chat room without affecting other conversations happening at the same time. • Room-specific data cleanup: We're just tidying up behind the scenes for that particular room, keeping everything neat and organized. • Isolated room state: Each room is like its own little world—what happens in one room stays in that room, so no cross-talk or interference. The LiveKit server is designed to be super smart about keeping rooms separate. So if you delete one room, everyone in other rooms will keep right on chatting without missing a beat. Pretty cool, right? Sources: Managing rooms | LiveKit Docs | pkg/service/redisstore.go
d
• room subscription timed out why this happens?
t
Hey there! Let me break down what's happening with the 'room subscription timed out' error in LiveKit. • Timer Expiration: Think of this like waiting for a friend who's running late - there's a set window of time, and if they don't show up, you might have to move on. • Failed Room Subscription: Imagine trying to join a virtual meeting room, but the door just won't open. That's basically what's happening here - the system is waiting, but the room isn't responding. • Call Termination: When things don't work out, the call gets closed with a "sorry, can't connect" message, throwing a
psrpc.DeadlineExceeded
error that says "room subscription timed out." This could be happening because of a few things like wonky internet, a slow server, or just some temporary technical hiccups. Don't worry - these things happen! 😊 Sources: pkg/sip/inbound.go
d
the issue is like, i cant make multiple calls, after each call i have to wait 5-10 minutes to make another call, why?
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!