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

fix: add sip uri port if missing #156

Conversation

InnovativeUS
Copy link
Contributor

Add default port if it is missing in an address.

This is needed to ensure the requests without a port are matched in the connection pool

@emiago
Copy link
Owner

emiago commented Nov 27, 2024

Default port is handled by transport layer, so if you send request and port is missing transport layer will add it.
This comes couple times already, but library has no usage of this method. It was mostly added as read property, but sip URI has limited knowledge of what transport will be used?

@InnovativeUS
Copy link
Contributor Author

Unfortunately if the request has no route, the address of the contact is used.

sipgo/dialog_server.go:144

// Check Route Header
// Should be handled by transport layer but here we are making this explicit
if rr := req.Route(); rr != nil {
	req.SetDestination(rr.Address.HostPort())
}

That was where we were experiencing the issue

@emiago
Copy link
Owner

emiago commented Nov 27, 2024

Hi @InnovativeUS can you actually test your code, by removing that line. Normally Route headers are handled by default.
Problem is, I can not get reason anymore why I made this explicit. Probably there was old issue

@InnovativeUS
Copy link
Contributor Author

I have tested and removing the lines below do not affect the flow. I think we can close this PR since the world has moved on.

// Check Route Header
// Should be handled by transport layer but here we are making this explicit
if rr := req.Route(); rr != nil {
req.SetDestination(rr.Address.HostPort())
}

@emiago
Copy link
Owner

emiago commented Dec 10, 2024

Hi @InnovativeUS . Not sure do I get your last response correctly. If anything needs to done here, go ahead open issue.
I will check that line my self once more.

@emiago emiago closed this Dec 10, 2024
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.

2 participants