I've self hosted livekit server on my aws account,...
# ask-ai
w
I've self hosted livekit server on my aws account, if i do curl to https://livekit.masaischool.com it's giving me ok response but if i do curl to livekit-turn.masaischool.com it keeps on connecting, then timeout after some seconds Apart from this, i tried testing my deployment so on https://agents-playground.livekit.io/. Room is connected with agent connection i keeps on loading, i checked my agent i running with self host server domain and keys
t
Thanks for reaching out, Rahul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's work together to sort out the issues you're experiencing with your TURN server and agent connection. Here are some friendly steps to guide you: • First, please double-check that TURN is properly enabled and configured in your LiveKit server settings. It’s important that the TURN domain matches your TLS certificate, and that the correct ports (like 3478 for UDP and TLS) are open. • Next, take a look at your AWS Security Groups and firewall settings to make sure the necessary UDP and TCP ports are accessible. Specifically, opening UDP port 3478 and the UDP port range for WebRTC media (such as 50000–60000) can make a big difference. • For better compatibility with restrictive firewalls, try enabling TURN/TLS on port 443. Just make sure you have valid TLS certificates set up in your LiveKit configuration. • It’s also helpful to run the LiveKit Connection Test utility. This handy tool can pinpoint whether the connectivity issue is with WebSocket, WebRTC, or TURN. • Lastly, you might want to test your TURN server independently using tools like the WebRTC Trickle ICE sample to confirm its configuration and connectivity. If you try these steps and still run into trouble, please don’t hesitate to reach out. I’m here to help you every step of the way! Sources: Deploying LiveKit | LiveKit Docs | src/connectionHelper/checks/turn.ts | Firewall Tips | Zscaler proxy configuration | Documentation/ImprovingCallReliability.md
w
explain in easy language and step step show what needs to be done
t
Let’s walk through a step-by-step guide together to help you troubleshoot and resolve the issues: 1. Check TURN Server Configuration: - Start by opening your LiveKit server configuration file. - Please make sure TURN is enabled and the domain is set to
livekit-turn.masaischool.com
. - Double-check that the correct ports are set:
3478
for UDP and TLS. 2. Verify AWS Security Group Settings: - Log in to your AWS account. - Navigate to the Security Groups for your LiveKit server. - Confirm that the following ports are open: - UDP port
3478
. - UDP port range
50000–60000
for WebRTC media. - TCP port
443
(if you’re using TURN/TLS). 3. Enable TURN/TLS: - In your LiveKit configuration, please set TURN to use TLS on port
443
. - Make sure to add a valid TLS certificate for
livekit-turn.masaischool.com
. 4. Test the Connection: - Use the LiveKit Connection Test utility to see if WebSocket, WebRTC, and TURN are working properly. - If TURN doesn’t connect, it might be due to a firewall blocking the connection. 5. Test TURN Server Independently: - Try using a WebRTC testing tool to check your TURN server configuration separately. Enter your TURN server details and see if it connects successfully. Give these steps a try, and please don’t hesitate to reach out if you have any questions or need more help. I’m here to support you!
w
How to check LiveKit server configuration file?
t
Let's walk through how you can check your LiveKit server configuration file together: 1. Locate the Configuration File: - If you started the server using the
--config
flag, your file will be at the path you chose (for example,
/path/to/your/config.yaml
). - If you set the configuration with the
LIVEKIT_CONFIG
environment variable, then it’s stored there. 2. View the Configuration: - For a file, you can run:
cat /path/to/your/config.yaml
. - If you’re using the environment variable, try:
echo $LIVEKIT_CONFIG
. 3. Validate the Configuration: - Start your LiveKit server and keep an eye on the logs to spot any configuration validation errors. 4. Sample Configuration: - If you’d like a helpful example, check out the
config-sample.yaml
file in the LiveKit repository—it’s a great reference for setting things up. If you get stuck or want me to guide you through any step, just let me know—I’m here to help! Sources: pkg/config/config.go | Deploying LiveKit | LiveKit Docs
w
Here is my livekit.yaml file :-
Copy code
~
~
"livekit.yaml" [readonly] 29L, 675B                                                                                                                                                                 29,5          All
port: 7880
bind_addresses:
    - ""
rtc:
    tcp_port: 7881
    port_range_start: 50000
    port_range_end: 60000
    use_external_ip: true
    enable_loopback_candidate: false
redis:
    address: livekit-server.etqmcw.ng.0001.aps1.cache.amazonaws.com:6379
    username: ""
    password: ""
    db: 0
    use_tls: false
    sentinel_master_name: ""
    sentinel_username: ""
    sentinel_password: ""
    sentinel_addresses: []
    cluster_addresses: []
    max_redirects: null
turn:
    enabled: true
    domain: livekit-turn.masaischool.com
    tls_port: 5349
    udp_port: 3478
    external_tls: true
keys:
    APIRYddxjyYJ3Y: msYvCUY4sGwf9gwWCXK7kvZuE635eiAcAw5BTotQZN
