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

Custom From header for InviteBridge causes strange behaviour. #34

Open
yallxe opened this issue Dec 28, 2024 · 3 comments
Open

Custom From header for InviteBridge causes strange behaviour. #34

yallxe opened this issue Dec 28, 2024 · 3 comments

Comments

@yallxe
Copy link

yallxe commented Dec 28, 2024

Hello,
I'm trying to use the InviteBridge function with custom From header (because I'm trying to call a remote UAS), and it doesn't work well. It didn't add automatically a tag to From header, but I decided to add it manually. It fixed the issue partially, but the ACK that is send after 200 OK had wrong From tag there, which confused me even more. Here is my code:

outFromHeader = sip.FromHeader{
	Address: sip.Uri{
		User: "foobar",
		Host: "foobar.com",
		Port: 5060,
	},
	Params: sip.NewParams().Add("tag", sip.GenerateTagN(16)),
}
outDialog, err := d.InviteBridge(ctx, destinationSipUri, &bridge, diago.InviteOptions{
	Username:    authUsername,
	Password:    authPassword,
	TransportID: "remote",
	Headers:     []sip.Header{
		sip.NewHeader("From", outFromHeader.Value()),
	},
)
...
@emiago
Copy link
Owner

emiago commented Dec 28, 2024

Hi @yallxe . Current logic is that it checks do you have dialog added into bridge.
It could be not best design, but it takes that as originator.
Now when I see this, it could be also wrong design, and originator should be explicit.

Try adding your originator into bridge before dialing

@yallxe
Copy link
Author

yallxe commented Dec 28, 2024

I modified my code a little bit:

outFromHeader = sip.FromHeader{
	Address: sip.Uri{
		User: "foobar",
		Host: "foobar.com",
		Port: 5060,
	},
	Params: sip.NewParams(),  // if this was nil, i was getting panic somewhere inside diago's code
}
outDialog, err := d.InviteBridge(ctx, destinationSipUri, &bridge, diago.InviteOptions{
	Username:    authUsername,
	Password:    authPassword,
	TransportID: "remote",
	Headers:     []sip.Header{
		&outFromHeader,
	},
)

And it works just fine. Absolutely no errors or bugs.

@emiago
Copy link
Owner

emiago commented Dec 28, 2024

hi @yallxe . Ok I see. You want some custom From header. Sure it is find to pass,
but generally you want to have this from user same as originator (dialog with who you are bridging).
Normally this is what diago will update for you, but yeah if you need more custom from this is fine.

Yes, I think there are no checks in case nil, this is probably more on sipgo lib.

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