flutter-webrtc / dart-sip-ua

A dart-lang version of the SIP UA stack.
MIT License
337 stars 268 forks source link

Video calls work on iOS but not on Android #250

Open aososam opened 2 years ago

aososam commented 2 years ago

Describe the bug When making a video call to iOS it works without any problem, but when using the same code on Android I receive the error:

[2022-01-11 14:16:03.301] Level.error rtc_session.dart:658 ::: emit "peerconnection:setremotedescriptionfailed" [error:Unable to RTCPeerConnection::setRemoteDescription: peerConnectionSetRemoteDescription(): WEBRTC_SET_REMOTE_DESCRIPTION_ERROR: Failed to set remote offer sdp: Failed to set remote video description send parameters for m-section with mid='video-1'.]

This is the offer I receive on Android:

v=0 o=- 1342538583 1342538583 IN IP4 171.25.220.252 s=Asterisk c=IN IP4 171.25.220.252 t=0 0 a=group:BUNDLE audio-0 video-1 m=audio 19570 UDP/TLS/RTP/SAVPF 0 8 9 3 111 101 a=connection:new a=setup:actpass a=fingerprint:SHA-256 93:23:D3:10:B4:BF:30:2D:EC:59:76:E8:7E:13:4D:87:C7:C7:BF:BA:7F:84:C3:AB:3B:E2:4A:2D:97:FB:5A:08 a=ice-ufrag:7986dd5d697c429d2b7a5cd93bd94738 a=ice-pwd:453eebac31c44aab4e103b82617779e7 a=candidate:Hab19dcfc 1 UDP 2130706431 171.25.220.252 19570 typ host a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:3 GSM/8000 a=rtpmap:111 G726-32/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=maxptime:150 a=sendrecv a=rtcp-mux a=ssrc:538188637 cname:d8678854-5a08-4d35-919a-469aab74b2b5 a=mid:audio-0 m=video 17002 UDP/TLS/RTP/SAVPF 99 a=connection:new a=setup:actpass a=fingerprint:SHA-256 93:23:D3:10:B4:BF:30:2D:EC:59:76:E8:7E:13:4D:87:C7:C7:BF:BA:7F:84:C3:AB:3B:E2:4A:2D:97:FB:5A:08 a=ice-ufrag:4cb4f43e2449f5a14f15699d0cd7f0a5

And this is the offer I receive on iOS:

v=0 o=- 978514351 978514351 IN IP4 171.25.220.252 s=Asterisk c=IN IP4 171.25.220.252 t=0 0 a=group:BUNDLE audio-0 video-1 m=audio 15112 UDP/TLS/RTP/SAVPF 0 8 9 3 111 101 a=connection:new a=setup:actpass a=fingerprint:SHA-256 93:23:D3:10:B4:BF:30:2D:EC:59:76:E8:7E:13:4D:87:C7:C7:BF:BA:7F:84:C3:AB:3B:E2:4A:2D:97:FB:5A:08 a=ice-ufrag:2c65394c35dbe4c541507a692f3ec547 a=ice-pwd:2c80332c414b1b7858022c4562497976 a=candidate:Hab19dcfc 1 UDP 2130706431 171.25.220.252 15112 typ host a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:3 GSM/8000 a=rtpmap:111 G726-32/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=maxptime:150 a=sendrecv a=rtcp-mux a=ssrc:1404773385 cname:660f3efe-4c9f-4253-a287-dd96d2808a80 a=mid:audio-0 m=video 15520 UDP/TLS/RTP/SAVPF 99 a=connection:new a=setup:actpass a=fingerprint:SHA-256 93:23:D3:10:B4:BF:30:2D:EC:59:76:E8:7E:13:4D:87:C7:C7:BF:BA:7F:84:C3:AB:3B:E2:4A:2D:97:FB:5A:08 a=ice-ufrag:63fb81d15ced8dde5c5751155fef7d0d a=ice-pwd:054b3e0f1e32720b4de9af5a3646b101 a=candidate:Hab19dcfc 1 UDP 2130706431 171.25.220.252 15520 typ host a=rtpmap:99 H264/90000 a=fmtp:99 max-mbps=20250;max-br=2048;packetization-mode=1;profile-level-id=42E016 a=sendrecv a=rtcp-mux a=ssrc:970575429 cname:d3d29565-55f7-42a9-84f0-6de49bfd74bf a=mid:video-1

I noticed the tag mid:video-1 is missing in the Android offer but I have no idea why or how to add it

To Reproduce Steps to reproduce the behavior:

  1. Register iOS device on Asterisk server
  2. Call from another client, and answer the call
  3. Call works
  4. Register Android device on Asterisk server
  5. Call from another client, and answer the call
  6. an Exception is thrown in rtc_session.dart:658:

throw Exceptions.TypeError( 'peerconnection.setRemoteDescription() failed');

after function await _connection.setRemoteDescription(offer); failed

Expected behavior The app should not have an error on Android if the same code works fine for iOS

System Infomation() Flutter SDK Version: 2.0.3 Target OS and Version: Android 10 Host OS and Version: macOS Monterey 12.0.1 package version: sip_ua: ^0.3.5

is anyone else experiencing this? any help would be appreciated and thanks a lot in advance.

aososam commented 2 years ago

Updating to sip_ua: 0.4.0 did not help I am running a clean example project.

jonnyfisher commented 1 year ago

Hello Using this application on Android, I discovered a problem with video when using the H264 codec only. When another SIP agent (for example Linphone or Microsip) videocalls an application with a codec parameter packetization-mode=1 - everything works fine, both audio and video.

But if this packetization-mode is missing or packetization-mode=0 - the call immediately disconnects with massage: SIP/2.0 488 Not Acceptable Here

I used Linphone since i can specify codec parameters there. Maybe you can tell me how to create this application with parameter packetization-mode=0 or without this parameter at all ?

e8-WeiBin commented 1 year ago

Same issue. @aososam Have you found an effective solution?

jonnyfisher commented 1 year ago

Hi Unfortunately I'm stuck in the process of figuring it out The last thing I discovered - file rtc_session.dart (line 635)

logger.d('emit "sdp"'); emit(EventSdp(originator: 'remote', type: 'offer', sdp: request.body)); RTCSessionDescription offer = RTCSessionDescription(request.body, 'offer'); try { await _connection!.setRemoteDescription(offer); } catch (error) {

if codec H264 parameter packetization_mode = 1 - everything works fine if codec H264 parameter packetization_mode = 0 - error

The developers are silent for now.

пн, 30 жовт. 2023 р. о 16:18 e8-Weibin @.***> пише:

Same issue. @aososam https://github.com/aososam Have you found an effective solution?

— Reply to this email directly, view it on GitHub https://github.com/flutter-webrtc/dart-sip-ua/issues/250#issuecomment-1785318689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBZZ6COKXH5SVRE52QHFI3YB6ZLRAVCNFSM5LWOSGOKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZYGUZTCOBWHA4Q . You are receiving this because you commented.Message ID: @.***>