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

Hold not working #339

Closed
abhiddreambolix opened this issue Jan 11, 2023 · 15 comments · Fixed by #351
Closed

Hold not working #339

abhiddreambolix opened this issue Jan 11, 2023 · 15 comments · Fixed by #351
Assignees
Labels
bug Something isn't working

Comments

@abhiddreambolix
Copy link

when updated to latest version from 0.5.2 to 0.5.3 my hold has stopped working its was not working in 0.5.1 so we updated to 0.5.2 but later on when i updated to 0.5.3 it again got the same issue.

@abhiddreambolix abhiddreambolix added the bug Something isn't working label Jan 11, 2023
@abhiddreambolix
Copy link
Author

please update

@Perondas
Copy link
Collaborator

Perondas commented Feb 6, 2023

Could you provide more detail?
How exactly is it no longer working?
Error logs, flutter doctor, etc...

@berger89
Copy link
Contributor

We have the same problem with incoming calls.
Level.debug sip_ua_helper.dart:238 ::: call ended with cause: Code: [200], Cause: Terminated, Reason: BYE Received

@Perondas
Copy link
Collaborator

We have the same problem with incoming calls. Level.debug sip_ua_helper.dart:238 ::: call ended with cause: Code: [200], Cause: Terminated, Reason: BYE Received

This appears to be a gracefully bye from the remote end. When does this occur specifically?

@berger89
Copy link
Contributor

On an incoming (answered) call, when you call call?.hold(), this error message comes up

@berger89
Copy link
Contributor

berger89 commented Feb 23, 2023

I found the issue/crash:

