How do we access localparticipant through livekitA...
# ask-ai
c
How do we access localparticipant through livekitAPI?
t
Thanks for reaching out, Orjan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you're exploring the LiveKit API! You can easily access the
LocalParticipant
through the
room.localParticipant
property once you've connected to a room. This object represents you, the current user, and it’s automatically created as soon as your connection is successful. For instance, if you're using the Flutter SDK, you can get to it with
Room.localParticipant
. In other SDKs like JavaScript and Android, it's just as straightforward—simply access the
localParticipant
field on the room. The
LocalParticipant
object is really handy because it lets you do things like publish your audio or video tracks, update your participant metadata, and manage events such as track publication or permission changes. If you have any questions while working with it, feel free to ask—I’m here to help! Sources: livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Local... | pkg/rtc/types/interfaces.go | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | lib/src/participant/local.dart | JavaScript SDK & React Components | livekit/livekit_composite | DeepWiki
c
Give me an example of how to send a dtmf signal with livekit.api
t
I'd be happy to help you send a DTMF signal using the LiveKit API! You can do this by using the
publishDtmf
method on the
localParticipant
object. This method takes a numeric
code
and a string
digit
(like "1", "#", or "*"). Here’s a simple example in Python to get you started:
Copy code
await ctx.room.local_participant.publish_dtmf(
    code=1,
    digit="1"
)
Just a quick note: make sure your LiveKit setup includes SIP functionality, since DTMF signals are mainly used in telephony scenarios. Also, the participant needs to be connected to a LiveKit room before sending these signals. If you have any questions or would like more examples, please don’t hesitate to ask—I’m here to help! Sources: Handling DTMF | LiveKit Docs | Building an Automated IVR Menu Caller | LiveKit Docs | Make outbound calls | LiveKit Docs | sip-refer/README.mdoc | livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Local...
c
can we only send dtmf through context?
t
I'm happy to help you with sending DTMF signals using the LiveKit API! You don't need to worry about a specific "context" for this. You can simply use the
publishDtmf
method on the
localParticipant
object, as long as the participant is connected to a room. Here's a quick example in Python to guide you:
Copy code
await room.local_participant.publish_dtmf(code=1, digit="1")
This will send the DTMF signal directly, and any SIP participants in the room will pass it along to the connected telephone user. If you'd like, I’m here to provide more details or examples—just let me know! Sources: livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Local... | src/room/participant/LocalParticipant.ts | livekit/src/room/participant/local_participant.rs | sip-refer/README.mdoc | Make outbound calls | LiveKit Docs
c
Room from the lkapi is jsut an object, so how can we publish a dtmf to it without a context? What do we import?
t
To publish a DTMF signal in the LiveKit API, you can use the
publishDtmf
method on the
localParticipant
object. The exact way to import this depends on the SDK and language you're working with. Here are some friendly examples to guide you: Python SDK:
Copy code
from livekit import rtc

await room.local_participant.publish_dtmf(
    code=1,
    digit="1"
)
Node.js SDK:
Copy code
const { Room } = require('livekit-client');

// After connecting to a room
room.localParticipant.publishDtmf(1, "1");
Android SDK (Kotlin):
Copy code
val result = localParticipant.publishDtmf(
    code = 1,
    digit = "1"
)
Just make sure you’ve imported the right LiveKit SDK for your platform. If you have any questions or need a hand with a specific SDK, feel free to ask—I’m here to help! Sources: sip-refer/README.mdoc | SIP overview | LiveKit Docs | Building an Automated IVR Menu Caller | LiveKit Docs | README.md | Handling DTMF | LiveKit Docs
c
does livekit support A,B,C,D for dtmf?
t
Absolutely! LiveKit does support the A, B, C, and D DTMF tones. These tones are built right into the LiveKit media SDK and follow the standard DTMF keypad layout, so you can easily send and receive them within a LiveKit room. Plus, they’re relayed to SIP participants whenever needed. If you'd like, I’m here to help with more details or examples—just let me know! Sources: Handling DTMF | LiveKit Docs | dtmf/dtmf.go
c
can we retrieve the current context through the livekit api?
t
Thanks for reaching out! The LiveKit API does let you retrieve the current context, but this feature is mainly designed to work within the scope of LiveKit Agents. For instance, if you're using Python, you can call the
get_job_context()
function to get the
JobContext
, which includes helpful details about the room, participants, and API client. Similarly, in Node.js, the
getJobContext()
function gives you access to the current context. That said, this context is only accessible inside agent job functions—not in standalone scripts or client apps. If you're working outside of an agent environment, please feel free to share your specific use case with me. I’d be happy to help you explore other options that might work better for your needs! Sources: Tool definition and use | LiveKit Docs | docs/functions/LiveKitRoom.html | lib/src/context/room_context.dart | Shared/Contexts/RoomContext.swift | Agent Testing & CI/CD | livekit/livekit_composite | DeepWiki
c
What can we find in the pcap file?
t
Hey there! A PCAP file in LiveKit holds network packet data that beautifully captures many aspects of real-time communication. Here’s a quick breakdown: • Application-level data like user packets, chat messages, active speaker updates, transcription data, and SIP DTMF signals. • Lower-level transport data such as UDP, RTP, and RTCP packets, which are essential for WebRTC audio and video streams. • Helpful metrics and diagnostic info, including performance details and sequence numbers to keep track of delivery order. • Encrypted packets with important details like encryption type, initialization vector (IV), and key index. The data is encoded using Protocol Buffers (protobuf), so to decode it, you’ll need the right protobuf schema (for example,
livekit_models.proto
). Also, RTP and RTCP packets give you media transport and control info like jitter, packet loss, and round-trip time (RTT). If you’d like, I’m here to help you analyze or decode any specific parts of the PCAP file—just let me know! Sources: livekit-protocol/livekit/protocol/models.pyi | lib/livekit/proto/livekit_models_pb.rb | Protocol & WebRTC Stack | livekit/livekit_composite | DeepWiki