m
hi
t
Thanks for reaching out, Rahib. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! How can I help you today? I'm here to make sure we get everything sorted out for you.
m
Can i integrate noise cancellation telephony when self hosting for free? The BVC
t
I completely understand how important noise cancellation is for your telephony experience. Currently, the enhanced noise cancellation feature, which includes Krisp support for telephony, is available exclusively with LiveKit Cloud and isn't supported in free self-hosted LiveKit deployments. That said, you do have access to basic noise suppression and echo cancellation in self-hosted setups through WebRTC’s default settings. These can be customized using
AudioCaptureOptions
in the LiveKit SDKs when you establish a connection. If advanced noise cancellation is a must for your self-hosted environment, you might want to consider exploring third-party audio processing libraries or possibly using LiveKit Cloud where this feature is fully supported. I'd be happy to help you get started with basic WebRTC noise suppression in your self-hosted setup or assist you in integrating a third-party noise cancellation tool—just let me know what you'd prefer! Sources: Voice AI quickstart | LiveKit Docs | README.md | krisp-minimal/README.md | README.md | Development Tools | livekit/livekit_composite | DeepWiki
m
what are my other options to integrate noise cancellation ?
t
For self-hosted LiveKit setups, I’d love to walk you through the options available for integrating noise cancellation: • Built-in WebRTC Noise Suppression: LiveKit comes with default noise suppression, echo cancellation, and auto gain control powered by WebRTC. You can easily configure these using
AudioCaptureOptions
in the SDKs. • Agent-Side Noise Cancellation: Another great option is to implement noise cancellation right in your agent code with
NoiseCancellationOptions
. This lets you process inbound audio streams on the server side. • Third-Party Solutions: While not directly supported out of the box, you might consider integrating third-party libraries like RNNoise or other open-source tools for more advanced noise cancellation. Just a heads-up, this would involve some custom development. Just a quick note: the enhanced Krisp-based noise cancellation is currently exclusive to LiveKit Cloud and isn’t available for self-hosted setups. If you’d like, I’m here to help guide you through configuring WebRTC noise suppression, setting up agent-side noise cancellation, or exploring third-party options. Just let me know what works best for you! Sources: Voice AI quickstart | LiveKit Docs | Noise & echo cancellation | LiveKit Docs | examples/local_audio/src/main.rs | livekit-rtc/livekit/rtc/_proto/audio_frame_pb2.pyi | rag/main.py
m
I am building for telephony what will the best option in that case would that be SIP provider or someone else?
t
When it comes to telephony in a self-hosted LiveKit setup, the best way to handle noise cancellation is by using the built-in WebRTC noise suppression. This handy feature includes echo cancellation, noise suppression, and auto gain control, all of which you can adjust in your audio capture settings. If you're working with SIP, you'll need to set up the SIP service separately. In this case, you'll be relying on WebRTC's default noise suppression, since the more advanced Krisp-based noise cancellation is available only with LiveKit Cloud. I'd be happy to help you with configuring WebRTC noise suppression for your SIP setup, or if you're interested, we can explore how LiveKit Cloud offers enhanced noise cancellation. Just let me know what you'd prefer! Sources: livekit-rtc/livekit/rtc/apm.py | SIP overview | LiveKit Docs | Knowledge Management & Documentation System | livekit/livekit_composite | D... | Noise & echo cancellation | LiveKit Docs
m
Yeah help me with the setup
t
Let's walk through setting up WebRTC noise suppression for your self-hosted SIP telephony setup together. Here’s a simple guide to help you get started: 1. Configure Audio Processing Module: You can use the LiveKit SDK to activate WebRTC's built-in noise suppression, echo cancellation, and auto gain control. Here’s an example in Python to make it clearer:
Copy code
from livekit.rtc import AudioProcessingModule

apm = AudioProcessingModule(
    echo_cancellation=True,
    noise_suppression=True,
    high_pass_filter=True,
    auto_gain_control=True
)

apm.process_stream(audio_frame)
apm.process_reverse_stream(far_end_audio_frame)
1. Configure SIP Server: It’s important to make sure your SIP server is set up correctly with the right signaling and media ports. Here’s an example configuration to guide you:
Copy code
# sip-config.yaml
api_key: your-livekit-api-key
api_secret: your-livekit-api-secret
ws_url: ws://your-livekit-server:7880
redis:
  address: your-redis-server:6379
sip_port: 5060
rtp_port: 10000-20000
1. Run SIP Server: Once everything is configured, you can start your SIP server like this:
Copy code
sip --config=sip-config.yaml
By following these steps, you’ll have WebRTC’s default noise suppression working smoothly for your SIP telephony setup. If you’d like more tailored advice for your specific programming language or environment, just let me know—I’m here to help! Sources: Enhanced noise cancellation | LiveKit Docs | livekit-rtc/livekit/rtc/_proto/audio_frame_pb2.pyi | Noise & echo cancellation | LiveKit Docs | Self-hosted SIP server | LiveKit Docs | pkg/rtc/config.go
m
How does this gets integrated in the voice agent ? Like what is the flow here where should I put this block?
t
To help you smoothly integrate WebRTC noise suppression into your voice agent for SIP telephony, here’s a friendly step-by-step guide: 1. Agent-Level Noise Cancellation: You can add noise cancellation right in your agent code. Here’s a simple example in Python to get you started:
Copy code
from livekit.plugins import noise_cancellation
from livekit.agents import RoomInputOptions

await session.start({
    agent: agent,
    room: ctx.room,
    room_input_options: RoomInputOptions(
        noise_cancellation=noise_cancellation.BVC(),
    ),
})
1. Handle SIP Participants: It’s a good idea to use different noise cancellation models depending on whether the participant is SIP or WebRTC. Here’s how you might do that:
Copy code
participant = await ctx.wait_for_participant()
filter = noise_cancellation.BVC()
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
    filter = noise_cancellation.BVCTelephony()
1. Configure SIP Trunks: Make sure your SIP trunks are set up correctly with the right signaling and media ports. Here’s an example configuration to guide you:
Copy code
{
  "trunk_id": "my-inbound-trunk",
  "name": "My Inbound Trunk",
  "numbers": [
    "+1-510-555-0100"
  ],
  "allowed_addresses": [
    "192.168.1.100"
  ],
  "auth_username": "myusername",
  "auth_password": "mypassword",
  "krisp_enabled": true
}
Following these steps should set you up nicely with noise suppression in your voice agent. If you run into any questions or want some help with specific deployment details, just let me know—I’m here to help! Sources: Noise & echo cancellation | LiveKit Docs | complex-agents/teleprompter/teleprompter-frontend/components/room.tsx | examples/src/realtime_turn_detector.ts | Using Noise Cancellation for SIP and WebRTC Participants | Enhanced noise cancellation | LiveKit Docs