08:55:30.702  I  [2023-02-23 08:55:30.701] Level.debug rtc_session.dart:1011 ::: hold()
08:55:30.703  I  [2023-02-23 08:55:30.702] Level.debug rtc_session.dart:2956 ::: session onhold
08:55:30.704  I  [2023-02-23 08:55:30.703] Level.debug rtc_session.dart:2958 ::: emit "hold"
08:55:30.704  I  WebRtcAudioRecordExternal: stopRecording
08:55:30.704  I  WebRtcAudioRecordExternal: stopThread
08:55:30.705  I  [2023-02-23 08:55:30.704] Level.debug sip_ua_helper.dart:254 ::: call hold
08:55:30.705  I  _liveDataCall.direction: INCOMING
08:55:30.705  I  callStateChanged: HOLD
08:55:30.705  I  call: true
08:55:30.708  I  [2023-02-23 08:55:30.705] Level.debug rtc_session.dart:2434 ::: sendReinvite()
08:55:30.709  I  [2023-02-23 08:55:30.708] Level.debug rtc_session.dart:1606 ::: createLocalDescription()
08:55:30.710  I  �[38;5;196m[2023-02-23 08:55:30.709] Level.error rtc_session.dart:1622 ::: emit "peerconnection:createofferfailed" [error:Null check operator used on a null value]�[0m
08:55:30.710  I  �[38;5;196m[2023-02-23 08:55:30.710] Level.error rtc_session.dart:1685 ::: emit "peerconnection:setlocaldescriptionfailed" [error:LateInitializationError: Local 'desc' has not been initialized.]�[0m
08:55:30.711  E  [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
                 #0      RTCSession._createLocalDescription (package:sip_ua/src/rtc_session.dart:1620:58)
                 #1      RTCSession._sendReinvite (package:sip_ua/src/rtc_session.dart:2503:17)
                 #2      RTCSession.hold (package:sip_ua/src/rtc_session.dart:1052:7)
                 #3      Call.hold (package:sip_ua/src/sip_ua_helper.dart:472:14)
                 #4      CallViewModel.holdOrUnholdActiveCall (package:flutter/view/call/call_view_model.dart:79:32)
                 #5      _CallState._buildDialerButtons.<anonymous closure> (package:flutter/view/call/call_screen.dart:142:26)
                 #6      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1096:21)
                 #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
                 #8      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:627:11)
                 #9      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:306:5)
                 #10     BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:239:7)
                 #11     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:615:9)
                 #12     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
                 #13     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
                 #14     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
                 #15     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
                 #16     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
                 #17     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:460:19)
                 #18     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:440:22)
                 #19     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:336:11)
                 #20     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:395:7)
                 #21     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:357:5)
                 #22     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:314:7)
                 #23     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:295:7)
                 #24     _invoke1 (dart:ui/hooks.dart:164:13)
                 #25     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
                 #26     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)
08:55:30.711  I  �[38;5;196m[2023-02-23 08:55:30.711] Level.error rtc_session.dart:2532 ::: Bad state: Future already completed�[0m
08:55:30.711  I  �[38;5;196m#0      _Completer.completeError (dart:async/future_impl.dart:15:31)
                 #1      RTCSession._createLocalDescription (package:sip_ua/src/rtc_session.dart:1688:17)
                 #2      RTCSession._sendReinvite (package:sip_ua/src/rtc_session.dart:2503:17)
                 #3      RTCSession.hold (package:sip_ua/src/rtc_session.dart:1052:7)
                 #4      Call.hold (package:sip_ua/src/sip_ua_helper.dart:472:14)
                 #5      CallViewModel.holdOrUnholdActiveCall (package:flutter/view/call/call_view_model.dart:79:32)
                 #6      _CallState._buildDialerButtons.<anonymous closure> (package:flutter/view/call/call_screen.dart:142:26)
                 #7      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1096:21)
                 #8      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
                 #9      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:627:11)
                 #10     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:306:5)
                 #11     BaseTapGestureRecognizer.handlePrimaryPointer (p
08:55:30.712  I  [2023-02-23 08:55:30.712] Level.debug rtc_session.dart:693 ::: terminate()

@berger89
Copy link
Contributor

berger89 commented Feb 23, 2023

Workaround:
sending an empty rtcOfferConstraints Map in the .answer() call will fix the issue:

    Map<String, dynamic>? constraints = {'': {}};
    sipUaModel.liveDataCall?.answer({'rtcOfferConstraints': constraints});

@Perondas
Copy link
Collaborator

Aight, seems I let something slip past in the Null rework that happened a while ago. Thank you for the trace, I should hopefully be able to fix it.

@Perondas Perondas self-assigned this Feb 23, 2023
@abhiddreambolix
Copy link
Author

@berger89 thanks the solution is working

Workaround: sending an empty rtcOfferConstraints Map in the .answer() call will fix the issue:

    Map<String, dynamic>? constraints = {'': {}};
    sipUaModel.liveDataCall?.answer({'rtcOfferConstraints': constraints});

@Perondas
Copy link
Collaborator

I am trying to recreate this bug, but I am having no luck. The only null check operators in the _createLocalDescription method are all called on the _connection member. This one should however be initialized basically as soon as the call is created.
I also attempted to call hold() while receiving a call (having not yet accepted), but not even this caused an exception to occur or the call to stop.

Meaning, that I can't determine what is causing this issue using my setup. Therefore I would like to ask anyone having this issue, to create a minimal example that exhibits this behaviour.

@melio-matt
Copy link

I have also experienced exactly the same problem as described by @berger89 and get the same stack trace (line and column). The work around @berger89 suggests does solve the problem (thanks) and seems to alter the messaging back to the server. Once the work around is present it does not send a SIP UPDATE message. I am also able to take the call back off hold which is good. However as soon as I have performed any hold operation it is only a matter of about 10 seconds before I get the following stack trace.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method '[]=' was called on null.
Receiver: null
Tried calling: []=("IceRestart", true)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      RTCSession._iceRestart (package:sip_ua/src/rtc_session.dart:1555:34)
#2      RTCSession._createRTCConnection.<anonymous closure> (package:sip_ua/src/rtc_session.dart:1572:9)
#3      RTCPeerConnectionNative.eventListener (package:flutter_webrtc/src/native/rtc_peerconnection_impl.dart:84:31)
#4      _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
#5      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#6      _DelayedData.perform (dart:async/stream_impl.dart:515:14)
#7      _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
#8      _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
#9      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#10     _startMicrotaskLoop (dart:asy<…>

Then I've about another 10 seconds before a BYE is sent with:

Reason: SIP ;case=408; text="RTP Timeout"

being seen in the SIP message and the call is cut off. I did not seem to have these issues with the previous version.

@Perondas Perondas mentioned this issue Mar 8, 2023
@Perondas
Copy link
Collaborator

Perondas commented Mar 8, 2023

@melio-matt @berger89 Could the two of you please test if the issue is resolved by #351?

@melio-matt
Copy link

Hi @Perondas

I've test the fix and it cures the problem when pressing hold and I don't now have to use the workaround as suggested by @berger89. It also removes the second stack trace that I shared.
However, I still get the RTP Timeout issue. I will look a little more into this and report back. If @berger89 tests as well and there are no problems then it may be a slightly different issue that is only semi related.

thanks for sorting this.

@berger89
Copy link
Contributor

berger89 commented Mar 8, 2023

Hi @Perondas,
Thank you for fixing the problem!

For me, the problem is solved with the solution in #351. I left the call on hold for over 2 minutes and there were no problems.

@DeviArunaMurugan
Copy link

@melio-matt : Have you found any solution for RTP-Timeout issue, when putting the call on hold?I am also facing the same issue .

I have also experienced exactly the same problem as described by @berger89 and get the same stack trace (line and column). The work around @berger89 suggests does solve the problem (thanks) and seems to alter the messaging back to the server. Once the work around is present it does not send a SIP UPDATE message. I am also able to take the call back off hold which is good. However as soon as I have performed any hold operation it is only a matter of about 10 seconds before I get the following stack trace.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method '[]=' was called on null.
Receiver: null
Tried calling: []=("IceRestart", true)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      RTCSession._iceRestart (package:sip_ua/src/rtc_session.dart:1555:34)
#2      RTCSession._createRTCConnection.<anonymous closure> (package:sip_ua/src/rtc_session.dart:1572:9)
#3      RTCPeerConnectionNative.eventListener (package:flutter_webrtc/src/native/rtc_peerconnection_impl.dart:84:31)
#4      _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
#5      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#6      _DelayedData.perform (dart:async/stream_impl.dart:515:14)
#7      _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
#8      _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
#9      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#10     _startMicrotaskLoop (dart:asy<…>

Then I've about another 10 seconds before a BYE is sent with:

Reason: SIP ;case=408; text="RTP Timeout"

being seen in the SIP message and the call is cut off. I did not seem to have these issues with the previous version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants