flutterjanus/flutter_janus_client

App crashes when receiving a SIP call

Closed this issue · 6 comments

Describe the bug
When the user receives a SIP call (Janus), the app crashes just after receiving the incomingcall event, though the error seems to point towards an issue with WebRTC. For further insight, we were using an older version of Janus, which was working just fine for our app; the issue began when we switched to a much more recent version of Janus. I have also raised this issue here, since the issue seems to be on FlutterWebRTC's end, though I wanted to check if something similar has been dealt with before in this repo.

To Reproduce
Start the app and register the user's SIP extension, then wait for a call. The following error shows in the console as the app crashes:

W/System.err( 5350): java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.lang.String)' on a null object reference
W/System.err( 5350):     at org.webrtc.JniHelper.getStringBytes(JniHelper.java:25)
W/System.err( 5350):     at org.webrtc.PeerConnection.nativeAddIceCandidate(Native Method)
W/System.err( 5350):     at org.webrtc.PeerConnection.addIceCandidate(PeerConnection.java:937)
W/System.err( 5350):     at com.cloudwebrtc.webrtc.MethodCallHandlerImpl.peerConnectionAddICECandidate(MethodCallHandlerImpl.java:1539)
W/System.err( 5350):     at com.cloudwebrtc.webrtc.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:301)
W/System.err( 5350):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
W/System.err( 5350):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
W/System.err( 5350):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
W/System.err( 5350):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
W/System.err( 5350):     at android.os.Handler.handleCallback(Handler.java:938)
W/System.err( 5350):     at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 5350):     at android.os.Looper.loop(Looper.java:250)
W/System.err( 5350):     at android.app.ActivityThread.main(ActivityThread.java:7848)
W/System.err( 5350):     at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 5350):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
W/System.err( 5350):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
E/rtc     ( 5350): #
E/rtc     ( 5350): # Fatal error in: gen/sdk/android/generated_metrics_jni/../../../../../../sdk/android/src/jni/jni_generator_helper.h, line 94
E/rtc     ( 5350): # last system error: 11
E/rtc     ( 5350): # Check failed: !env->ExceptionCheck()
E/rtc     ( 5350): # 
F/libc    ( 5350): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5350 ([hiperme.app](http://hiperme.app/)), pid 5350 ([hiperme.app](http://hiperme.app/))
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'motorola/odessa_retail/odessa:11/RPAS31.Q2-59-17-4-3-9/412e48:user/release-keys'
Revision: 'pvt'
ABI: 'arm64'
Timestamp: 2022-12-07 10:55:30-0600
pid: 5350, tid: 5350, name: [hiperme.app](http://hiperme.app/)  >>> [hiperme.app](http://hiperme.app/) <<<
uid: 10521
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    x0  0000000000000000  x1  00000000000014e6  x2  0000000000000006  x3  0000007fc6171070
    x4  0000007c04fff000  x5  0000007c04fff000  x6  0000007c04fff000  x7  000000000332971c
    x8  00000000000000f0  x9  fd5021796680ad88  x10 0000000000000000  x11 ffffffc0fffffbdf
    x12 0000000000000001  x13 00000000000000c3  x14 002511ba45439f42  x15 000043b909b0b0d4
    x16 0000007bfef88c80  x17 0000007bfef6a740  x18 0000007c04ee6000  x19 00000000000014e6
    x20 00000000000014e6  x21 00000000ffffffff  x22 000000789f976b99  x23 b400007ade860868
    x24 0000007952b7f280  x25 0000007c03e95000  x26 0000000000000037  x27 0000000000000004
    x28 0000007fc61713f0  x29 0000007fc61710f0
    lr  0000007bfef1e2e0  sp  0000007fc6171050  pc  0000007bfef1e30c  pst 0000000000000000
backtrace:
      #00 pc 000000000004e30c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 5ac8edab3f967405e91706e1da982ce9)
      #01 pc 0000000000409054  /data/app/~~Kg76t2gKO-ludVHWw2NH7w==/hiperme.app-kwRFTxA1TxfWXpUVI2FV8A==/base.apk!libjingle_peerconnection_so.so (offset 0x2a17000) (BuildId: 36751e766361ce9d)

Expected behavior
The SIP call goes through, and the user is able to answer in the app, starting communication with the caller.

Platform information

  • Flutter version:
[!] Flutter (Channel unknown, 3.3.4, on macOS 13.0.1 22A400 darwin-arm, locale
    es-419)
    ! Flutter version 3.3.4 on channel unknown at /Volumes/Mac Mini M2
      SSD/Users/user/Documents/development/flutter
    ! Upstream repository unknown
    • Framework revision eb6d86ee27 (3 months ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Volumes/Mac Mini M2
      SSD/Users/user/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2022.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.74.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.54.0

[✓] Connected device (3 available)
    • moto g 9 plus (mobile) • ZY22BFSDD7 • android-arm64  • Android 11 (API 30)
    • macOS (desktop)        • macos      • darwin-arm64   • macOS 13.0.1 22A400
      darwin-arm
    • Chrome (web)           • chrome     • web-javascript • Google Chrome
      108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available
  • Plugin version:
    flutter_webrtc: 0.9.15 through 0.9.18
    janus_client: 2.2.9

  • OS:
    Android 10 through 12

@amilcar-uptech so are you saying this thing works in 0.9.14? i will test it once to investigate what might be the issue surely this wasn't happening in web so probably it has something to do with native code changes.

We were using janus_client 2.2.3 beforehand, not sure what version of flutter_webrtc it had as a dependency, but it was happening with that version as well: it worked fine with an older version of Janus (for clarity, not the Flutter plugin), but this started happening when switching to a more recent one, which is why we tried upgrading to janus_client 2.2.9.

@amilcar-uptech i just tested with latest version(master branch not 2.2.9 i still need to publish new version that would be 2.2.10) of janus_client and on android pixel 5 (API 33) made a call from my chrome browser to pixel 5 and call got connected successfully it did not crash, just so you know i am using https://janus.conf.meetecho.com/janus/info which is using janus version:- 1.1.2
check on your side if it is something sip related issue.

Ok. Previously, we had janus version: 0.11.6, with which he had not run into any issues. Right now, using janus version: 1.1.1 is where we're running into the issue mentioned here. We don't have issues in web, it only happens when trying to receive calls on the app version.

Hi were you able to isolate the issue? If it is not related to janus_client then kindly close this issue and open on concerned project

@amilcar-uptech closing this for now due to no activity you can ask to reopen if you have more info