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

sipsess: add sipsess_msg getter function #1225

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

cspiel1
Copy link
Collaborator

@cspiel1 cspiel1 commented Dec 4, 2024

src/sipsess/sess.c Outdated Show resolved Hide resolved
@cspiel1 cspiel1 force-pushed the ua_prevent_double_call_accept branch from d66e220 to 19194c3 Compare December 4, 2024 15:06
@sreimers sreimers added this to the v3.19.0 milestone Dec 4, 2024
if (!sess)
return false;

return sess->msg == msg;
Copy link
Contributor

Choose a reason for hiding this comment

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

is it more robust to compare the Call-ID instead of a raw pointer ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe yes. I have to check how the re-send mechanism is handled in re/baresip and how the postponed call to ua_accept() may influence this.

Copy link
Collaborator Author

@cspiel1 cspiel1 Dec 6, 2024

Choose a reason for hiding this comment

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

The sip->ht_strans hash table is used to avoid that two SIP messages with equal via.branch are processed twice. This avoids also that two SIP message (with different pointers) with equal call-id are processed twice. This is handled all by re.

So I think that comparing the pointers are perfect in order to avoid that multiple call objects are allocated for one SIP INVITE.

edit: Comparing call-id would also work. Does it have any benefit?

Copy link
Member

Choose a reason for hiding this comment

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

edit: Comparing call-id would also work. Does it have any benefit?

Let's say you duplicate the sip_msg for some reason (multi threading...):

struct sip_msg msg = *msg_orig;
sipsess_msg_equal(csess, &msg);

This would fail.

src/sipsess/sess.c Outdated Show resolved Hide resolved
@sreimers sreimers changed the title ua prevent double call accept sipsess: add sipsess_msg getter function Dec 11, 2024
@sreimers sreimers merged commit aeea831 into baresip:main Dec 11, 2024
38 checks passed
@cspiel1 cspiel1 deleted the ua_prevent_double_call_accept branch December 11, 2024 11:45
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.

3 participants