t
Thank you so much for sharing your configuration file! Based on what you've provided, here are some friendly next steps to help you work through the issues: 1. TURN Server Configuration: - I see your TURN server is enabled and set to
livekit-turn.masaischool.com
. - The
tls_port
is set to
5349
. It’s important to make sure this port is open in your AWS Security Groups and firewall settings. - The
udp_port
is set to
3478
. Please double-check that this port is open as well. 2. Firewall and Security Group Settings: - To keep things running smoothly, please open these ports in your AWS Security Groups: - TCP port
5349
for TURN/TLS. - UDP port
3478
for TURN. - UDP port range
50000–60000
for WebRTC media. 3. Test TURN Server: - It’s a good idea to use a WebRTC testing tool to confirm your TURN server at
livekit-turn.masaischool.com
is reachable on the ports you’ve set. 4. Update DNS Records: - Lastly, please ensure that
livekit-turn.masaischool.com
correctly resolves to your TURN server’s IP address. If you have any questions or need a hand with any of these steps, just let me know—I’m here to help!
w
okay i've updated security group and adding rules you mentioned, now how can i test it? please explain in detail and simple terms
t
To help you check if your TURN server is working properly, here are some simple steps you can follow: 1. Use a WebRTC Testing Tool: - Try opening a WebRTC testing tool like the Trickle ICE tool (just search for "WebRTC Trickle ICE test" online). - Enter your TURN server details: - URL:
turn:livekit-turn.masaischool.com:3478
(for UDP) or
turns:livekit-turn.masaischool.com:5349
(for TLS). - Username: You can leave this blank unless you have specific credentials. - Password: Also leave this blank unless you have credentials. - Run the test and see if it connects successfully. 2. Test with LiveKit Connection Test Utility: - If you have the LiveKit Connection Test utility handy, give it a try to check TURN connectivity. - This will help confirm if your TURN server is reachable and working as expected. 3. Test with a LiveKit Room: - Create a test room in your LiveKit setup. - Join the room from two different devices or browsers. - If the video and audio run smoothly, that’s a great sign your TURN server is functioning well. If you’d like, I’m here to walk you through any of these steps or tools—just let me know how I can assist!
w
i used this livekit tool to test livekit server :- https://livekit.io/connection-test Every test is passed, but still agent not joining any room, but if i just switch to my livekit cloud livekit server it works
t
Since your LiveKit Connection Test passed but the agent is not joining rooms on your self-hosted server, let’s walk through a few things to check and try together: 1. Verify Agent Registration: - Please double-check that the agent is using the right environment variables: - `LIVEKIT_URL`:
https://livekit.masaischool.com
-
LIVEKIT_API_KEY
and `LIVEKIT_API_SECRET`: These should match your self-hosted server. - It’s helpful to look at the agent logs to see if it’s registering as a worker. You can use the LiveKit CLI or enable debug logs in your agent code for more insight. 2. Check Dispatch Behavior: - If you’ve set a specific
agentName
, remember that dispatches to rooms need to be created explicitly. - You can use the LiveKit API to list dispatches for the room:
const dispatches = await agentDispatchClient.listDispatch(roomName);
- If you don’t see any dispatches, you’ll want to create one:
const dispatch = await agentDispatchClient.createDispatch(roomName, agentName);
3. Validate Token Permissions: - Make sure the token your agent uses includes the
room_join
capability for the room you’re targeting. - Also, the room name in the token needs to match exactly. 4. Check Server Reachability: - Confirm that your self-hosted server is publicly accessible and set up with proper TLS/SSL. - It’s important to verify that the WebRTC ports (like UDP 50000–60000) and TURN ports are open and reachable. If you’d like, I’m here to help you through any of these steps or provide tools to debug further. Just let me know! Sources: LiveKit Pricing | pkg/loadtester/agentloadtester.go | LiveKit Docs | Voice AI quickstart | LiveKit Docs | README.md
w
it's working, agent is interacting with me, but i checked logs, getting this error as well :-
Copy code
2025-10-27 17:31:02,510 - ERROR livekit - livekit_ffi::server::room:149:livekit_ffi::server::room - audio filter cannot be enabled: LiveKit Cloud is required {"pid": 24115, "job_id": "AJ_Y6n6gHYEKoGM"}
2025-10-27 17:31:02,510 - DEBUG livekit.agents - using audio io: `RoomIO` -> `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"pid": 24115, "job_id": "AJ_Y6n6gHYEKoGM"}
2025-10-27 17:31:02,510 - DEBUG livekit.agents - using transcript io: `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"pid": 24115, "job_id": "AJ_Y6n6gHYEKoGM"}
not authenticated
2025-10-27 17:31:02,511 - ERROR livekit - livekit_ffi::server::audio_stream:123:livekit_ffi::server::audio_stream - failed to initialize the audio filter. it will not be enabled for this session. {"pid": 24115, "job_id": "AJ_Y6n6gHYEKoGM"}
t
I'm here to help explain the error "audio filter cannot be enabled: LiveKit Cloud is required." This happens because some advanced audio features, such as noise cancellation, are available only through LiveKit Cloud and aren’t included in self-hosted setups. Here are a couple of ways you might approach this: 1. Use LiveKit Cloud: Moving your deployment to LiveKit Cloud will give you access to built-in audio filters like noise cancellation, making things much easier. 2. Custom Audio Processing: If you prefer to stick with a self-hosted setup, you can create your own audio processing pipeline using raw audio frames from the SDKs. This option does involve some manual development, but it’s definitely doable. Please feel free to reach out if you’d like guidance on either option or if anything isn’t clear—I’m here to support you every step of the way! Sources: README.md | LICENSE | LiveKit Pricing | LiveKit Cloud | LiveKit Docs | livekit-ffi/src/server/room.rs