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

My incoming calls hang up in the 15th sec with RTP time-out without being able to hear from the caller and the caller can't hear me #480

Open
wishwelloklu opened this issue Sep 30, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@wishwelloklu
Copy link

Describe the bug
I am running my sip for both incoming and outgoing call. The outgoing works perfectly but with incoming calls. I don't get audio and the other party can hear me speak and then the call hangs up on the 15th sec with call ended with cause: Code: [408], Cause: RTP Timeout, Reason: RTP Timeout. I am running every call function including the ongoing call which works perfectly on a background thread using flutter_background_services package

Microphone usage icon is not visible for incoming calls but visible for outgoing calls.

Logs

I/FlutterWebRTCPlugin(16786): getUserMedia(audio): mandatory: [], optional: [googNoiseSuppression: true, googEchoCancellation: true, echoCancellation: true, googEchoCancellation2: true, googDAEchoCancellation: true]
D/FlutterWebRTCPlugin(16786): MediaStream id: aba87cdd-7583-48bf-ac24-122170133dfc
I/flutter (16786): [2024-09-30 09:55:09.414] Level.debug rtc_session.dart:448 ::: answer()
I/flutter (16786): [2024-09-30 09:55:09.425] Level.debug dialog.dart:116 ::: dialog b7cffa09-05d4-41a4-9382-b03c223c35f4ltz7tz0sh4cb9c070f-da9f-4360-bd0e-b3f257e34832 changed to CONFIRMED state
I/flutter (16786): trying to add null key
I/flutter (16786): [2024-09-30 09:55:09.779] Level.debug rtc_session.dart:1616 ::: emit "peerconnection"
I/flutter (16786): [2024-09-30 09:55:09.790] Level.debug rtc_session.dart:636 ::: emit "sdp"
D/FlutterWebRTCPlugin(16786): onAddTrack
I/flutter (16786): [2024-09-30 09:55:09.882] Level.debug rtc_session.dart:2929 ::: session connecting
I/flutter (16786): [2024-09-30 09:55:09.884] Level.debug rtc_session.dart:2930 ::: emit "connecting"
I/flutter (16786): [2024-09-30 09:55:09.913] Level.debug sip_ua_helper.dart:252 ::: call connecting
I/flutter (16786): callState: CONNECTING
I/flutter (16786): [2024-09-30 09:55:09.930] Level.debug rtc_session.dart:1623 ::: createLocalDescription()
I/flutter (16786): callState: STREAM
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: initPlayout(sampleRate=48000, channels=1, bufferSizeFactor=1.0)
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: byteBuffer.capacity: 960
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: minBufferSizeInBytes: 4232
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: createAudioTrackBeforeOreo
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: nativeOutputSampleRate: 48000
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: AudioTrack: session ID: 297, channels: 1, sample rate: 48000, max gain: 1.0
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: AudioTrack: buffer size in frames: 2116
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: AudioTrack: buffer capacity in frames: 2116
I/org.webrtc.Logging(16786): VolumeLogger: start@[name=worker_thread - 17209, id=140]
I/org.webrtc.Logging(16786): VolumeLogger: audio mode is: MODE_IN_COMMUNICATION
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: startPlayout
I/flutter (16786): callState: STREAM
I/org.webrtc.Logging(16786): VolumeLogger: VOICE_CALL stream volume: 3 (max=5)
I/org.webrtc.Logging(16786): WebRtcAudioTrackExternal: AudioTrackThread@[name=AudioTrackJavaThread, id=163]

To Reproduce
Steps to reproduce the behavior:

  1. Call from a different phone
  2. Answer call from the app

Expected behavior
I expected the to hear from the caller and the caller to hear from me but the call hangs up on 15th sec

System Infomation()
Flutter SDK Version: Flutter 3.24.0, Dart 3.5.0
Target OS and Version:
Host OS and Version:

@wishwelloklu wishwelloklu added the bug Something isn't working label Sep 30, 2024
@dmagic99
Copy link

I think your Audio codec mismatch with server

@wishwelloklu
Copy link
Author

I think your Audio codec mismatch with server

Okay. I will check that

@wishwelloklu
Copy link
Author

How do I update the audio codec to a preferred choice?

Below is my method to answer call

Future answerCall() async {
    try {
      final mediaContraints = {'audio': true, 'video': false};
      final mediaStream =
          await navigator.mediaDevices.getUserMedia(mediaContraints);

      _call?.answer(helper.buildCallOptions(true), mediaStream: mediaStream);
    } catch (e) {
      print('err: $e');
    }
  }

@viniciusoliverrs
Copy link

Any solution?

@wishwelloklu
Copy link
Author

Any solution?

No please. It is true that the audio codecs mismatch. Now the problem is how to set my preferred audio codec with flutter_webrtc. The documentation on the package for setting the codec is not clear

@mikaelwills
Copy link
Contributor

Which codecs are sent in the SDP in your invite to your PBX are determined deep in WebRTC code which is maintained by google as apart of the chromium project, WebRTC gets the codecs that your hardware actually supports.

From any digging ive done theres no way you can 'specify' what codecs you want to use way back up in this flutter sip package, unless you manually modify the SDP before it goes out but then what if you give it a codec that your device physically doesnt support?

I would make my server line up with what codecs are in my SDP instead. With FreePBX and 3cx they have have a long check box page where you can tick which codecs you want to use.

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

No branches or pull requests

4 participants