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

Final response 2xx not retransmitted when transport is closed #3828

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

trengginas
Copy link
Member

When transport is closed before sending 2xx final response, the message will fail to be sent.
However, it is not retransmitted.

15:18:01.361       sip_endpoint.c  Processing incoming message: Request msg INVITE/cseq=1 (rdata0xd6da70)
15:18:01.361          tsx0xd75a38  ..Transaction created for Request msg INVITE/cseq=1 (rdata0xd70518)
15:18:01.361          tsx0xd75a38  .Incoming Request msg INVITE/cseq=1 (rdata0xd70518) in state Null
15:18:01.361          tsx0xd75a38  ..State changed from Null to Trying, event=RX_MSG
15:18:01.361          dlg0xd747d8  ...Transaction tsx0xd75a38 state changed to Trying
15:18:01.361          dlg0xd747d8  .UAS dialog created
...
15:18:01.361          tsx0xd75a38  ....State changed from Trying to Proceeding, event=TX_MSG
15:18:01.361          dlg0xd747d8  .....Transaction tsx0xd75a38 state changed to Proceeding
15:18:01.361          inv0xd747d8  ......State changed from NULL to INCOMING, event=TSX_STATE
...
15:18:01.367         tcps0xd6d788 !TCP connection closed
15:18:01.367      sip_transport.c  Transport tcps0xd6d788 shutting down, force=0
15:18:01.368      sip_transport.c  Transport tcps0xd6d788 is being destroyed due to timeout in idle timer
15:18:01.368         tcps0xd6d788  TCP transport destroyed with reason 70016: End of file (PJ_EEOF)
...
15:18:01.368          inv0xd747d8  .Sending Response msg 200/INVITE/cseq=1 (tdta0x7fec84008738)
15:18:01.368      sip_transport.c  .Tx data Response msg 200/INVITE/cseq=1 (tdta0x7fec84001478) cloned
15:18:01.368          dlg0xd747d8  ..Sending Response msg 200/INVITE/cseq=1 (tdta0x7fec84001478)
15:18:01.368          tsx0xd75a38  ..Sending Response msg 200/INVITE/cseq=1 (tdta0x7fec84001478) in state Proceeding
...
15:18:01.378   tcpc0x7fec8400e178 !TCP connect() error: [code=120111]: Connection refused
15:18:01.378          tsx0xd75a38  Failed to send Response msg 200/INVITE/cseq=1 (tdta0x7fec84001478)! err=120111 (Connection refused)
15:18:01.378   tcpc0x7fec8400e178  TCP send() error, sent=-120111
15:18:01.378      sip_transport.c  Transport tcpc0x7fec8400e178 shutting down, force=0
15:18:01.378      sip_transport.c  Transport tcpc0x7fec8400e178 is being destroyed due to timeout in idle timer
15:18:01.378   tcpc0x7fec8400e178  TCP transport destroyed with reason 120111: Connection refused
15:18:33.369          tsx0xd75a38  Timeout timer event
15:18:33.369          tsx0xd75a38  .State changed from Completed to Terminated, event=TIMER
15:18:33.369          dlg0xd747d8  ..Transaction tsx0xd75a38 state changed to Terminated
15:18:33.369           sip_util.c  ...Request msg BYE/cseq=16412 (tdta0xd7a8b8) created.

When the transport is closed, the response will be sent using pjsip_endpt_send_response()

tsx->transport_flag |= TSX_HAS_PENDING_TRANSPORT;

with TSX_HAS_PENDING_TRANSPORT set and later will prevent the retransmit timer from being scheduled and instead setting TSX_HAS_PENDING_RESCHED.
tsx->transport_flag |= TSX_HAS_PENDING_RESCHED;

This patch will check if TSX_HAS_PENDING_RESCHED is set, and schedule the timer in the case that the send failed.

@trengginas trengginas added this to the release-2.15 milestone Jan 11, 2024
@trengginas trengginas self-assigned this Jan 11, 2024
@sauwming
Copy link
Member

The CI tests failed.

@trengginas
Copy link
Member Author

restarted the registrar, and now it's fine

@trengginas trengginas merged commit b6cc71a into master Jan 15, 2024
35 checks passed
dshamaev-intermedia pushed a commit to intermedia-net/pjproject that referenced this pull request Apr 5, 2024
dshamaev-intermedia added a commit to intermedia-net/pjproject that referenced this pull request Apr 5, 2024
* Add option to shutdown all transports on IP change (pjsip#3781)

* pjsua_handle_ip_change: Added missing null check for on_ip_changed_progress callback (pjsip#3830)

* Reset stored remote name in dialog (dlg->initial_dest) if transport is server. (pjsip#3783)

* Prevent immediate tsx termination upon transport error (pjsip#3805)

* Fixed issues when adding new media and deinitializing media (pjsip#3821)

* Potential issues when IPv6 is disabled (pjsip#3835)

* Improve IP address change IPv4 <-> IPv6 (pjsip#3910)

* Add some missing unlocks (pjsip#3893)

* add missing unlock (pjsip#3885)

* Retransmit 2xx response when transport is closed (pjsip#3828)

* Fixed account's route set update when modifying account (pjsip#3825)

---------

Co-authored-by: Nanang Izzuddin <[email protected]>
Co-authored-by: sauwming <[email protected]>
Co-authored-by: Santiago De la Cruz <[email protected]>
Co-authored-by: Andreas Wehrmann <[email protected]>
Co-authored-by: Riza Sulistyo <[email protected]>
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