Skip to content
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

Add headers for CreateSipParticipant #911

Merged
merged 12 commits into from
Dec 9, 2024
Merged

Conversation

s-hamdananwar
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Dec 4, 2024

🦋 Changeset detected

Latest commit: b68f3d4

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@@ -424,14 +424,22 @@ message CreateSIPParticipantRequest {
// If true, a random value for identity will be used and numbers will be omitted from attributes.
bool hide_phone_number = 10;

// These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just keep headers, and remove the mappings fields. the mappings are a level of indirection away and it's a bit difficult to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Made a new commit based on this comment

Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg, but will leave final approval to @biglittlebigben and @dennwc as we'll need to implement this in the SIP service

@biglittlebigben
Copy link
Contributor

LGTM, but dennwc may have more opinions than me on this.

Copy link
Contributor

@dennwc dennwc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good, but you also need to update the NewCreateSIPParticipantRequest function. It should now merge headers from the trunk and the request.

@s-hamdananwar s-hamdananwar requested a review from dennwc December 6, 2024 02:19
rpc/sip.go Outdated
@@ -54,6 +54,11 @@ func NewCreateSIPParticipantRequest(
features = append(features, livekit.SIPFeature_KRISP_ENABLED)
}

headers := req.Headers
if headers == nil {
headers = trunk.Headers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to iterate over key-values and add them to merge maps properly. Here you're discarding one of the maps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. My assumption was that user would be having headers in either CreateSIPParticipantRequest or SIPOutboundTrunkInfo, and if they had in both it would be the same- hence just overriding in case one is nil. Will make the requested change

Copy link
Contributor

@dennwc dennwc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I fixed headers merging, fixed changeset and added header validation that I missed during previous review. Should be good to go now!

@dennwc dennwc merged commit 47d9881 into main Dec 9, 2024
3 checks passed
@dennwc dennwc deleted the hamdan/create-sip-headers branch December 9, 2024 17:55
@github-actions github-actions bot mentioned this pull request Dec 9, 2024
@s-hamdananwar
Copy link
Contributor Author

s-hamdananwar commented Dec 9, 2024

@dennwc apologies as I completely missed this, thanks for fixing and getting this up!

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

Successfully merging this pull request may close these issues.

4 participants