how to get the call start time, end time and call ...
# ask-ai
p
how to get the call start time, end time and call duration from the telephony call
t
Thanks for reaching out, Bryner. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You can retrieve the call start time, end time, and call duration for a telephony call in LiveKit using the
SIPCallInfo
structure. This structure provides: • Start Time:
started_at_ns
(call start time in nanoseconds) • End Time:
ended_at_ns
(call end time in nanoseconds) • Call Duration: Calculate by subtracting start time from end time:
duration = ended_at_ns - started_at_ns
These fields are available in the Python, Rust, and Go SDKs. For example, in Python:
Copy code
started_at_ns: int
ended_at_ns: int
created_at_ns: int
In Go, you can use getter methods like
GetStartedAtNs()
and
GetEndedAtNs()
. It's recommended to use the nanosecond fields for better precision. The exact way to access
SIPCallInfo
depends on your SDK and how you handle SIP call data in your application. Sources: livekit/livekit_analytics.pb.go | livekit-protocol/livekit/protocol/analytics.pyi | livekit-protocol/src/livekit.rs
p
in python i am using voice ai pipeline
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!