proud-lawyer-39815
10/15/2025, 1:48 PMtall-airline-16756
10/15/2025, 1:48 PMtall-airline-16756
10/15/2025, 1:50 PMapi.CreateSIPParticipantRequest! While these headers don’t show up directly in the LiveKit console, there’s a neat way to make them visible by mapping them to participant attributes using the headers_to_attributes field.
For example, in your CreateSIPParticipantRequest, you can set it up like this:
{
"headers": {
"X-Custom-ID": "12345",
"X-Priority": "high"
},
"headers_to_attributes": {
"X-Custom-ID": "custom_id",
"X-Priority": "call_priority"
}
}
After you map them, these headers will show up as participant attributes with the prefix sip.h.* in the console. So, for example, X-Custom-ID mapped to custom_id will appear as sip.h.custom_id.
If you’d like, I’m here to help you walk through this setup or answer any other questions you might have!
Sources: SIP overview | LiveKit Docs | SIP APIs | LiveKit Docs | protobufs/livekit_sip.proto | cmd/lk/sip.go | SIP participant | LiveKit Docsproud-lawyer-39815
10/15/2025, 1:51 PMtall-airline-16756
10/15/2025, 1:52 PMheaders_to_attributes in Python for LiveKit, you can easily configure it as part of the CreateSIPParticipantRequest. Here’s a simple example to guide you through it:
from livekit.protocol.sip import CreateSIPParticipantRequest
# Define headers and their mappings
headers_to_attributes = {
"X-Custom-ID": "custom_id",
"X-Priority": "priority_level"
}
# Create the SIP participant request
request = CreateSIPParticipantRequest(
sip_trunk_id="trunk_123",
sip_call_to="+1234567890",
room_name="meeting_room",
participant_identity="caller123",
headers={
"X-Custom-ID": "12345",
"X-Priority": "high"
},
headers_to_attributes=headers_to_attributes
)
After this mapping, these headers will show up as participant attributes with the prefix sip.h.* in the console. If you have any questions or need a hand with anything else, just let me know—I’m here to help!
Sources: SIP APIs | LiveKit Docs | livekit-protocol/livekit/protocol/sip.pyi | livekit/livekit_sip.pb.go | SIP participant | LiveKit Docsproud-lawyer-39815
10/15/2025, 1:58 PMheaders_to_attributes in the python client...tall-airline-16756
10/15/2025, 1:59 PMheaders_to_attributes field isn’t directly part of CreateSIPParticipantRequest, but don’t worry—it’s actually found inside the trunk field, which uses the SIPOutboundConfig class.
Here’s a simple way you can set it up:
from livekit.protocol.sip import CreateSIPParticipantRequest, SIPOutboundConfig
# Define headers and their mappings
headers_to_attributes = {
"X-Custom-ID": "custom_id",
"X-Priority": "priority_level"
}
# Create the SIPOutboundConfig
trunk_config = SIPOutboundConfig(
hostname="sip.provider.com",
headers_to_attributes=headers_to_attributes
)
# Create the SIP participant request
request = CreateSIPParticipantRequest(
sip_trunk_id="trunk_123",
sip_call_to="+1234567890",
room_name="meeting_room",
participant_identity="caller123",
trunk=trunk_config
)
If anything’s unclear or you’d like me to walk you through it further, just let me know—I’m here to help!
Sources: livekit/livekit_sip.pb.go | livekit-api/livekit/api/sip_service.pyproud-lawyer-39815
10/15/2025, 2:03 PMtall-airline-16756
10/15/2025, 2:04 PMheaders_to_attributes right at the SIP trunk level. This means the mapping will automatically apply to every participant created using that trunk, making things much simpler for you.
Here’s a friendly walkthrough to get you started:
from livekit.api import CreateSIPOutboundTrunkRequest, SIPOutboundTrunkInfo
# Configure headers_to_attributes at the trunk level
trunk_info = SIPOutboundTrunkInfo(
name="my-trunk",
address="sip.provider.com",
headers_to_attributes={
"X-Custom-ID": "custom_id",
"X-Priority": "priority_level"
}
)
# Create the trunk
outbound_trunk = CreateSIPOutboundTrunkRequest(trunk=trunk_info)
created_trunk = await sip_service.create_outbound_trunk(outbound_trunk)
Then, when you create a SIP participant, all you need to do is reference the trunk ID like this:
from livekit.api import CreateSIPParticipantRequest
create_request = CreateSIPParticipantRequest(
sip_trunk_id=created_trunk.sip_trunk_id,
sip_call_to="+1234567890",
room_name="my-room",
participant_identity="sip-participant"
)
This way, you avoid repeating yourself and keep everything nicely centralized. If anything feels unclear or you want to dive deeper, just let me know—I’m here to help!
Sources: livekit/livekit_sip.pb.go | livekit-api/livekit/api/sip_service.py