gentle-needle-76462
03/11/2026, 12:58 PMtall-airline-16756
03/11/2026, 12:59 PMtall-airline-16756
03/11/2026, 1:00 PMattributes_to_headers, a trunk sip_headers field, or something else?
4. Can you paste (redact any sensitive data) the sngrep capture showing the SIP message from LiveKit that lacks the header? That will help confirm whether LiveKit sent them.
5. Do you have any SBCs, proxies, or load balancers between LiveKit and Kamailio that might strip headers?
Common causes and checks (what you can try now)
• Check mapping method
◦ If you’re relying on participant attributes (used for BYE and some mapped headers), confirm those attributes are actually set on the participant (e.g., via the agent update_participant flow). If not set, headers won’t be produced.
◦ If you expect headers on initial INVITE for outbound calls, confirm LiveKit supports placing those specific custom headers on INVITE for your trunk type — LiveKit sends mapped attributes for BYE and for documented integrations, but arbitrary INVITE header insertion may not be supported.
• Verify LiveKit’s outgoing message
◦ Collect a packet capture at the LiveKit side or capture the raw SIP message that LiveKit sends toward Kamailio. If the header is missing there, the issue is on the LiveKit/trunk configuration side.
◦ If the header is present in the message leaving LiveKit but absent when Kamailio sees it, an intermediate device is likely removing it.
• Inspect intermediate proxies / SBCs
◦ Many SBCs, proxies, or carrier networks strip unknown or X- headers for policy or security reasons. Confirm any intermediary is configured to allow/forward the header names you need.
• Header name conventions
◦ Use standard or X- prefixed header names that intermediaries are less likely to block, and ensure casing exactly matches what you configured (some systems are case-sensitive for mapping keys).
• sngrep capture scope
◦ Ensure your sngrep capture point is at the network boundary (on Kamailio host) and not only between an intermediary and Kamailio that might already have had headers stripped.
• Confirm trunk configuration
◦ For inbound flows where attributes_to_headers is used, verify the trunk configuration contains the correct mapping. Example mapping:
▪︎ "five9.route_reason": "X-RouteReason"
◦ Ensure the participant attributes keys used in mapping exactly match what LiveKit is setting.
If you can share any of the following (redact secrets):
• Example sngrep output (raw SIP message where the header is missing)
• The trunk configuration JSON showing attributes_to_headers or sip_headers
• A sample of how/where you set participant attributes in LiveKit
What I can do next once you share details
• Confirm whether headers should be emitted by LiveKit for the SIP method you need.
• Point out any misconfigurations in the mapping or attribute names.
• Help craft a targeted packet-capture command and the exact place to capture so we can determine if headers are stripped in transit.
• Suggest alternate approaches (e.g., placing needed data in a supported mapped header or in-call metadata) if arbitrary INVITE header insertion isn’t available.
If you prefer, start by posting the sngrep capture of the outgoing SIP request and your trunk mapping snippet and I’ll analyze them and give exact next steps.
Sources: How to do call transfers with Five9 | LiveKit | Preserve caller ID during SIP transfers with Twilio | LiveKit | Pass UUI data to Genesys Cloud during SIP transfers | LiveKitgentle-needle-76462
03/11/2026, 1:30 PMattributes_to_headers
4.
attrs = {
"five9.route_type": "Queue",
"five9.route_value": "Queue",
"five9.queue": "True",
"five9.iva_session_id": str(self.state.session_id or ""),
"five9.person_id": str(self.state.person_id or ""),
"five9.studio_contained": "No",
"five9.language": self.state.language or "en-US",
"five9.transfer_reason": str(reason or ""),
}
5. dont knowtall-airline-16756
03/11/2026, 1:31 PMattributes_to_headers, and you’ve shown the attributes you set. Let’s walk through targeted checks and next steps to find why Kamailio (sngrep) doesn’t see them.
Quick checklist — verify these first
1. Ensure attributes are set on the SIP participant at hangup time
◦ Confirm your code sets those attrs on the participant before the call ends. Headers mapped by attributes_to_headers are emitted only if the participant still has those attributes when LiveKit generates the BYE.
1. Confirm mapping keys exactly match trunk config
◦ The attribute names you set (e.g., five9.route_type) must match the keys in your trunk’s attributes_to_headers mapping exactly. Even small typos or different punctuation will prevent mapping.
1. Verify the trunk configuration maps each attribute to the desired SIP header
◦ Example mapping form:
"attributes_to_headers": {
"five9.route_reason": "X-RouteReason",
"five9.route_type": "X-RouteType",
"five9.route_value": "X-RouteValue",
"five9.metadata": "X-MetaData"
}
• Confirm your trunk has the mappings for the exact attribute keys you use above (e.g., five9.queue, five9.iva_session_id, etc.).
1. Capture the raw SIP message leaving LiveKit
◦ Capture at the LiveKit network edge (or from LiveKit logs) so you can confirm whether LiveKit included the X- headers in the BYE it sent. If the header is present there, the problem is downstream; if not, LiveKit didn’t include them.
1. Confirm no intermediary strips the headers
◦ If the headers are present leaving LiveKit but absent when Kamailio sees them, an SBC/proxy or carrier between LiveKit and Kamailio is likely removing unknown or X- headers. Many intermediaries drop custom headers by policy.
Targeted troubleshooting steps
1. Reproduce a single call and do two captures:
a. Capture at LiveKit egress (or retrieve LiveKit’s raw SIP for that BYE).
b. Capture on the Kamailio interface (where you run sngrep).
◦ Compare the two captures. If BYE from LiveKit contains headers but Kamailio’s packet does not, the path in between is stripping them.
1. If LiveKit’s BYE does NOT include the headers:
◦ Re-check that you set the attributes on the specific SIP participant entity LiveKit uses for that call (participant vs. room metadata).
◦ Ensure attributes are set before the session ends (i.e., before LiveKit sends BYE).
◦ Verify your agent code uses the correct LiveKit API call (update_participant or equivalent) and that it returns success.
1. If headers are present on LiveKit egress but lost before Kamailio:
◦ Check any SBCs, proxies, load balancers, or carrier hops for header-stripping policies and allow forwarding of your header names (prefer X- prefixes).
◦ Try a direct connection (if possible) from LiveKit to Kamailio to confirm intermediaries are the cause.
1. Confirm header names on Kamailio side
◦ Kamailio expects headers with exact names. If your mapping uses X-RouteReason, search sngrep for that exact header name.
◦ Some SIP stacks treat header casing differently; search case-insensitively in captures.
What would help me pinpoint the issue
• A redacted snippet of the LiveKit egress BYE (raw SIP) or confirmation of whether LiveKit’s outgoing BYE contains the headers.
• The trunk JSON snippet showing your attributes_to_headers mapping.
• A redacted sngrep capture from Kamailio showing the BYE where headers are missing.
If you want step-by-step capture commands, tell me whether you can run tcpdump on the LiveKit-side host and I’ll provide the exact tcpdump filter to capture SIP BYE traffic and the grep to look for your header names.
Next suggested action
• If you can, capture and paste (redact secrets) the raw BYE from LiveKit egress and the sngrep capture from Kamailio. I’ll compare them and tell you whether LiveKit sent the headers or if an intermediary removed them, and then give the exact fix.