dart-sip-ua icon indicating copy to clipboard operation
dart-sip-ua copied to clipboard

Dead code in _sendReinvite, RTP Timeout

Open melio-matt opened this issue 1 year ago • 3 comments

I've been tracing an issue that causes my call to be disconnected once I initiate a hold command, which performs a reinvite request to be sent. The problem is that about 10 seconds after initiating hold, I will get an RTP timeout error message and the call is dropped.

During the tracing I found a block of code that to my eyes can never be executed. In the 0.5.5 code base rtc_session.dart on line 2488 does a null check on the succeeded variable and if it is not null then returns from the onSucceeded callback method. I can not see how this variable will ever be null as it refers to the enclosed variable on line 2290 and no where in this method is that ever set to null. In addition it is set to true on line 2359 which is after the call to onSucceeded.

What is this code for or have I misread?

melio-matt avatar Mar 13 '23 17:03 melio-matt

Good catch. No,of course that return will never be triggered. The reason behind this is, that this library was originally ported from JavaScript before Dart had sound nullability. Therefore there was a lot of simply incorrect code once null checks became mandatory. I have previously attempted to eliminate as many null issues as possible, but as you can see by the line numbers that you quoted, there is a lot of code to sift trough.

Therefore if you find any null checking related code that seems wrong, it more than likely is.

If you find the root cause of your RTP timeout feel free to submit a PR.

Perondas avatar Mar 16 '23 12:03 Perondas

Turned out to be SIP messages not flowing through the various systems properly. Feel free to close this or leave it open as a reminder of the dead code block to be cleaned up.

melio-matt avatar Mar 28 '23 15:03 melio-matt