rich-application-94483
11/12/2025, 1:22 PMtall-airline-16756
11/12/2025, 1:22 PMtall-airline-16756
11/12/2025, 1:23 PMkind field, which should be set to Participant.Kind.SIP. For example:
if (participant.kind === ParticipantKind.SIP) {
console.log('This is a SIP participant');
}
2. Access SIP Participant Attributes: The SIP-specific details are stored within the attributes field of the participant object. This includes things like sip.callID, sip.phoneNumber, and sip.callStatus.
3. Access SIP Headers: When creating a SIP participant or setting up a trunk, you can use the headersToAttributes or includeHeaders options. For example:
`const opts = {
headersToAttributes: {
'X-Call-Source': 'sip.callSource',
'X-Region': 'sip.region'
},
includeHeaders: SIPHeaderOptions.SIP_HEADER_OPTIONS_ALL
};`These headers will then appear as attributes, such as sip.h.X-Call-Source.
4. Practical Usage: Here's how you can retrieve these attributes in your agent:
`if (participant.kind === ParticipantKind.SIP) {
const phoneNumber = participant.attributes['sip.phoneNumber'];
const callStatus = participant.attributes['sip.callStatus'];
const customHeader = participant.attributes['sip.h.X-Custom-Header'];
console.log(Call from ${phoneNumber}, status: ${callStatus}, header: ${customHeader});
}`
Just make sure your SIP trunk is set up with the headersToAttributes or includeHeaders options you want. If you have any questions or need a hand with anything else, please don’t hesitate to ask—I’m here to help!
Sources: Rooms, participants, and tracks | LiveKit docs | SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | SIP participant | LiveKit docs | packages/livekit-server-sdk/src/SipClient.ts | rpc/sip.pb.go