Skip to content

Unable to pass INVITE headers to SIP Participant #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nharris-star2star opened this issue May 14, 2025 · 7 comments
Open

Unable to pass INVITE headers to SIP Participant #358

nharris-star2star opened this issue May 14, 2025 · 7 comments
Assignees

Comments

@nharris-star2star
Copy link

Hello, I am able to make calls in to LLM agent without issue. The livekit ecosystem is really great. However, I am having a problem passing the INVITE headers along to the participant attributes.

inbound-trunk.json
{ "trunk": { "include_headers": 2, "headers_to_attributes: { "X-Test": "xTest" }, "name": "{REDACTED} inbound trunk", "numbers": ["+1{REDACTED}"] } }

I have tested using the v1.0.0 tag of the SIP service and v1.8.4 of livekit-server. I have tried various permutations and combinations of include_headers values along with or without headers_to_attributes and attributes_to_headers. I have used the python SDK as well as the lk-cIi to create the inbound trunk. I apologize if I am missing something or have something misconfigured. Any suggestions on how to get this working or is this feature not yet implemented?

Thanks

@dennwc
Copy link
Contributor

dennwc commented May 15, 2025

Hey @nharris-star2star ! How are you accessing the headers after the call is established? Is it in the webhook?

@dennwc dennwc self-assigned this May 15, 2025
@nharris-star2star
Copy link
Author

Hi @dennwc! Thanks for the quick response. I am using the python agents version 1.0.20 and looking for the headers on the participant attributes. I have all the standard SIP attributes described here, but none of the X-*, or any other headers for that matter make it to the participant.

participant = await ctx.wait_for_participant() logger.info(f"participant attributes: {participant.attributes}")

@dennwc
Copy link
Contributor

dennwc commented May 15, 2025

Please note that header-related attributes won't be set immediately. Ideally, you should use the attributes changed hook on the participant to see the headers when they become available.

@nharris-star2star
Copy link
Author

Ok. I will check that out and report back. I don't know if it is helpful, but it appears the headers are null when the call is accepted. Is that in line with what you are saying and expected?
2025-05-15T14:12:07.239Z INFO sip sip/inbound.go:468 Accepting the call {"nodeID": "NE_uaTngg4pChwR", "callID": "SCL_Cm3REdULVnZA", "fromIP": "{REDACTED}", "toIP": "{REDACTED}:5060", "fromHost": "{REDACTED}", "fromUser": "ivr", "toHost": "{REDACTED}", "toUser": "is_1256900", "sipTag": "mmm0tmNZZa3mN", "sipCallID": "6b704f8c-ac39-123e-a59f-005056aa6183", "sipRule": "SDR_ETUTL7MEM3oA", "room": "call-_ivr_M2qRbfReCTf2", "participant": "sip_ivr", "participantName": "Phone ivr", "headers": null}

@nharris-star2star
Copy link
Author

I added a listener for the participant attributes, and I am seeing the default attributes update, but none of the INVITE headers ever make it in to the participant.

@ctx.room.on("participant_attributes_changed") def on_participant_attributes_changed(changed_attrs: dict[str, str], participant: rtc.Participant): print(f"Participant {participant.identity} updated attributes: {changed_attrs}") print(f"Current attributes: {participant.attributes}")

Participant sip_ivr updated attributes: {'sip.callStatus': 'active'} Current attributes: {'sip.ruleID': 'SDR_ETUTL7MEM3oA', 'sip.callTag': 'NDyD9BQgN57Bc', 'sip.callID': 'SCL_6X4JPegeXz2M', 'sip.callIDFull': '0ad07179-ac46-123e-a59f-005056aa6183', 'sip.trunkPhoneNumber': 'is_1256900', 'sip.phoneNumber': 'ivr', 'sip.callStatus': 'active'}

@nharris-star2star
Copy link
Author

nharris-star2star commented May 15, 2025

I logged out the value of opts in types.go and it shows 2025/05/15 20:19:31 SIPHeaderOptions: SIP_NO_HEADERS
So even though inboud-trunk.json has include_headers: 2 the if statement is skipping adding the headers to the attributes.

I confirmed the participant in the agent code has all the attributes by commenting out that check for testing (line 257 of pkg/sip/types.go). I'll see if I can figure out why this is.

@nharris-star2star
Copy link
Author

It looks like the resp in line 25 of pkg/service/psrpc.go is empty, therefore no TrunkID and if no TrunkID no trunk config?

I see there are some open PRs to sync up some of the libs with livekit server. I'm not sure if any of those updates will resolve the problem. I'll try to dig deeper as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants