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

strans/accept: fix cancel/rejection #423

Merged
merged 4 commits into from
Jul 8, 2022

Conversation

maximilianfridrich
Copy link
Contributor

@maximilianfridrich maximilianfridrich commented Jul 6, 2022

This PR fixes an issue introduced with PR #419. It prevented a call from being canceled during early media/ringing if a 100rel/PRACK exchange happened in the transaction.

Without the changes in src/sipsess/accept.c, the SIP 4xx responses were being retransmitted until T2 fired even though the 4xx responses were being ACKed. I haven't been able to figure out why that happened, maybe there is a better solution than the one I propose in this PR.

Update: The server transactions are now being correctly used. The changes in this PR provide a clean solution.

src/sipsess/accept.c Outdated Show resolved Hide resolved
src/sip/strans.c Outdated Show resolved Hide resolved
src/sip/strans.c Outdated Show resolved Hide resolved
@maximilianfridrich
Copy link
Contributor Author

maximilianfridrich commented Jul 7, 2022

I have tried to find a different approach by not resetting the server transaction when a response code >=200 is received to a PRACK message (in sip/strans.c:sip_strans_reply:358). That simplified some of the changes introduced with PR #419 but led to multiple memory leaks that I was not able fix easily.

The solution was to not re-use the server transaction of the initial INVITE when replying to a PRACK. The function sip_treplyf allocates a new temporary strans if no strans is passed to it. This way, the server transaction of the initial INVITE is not erroneously freed.

src/sipsess/accept.c Outdated Show resolved Hide resolved
src/sipsess/reply.c Fixed Show fixed Hide fixed
In sipsess_reply_2xx, the reply is sent using a server transaction which
sets the st to NULL when replying with scode >=200. This is problematic
when sending 2xx responses to PRACKs after which sess->st was NULL.
Now, st is not passed to sip_treplyf if the request was PRACK, so st is
not set to NULL.
src/sipsess/accept.c Outdated Show resolved Hide resolved
src/sipsess/accept.c Outdated Show resolved Hide resolved
@cspiel1 cspiel1 merged commit a39ce9d into baresip:main Jul 8, 2022
@maximilianfridrich maximilianfridrich deleted the hangup_hotfix branch July 8, 2022 07:28
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