rapid-honey-43838
02/16/2026, 9:04 AMtall-airline-16756
02/16/2026, 9:04 AMtall-airline-16756
02/16/2026, 9:04 AMheaders_to_attributes so incoming SIP headers are stored as participant attributes. Example JSON:
{
"trunk": {
"name": "Inbound Trunk",
"numbers": [
"+1234567890"
],
"headers_to_attributes": {
"X-Custom-Header": "custom.value",
"X-User-ID": "user.id"
}
}
}
• This maps X-Custom-Header → custom.value and X-User-ID → user.id.
2) Use an individual dispatch rule to create a new room per call
• Use an individual dispatch rule (room-per-call). Example:
{
"dispatch_rule": {
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
}
}
}
• Create the dispatch rule via CLI (example): lk sip dispatch create dispatch-rule.json
3) Promote participant attributes into room metadata after the agent joins
• Once the SIP participant is in the room, have the agent or server-side agent logic read the SIP participant’s attributes and update the room metadata. Example (Python-like pseudocode):
@server.rtc_session()
async def my_agent(ctx: JobContext):
await ctx.connect()
# Find SIP participant
sip_participant = None
for participant in ctx.room.participants.values():
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
sip_participant = participant
break
if sip_participant:
attrs = sip_participant.attributes
user_id = attrs.get("user.id")
custom_value = attrs.get("custom.value")
# Update room metadata
await ctx.room.update_metadata(
json.dumps({
"user_id": user_id,
"custom_value": custom_value
})
)
• This makes the SIP-header-derived data available at the room level for dashboards, routing, or UI display.
Notes and tips
• Ensure the header names you map match exactly what the SIP provider sends.
• Keep attribute names consistent so your agent logic reliably reads them.
• If multiple headers map to many attributes, consider grouping into a single JSON field in room metadata for easier parsing downstream.
If you’d like, tell me:
• Which SIP headers you want to capture (names and example values), and
• Which fields you want in room metadata (keys and formats),
and I’ll produce the exact trunk JSON and the precise agent code snippet tailored to your environment.
Sources: How to do call transfers with Five9 | LiveKit | Agents telephony integration | LiveKit Documentation