sip icon indicating copy to clipboard operation
sip copied to clipboard

LiveKit attributes are not mapped to SIP X-* headers when sending BYE

Open arpesenti opened this issue 7 months ago • 0 comments

I have configured an inbound trunk with an attributes_to_headers mapping. My goal is to set some custom headers in the BYE request when the call is ended. However if I look at the BYE headers from livekit-sip it does not contain the custom one specified by me.

I have added some debugging code in inbound.go and it looks like the headers are not set by the following callback because the room is nil.

cc := s.newInbound(LocalTag(callID), s.ContactURI(tr), req, tx, func(headers map[string]string) map[string]string {
        c := call
        if c == nil || len(c.attrsToHdr) == 0 {
                return headers
        }
        r := c.lkRoom.Room()
        if r == nil {
                return headers
        }
        headers = AttrsToHeaders(r.LocalParticipant.Attributes(), c.attrsToHdr, headers)
        fmt.Println("headers", headers)
        return headers
})

The livekit agent is hanging up by deleting the room. Is that the issue? Shouldn't the custom header be set anyway in the BYE request even if the room has been destroyed?

arpesenti avatar Jul 01 '25 15:07 arpesenti