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

assertion when the ACK response is recognized as a merged request #4203

Merged

Conversation

LeonidGoltsblat
Copy link
Contributor

pjsip tries to respond with 482 on any "receiving incoming requests" recognized as a merged request, but if that is ACK, calling
pjsip_endpt_respond() -> pjsip_endpt_create_response() raise folowing assertion in this last function:
/* Request MUST NOT be ACK request! */
PJ_ASSERT_RETURN(req_msg->line.req.method.id != PJSIP_ACK_METHOD,
PJ_EINVALIDOP);

If we consider ACK as a merged request, we should not issue an assertion, but can we consider ACK as a request (merged or not)?
I think this is invalid pjsip behavior, I added a check that the packet is not an ACK before calling pjsip_endpt_respond() (and made the "merged request detected" log message more informative).
This situation now results in a "dropped/not handled by any module" log message, but does not trigger an assertion.
But this is a hack...

See attached file with a trace of the real call: in-ack.txt

Remote side send us CANCEL (Frame 10), practically simulteniously with our OK (Frame 9). I am not quite sure, but received ACK (Frame 11) treated as merged request looks like the correct answer on our 200 OK (Frame 9).
I think we should recognize it as a such answer even after received CANCEL. But currently we start timer to retry OK sending, retransmit it during 30 sec and then send BYE.

@nanangizz
Copy link
Member

The ACK is not recognized as a correct answer to 200 OK and is treated as merged request because it does not have To tag (provided in the 200 response). It has nothing to do with the CANCEL (simultaneously or not). So I think the "dropped/unhandled" should be the proper behavior.


return PJ_TRUE;
PJ_LOG(4, (THIS_FILE, "Merged request detected (%s) (%s): %s from %s:%d",
dlg ? dlg->obj_name : NULL,
Copy link
Member

Choose a reason for hiding this comment

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

It is better "" or -no-dlg- rather than NULL for the %s, which may lead to undefined behavior.

@LeonidGoltsblat
Copy link
Contributor Author

OK, set -no-dlg- instead of NULL
and I hope we never see this in logs...

@sauwming sauwming merged commit fb4ccef into pjsip:master Dec 10, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants