nutritious-oyster-4341
10/04/2025, 5:57 PMtall-airline-16756
10/04/2025, 5:58 PMtall-airline-16756
10/04/2025, 5:58 PMheaders_to_attributes configuration. This way, specific SIP X-* headers from the SIP INVITE or 200 OK response will be automatically converted into participant attributes, which you can then access through the LiveKit participant APIs.
Here’s a simple way to do it:
1. Set up your SIP trunk or dispatch rule with a headers_to_attributes map that links SIP header names to participant attribute names. For example:
{"headers_to_attributes": {"X-Custom-Header": "caller_type"}}
2. Once mapped, you can retrieve the attribute from the participant data using server SDKs or APIs. For instance, in JavaScript:
const participant = room.getParticipantByIdentity('sip_...');
console.log(participant.attributes['caller_type']);
Alternatively, you might consider using the include_headers field to map SIP headers to the sip.h.* namespace, but I usually recommend headers_to_attributes for headers you know in advance.
If you have any questions or need a hand with this, please don’t hesitate to ask—I’m here to support you!
Sources: SIP participant | LiveKit Docs | protobufs/rpc/sip.proto | livekit-protocol/src/livekit.rs | SIP APIs | LiveKit Docs