HOw do i know duration of call in my inbound cagen...
# ask-ai
s
HOw do i know duration of call in my inbound cagent?
t
Thanks for reaching out, elish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To determine the duration of a call in your Inbound Cagent, you can use the
dur_call_sec
metric provided by LiveKit's monitoring system. This metric tracks SIP call durations in seconds and is available for both inbound and outbound calls. Here’s how you can access it: • Use Prometheus to query the
dur_call_sec
metric. • Filter the metric by the
dir
label, setting it to
"in"
for inbound calls. • For example, you can use a query like: `dur_call_sec_bucket{dir="in", le="10"}`Adjust the
le
parameter to match the desired duration bucket. Let me know if you need further assistance with this! Sources: pkg/stats/monitor.go
Hey there! If you want to check out call metrics during an inbound call setup, here are a few ways you can do it: • Client-Side Metrics: LiveKit's SDKs (like Android and Swift) automatically gather important info like jitter, freeze counts, and packet details. These come through as
DataPacket
objects while the call is happening. • Server-Side Metrics: On the server side, these metrics arrive via data channels. You can set up listeners or hooks to grab and work with them. • Agent-Specific Metrics: You can subscribe to the
metrics_collected
event to keep track of metrics related to LLM, TTS, and STT data. The
UsageCollector
class is super handy for getting session summaries. • Custom Data Access: If you want the raw metrics during the call, you can add some logic to intercept and decode those
DataPacket
objects or use protobuf structures defined in LiveKit's protocol buffers. If you need even more metrics, you can always fetch them later using session or call IDs. Check out the LiveKit Metrics Documentation for some great examples and guidance. Feel free to reach out if you want a hand with any of these steps—I’m here to help!
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!