clever-dinner-74518
11/27/2025, 5:38 PMtall-airline-16756
11/27/2025, 5:38 PMtall-airline-16756
11/27/2025, 5:39 PMattributes_to_headers, headers_to_attributes)?
2. Are you expecting LiveKit participant attributes to be added as X-* headers on the SIP BYE, or to be mapped from incoming BYE headers into LiveKit attributes? Which direction is the problem?
3. Example configs (redact secrets) for the trunk and a sample SIP trace/snippet showing the INVITE and the BYE (headers present in INVITE but missing in BYE).
4. LiveKit version / deployment (managed LiveKit cloud or self-hosted) and SIP gateway/trunk setup details.
5. Any custom signaling or hooks that run on disconnect/leave?
With those I can check the mapping behavior and suggest next steps or workarounds. If you prefer, paste the relevant config and SIP traces here and I’ll review them.
Sources: SIP APIs | LiveKit docsclever-dinner-74518
11/27/2025, 5:52 PM{
"sipTrunkId": "ST_h78yQL8y",
"name": "My inbound trunk",
"numbers": [
"+911234567890"
],
"headersToAttributes": {
"X-TCN-provider_name": "provider_name",
},
"attributesToHeaders": {
"transfer": "True"
},
"includeHeaders": "SIP_ALL_HEADERS"
}tall-airline-16756
11/27/2025, 5:52 PMtransfer attribute is not sent as an X-* header on BYE). A few quick checks and questions to diagnose:
1. How and when is the transfer attribute set on the participant? (e.g., added when the call is established, updated later via REST/RTC API, or set from an incoming SIP header on INVITE)
2. Confirm the attribute name and mapping: attributesToHeaders maps LiveKit participant attributes (left side) to SIP header names (right side). In your JSON you currently have:
◦ "transfer": "True"
That maps a LiveKit attribute named transfer to a SIP header literally named True. If you intend the header to be X-Transfer: <value>, the mapping should be "transfer": "X-Transfer" (or the exact header name you want).
1. Do you expect the attribute’s current value to be sent as the header value, or do you want a static header present (X-Transfer: True)? If you want the participant attribute value used as the header value, the mapping must point to the header name; the attribute value is used as the header value automatically.
2. Is the BYE generated by LiveKit (call ending from within LiveKit) or by the SIP peer? If the peer sends BYE, LiveKit must include mapped attributes when it generates outbound SIP requests — confirm whether BYE is sent by LiveKit in your trace.
3. Please paste a short SIP trace (INVITE and BYE headers) or indicate whether transfer appears on the participant in LiveKit just before hangup.
Next steps based on answers:
• If you intended a static header (X-Transfer: True), change mapping to "transfer": "X-Transfer" and ensure the participant has transfer set to "True" before termination.
• If you intended the header name to be True, explain why and we’ll validate that behavior, but typical usage is mapping attribute -> header name (e.g., "transfer": "X-Transfer").
Tell me how transfer is set and share the SIP BYE/INVITE snippets if possible and I’ll point to the exact config change or workaround.clever-dinner-74518
11/27/2025, 5:52 PMtall-airline-16756
11/27/2025, 5:53 PMtransfer attribute set before hangup. Example mapping transfer -> `X-Transfer`:
{
"sipTrunkId": "ST_h78yQL8y",
"name": "My inbound trunk",
"numbers": [
"+911234567890"
],
"headersToAttributes": {
"X-TCN-provider_name": "provider_name"
},
"attributesToHeaders": {
"transfer": "X-Transfer"
},
"includeHeaders": "SIP_ALL_HEADERS"
}
If you want a static header value True regardless of the attribute value, set the participant attribute transfer to "True" before termination or let me know and I can show a config/workaround.clever-dinner-74518
11/27/2025, 5:57 PMtall-airline-16756
11/27/2025, 5:57 PMdelete_room. Set the participant’s transfer attribute before deleting the room so the trunk’s attributes_to_headers mapping can include it on the BYE.
Example (Python):
# set transfer attribute on the participant
await ctx.api.room.update_participant(
room=ctx.room.name,
identity=participant_identity,
attributes={
"transfer": "True" # or the transfer value you want sent as the header value
},
)
# then delete the room (will trigger BYE)
await ctx.api.room.delete_room(
api.DeleteRoomRequest(
room=ctx.room.name,
)
)
Ensure your trunk mapping sends that attribute as the header name you want, e.g.:
"attributes_to_headers": {
"transfer": "X-Transfer"
}
Would you like the exact snippet for your codebase (e.g., with your participant identity variable) or to set multiple attributes at once?
Sources: Managing participants | LiveKit docs | Managing rooms | LiveKit docs | SIP APIs | LiveKit docsclever-dinner-74518
11/27/2025, 6:30 PMtall-airline-16756
11/27/2025, 6:30 PMroom directly to update_participant. Use an UpdateParticipantRequest via the request= parameter. Example Python (async):
from livekit.api import UpdateParticipantRequest
# set transfer attribute on the participant
await ctx.api.room.update_participant(
request=UpdateParticipantRequest(
room=ctx.room.name,
identity=participant_identity,
attributes={"transfer": "True"}
)
)
# then delete the room (triggers BYE)
await ctx.api.room.delete_room(
api.DeleteRoomRequest(room=ctx.room.name)
)
Confirm the participant identity variable and that the trunk maps transfer to the header you want, e.g.:
"attributes_to_headers": { "transfer": "X-Transfer" }
Do you want me to provide a non-async/snippet for your worker or a full example with error handling?
Sources: Managing participants | LiveKit docsclever-dinner-74518
11/28/2025, 5:36 AMtall-airline-16756
11/28/2025, 5:37 AMtransfer) are stored on the participant object and can be mapped to SIP headers, but they do not automatically appear in the LiveKit dashboard call logs. The dashboard call logs mainly show SIP signaling events and connection states, not arbitrary participant attributes.
What you can do to verify and surface the transfer attribute:
• Confirm the attribute is set before hangup:
await ctx.api.room.update_participant(
request=UpdateParticipantRequest(
room=ctx.room.name,
identity=participant_identity,
attributes={"transfer": "True"}
)
)
• Read the participant to verify:
res = await ctx.api.room.get_participant(
request=RoomParticipantIdentity(room=ctx.room.name, identity=participant_identity)
)
print(res.participant.attributes)
• Ensure your trunk maps the attribute to the header:
"attributes_to_headers": { "transfer": "X-Transfer" }
• Surface it in logs for visibility: log the attribute in your agent/worker when you set it (or use ctx.log_context_fields in an agent) so it appears in runtime logs and is easy to correlate with call events.
If you’d like, I can give a full agent-worker snippet that sets the attribute, logs it, and then deletes the room. Which runtime are you using (async worker, sync script, or an agent)?
Sources: Participant attributes and metadata | LiveKit docs | Log collection | LiveKit Docs | Observability data hooks | LiveKit docs | Job lifecycle | LiveKit docsclever-dinner-74518
11/28/2025, 7:35 AMtall-airline-16756
11/28/2025, 7:35 AMtransfer attribute on the participant that represents the SIP endpoint (the actual call leg). LiveKit maps participant attributes to SIP headers when LiveKit generates outbound SIP messages for that participant. Setting the attribute on a bot or other non-SIP participant will not attach the header to the SIP BYE for the SIP leg.
How to confirm:
• Read the room’s participants (or call get_participant) and find the identity that matches the SIP caller.
• Update that participant with UpdateParticipantRequest(room=..., identity=<sip_identity>, attributes={ "transfer":"True" }) before calling delete_room.
• Verify with get_participant that the attribute is present, and log it from your agent/worker so you can correlate it with the BYE.
If you want, paste the participant list or a sample participant identity and I’ll show the exact request to use.clever-dinner-74518
12/01/2025, 6:40 PMtall-airline-16756
12/01/2025, 6:41 PMres = await ctx.api.room.get_participant(
request=RoomParticipantIdentity(room=ctx.room.name, identity=sip_identity)
)
print(res.participant.attributes)
If transfer is present and correct, it can be included on outbound SIP requests.
2) Check LiveKit dashboard call logs
• The dashboard call logs show SIP signaling events but do not always show every custom header. You may not see X-Transfer there even if it is sent.
3) Capture SIP traffic (recommended)
• For managed LiveKit: get SIP gateway/trunk provider logs or ask for SIP traces from your SIP provider that show outgoing BYE from LiveKit to the PSTN/SIP peer.
• For self-hosted LiveKit: run a packet capture on the SIP gateway network interface and inspect BYE with Wireshark/tcpdump:
◦ tcpdump example:
sudo tcpdump -s 0 -A -i <if> port 5060
• In Wireshark filter: sip.Method == "BYE" and inspect headers for X-Transfer (or your header name).
4) Enable/inspect SIP gateway logs
• If you control the SIP gateway (Kamailio/FreeSWITCH/OpenSIPS), enable SIP debug/logging to show outbound requests and headers.
5) Correlate timestamps/identities
• Match the BYE you capture with the room/participant identity and timestamp so you confirm the correct call leg.
If you want, tell me whether you’re on LiveKit Cloud or self-hosted and which SIP gateway/trunk provider you use — I’ll give exact tcpdump/Wireshark commands or where to request SIP traces from your provider.