limited-spring-14213
07/23/2025, 5:18 PMtall-airline-16756
07/23/2025, 5:18 PMtall-airline-16756
07/23/2025, 5:19 PMattributes field, such as:
• sip.twilio.accountSid - Twilio account SID
• sip.twilio.callSid - Twilio call SID
To extract the Twilio Call SID, you can check if a participant is a SIP participant and then access the appropriate attribute. Here's an example in Node.js:
if (participant.kind == ParticipantKind.SIP) {
console.log(participant.attributes['sip.twilio.callSid']);
}
Additionally, in agent applications, you can access this information through the job context by retrieving participants from the room. The job context provides access to the room object, which contains all participants and their attributes.
Please note that the Twilio Call SID is only available when using Twilio SIP trunks. For other SIP trunk providers, different provider-specific attributes may be available.
Sources: SIP participant | LiveKit Docs | livekit-agents/livekit/agents/job.pylimited-spring-14213
07/23/2025, 7:54 PMtall-airline-16756
07/23/2025, 7:55 PMcall_direction set to SCD_OUTBOUND. Easy peasy!
◦ For transferred calls, you'll notice some extra details like SIPTransferInfo with cool fields such as transfer_id, transfer_to, transfer_initiated_at_ns, and transfer_status.
• SIP Participant Attributes:
◦ Let's talk SIP call IDs! sip.callID is LiveKit's way of tagging a conversation, while sip.callIDFull is the trunk provider's unique call identifier.
• Call Status and Information:
◦ The SIPCallInfo structure is like your call's personal ID card – it's got all the details you need, including call_direction, call_status, from_uri, to_uri, trunk_id, and dispatch_rule_id.
• Transfer-Specific Detection:
◦ Tracking transfers is a breeze! Look for SIPTransferInfo with statuses like STS_TRANSFER_ONGOING, STS_TRANSFER_FAILED, or STS_TRANSFER_SUCCESSFUL. You'll also see handy timing info with transfer_initiated_at_ns and transfer_completed_at_ns.
By putting these methods together, you'll become a pro at telling the difference between LiveKit outbound calls and Twilio transfers. Trust me, it's easier than it sounds! Sources: protobufs/livekit_sip.proto | SIP participant | LiveKit Docs | test/lktest-sip-outbound/README.md