flutter-webrtc / dart-sip-ua

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

Incoming call crashes on Android #201

Open joaquin03 opened 3 years ago

joaquin03 commented 3 years ago

Hi, my app is working well, making outgoing videocalls, and if in a chrome app, receiving calls with no problem.

But when receiving calls on Android, as soon as I answer I get :

Level.error rtc_session.dart:637 ::: 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 incoming SDP I get from print:

v=0 I/flutter (26775): o=- 580363451 580363451 IN IP4 104.131.13.81 I/flutter (26775): s=Asterisk I/flutter (26775): c=IN IP4 104.131.13.81 I/flutter (26775): t=0 0 I/flutter (26775): a=group:BUNDLE audio-0 video-1 I/flutter (26775): m=audio 18182 UDP/TLS/RTP/SAVPF 9 0 8 3 111 101 I/flutter (26775): a=connection:new I/flutter (26775): a=setup:actpass I/flutter (26775): a=fingerprint:SHA-256 F3:72:D2:CA:C6:B9:D5:D7:F4:98:AE:4D:36:90:82:36:85:8E:D5:A1:E3:FA:E9:BF:C2:93:4C:87:96:88:11:D3 I/flutter (26775): a=ice-ufrag:447a9d914c215e2c4120c86b69981ea8 I/flutter (26775): a=ice-pwd:4d70085571269950757b16593f471b44 I/flutter (26775): a=candidate:H68830d51 1 UDP 2130706431 104.131.13.81 18182 typ host I/flutter (26775): a=candidate:Ha110005 1 UDP 2130706431 10.17.0.5 18182 typ host I/flutter (26775): a=candidate:Hae5d800d 1 UDP 2130706431 fe80::1c14:6eff:fe6d:60a7 18182 typ host I/flutter (26775): a=rtpmap:9 G722/8000 I/flutter (26775): a=rtpmap:0 PCMU/8000 I/flutter (26775): a=rtpmap:8 PCMA/8000 I/flutter (26775): a=rtpmap:3 GSM/8000 I/flutter (26775): a=rtpmap:111 G726-32/8000 I/flutter (26775): a=rtpmap:101 telephone-event/8000 I/flutter (26775): a=fmtp:101 0-16 I/flutter (26775): a=ptime:20 I/flutter (26775): a=maxptime:150 I/flutter (26775): a=sendrecv I/flutter (26775): a=rtcp-mux I/flutter (26775): a=ssrc:416884774 cname:ad8823c8-1969-4a13-af1e-8d4b89bfcad9 I/flutter (26775): a=mid:audio-0 I/flutter (26775): m=vid I/flutter (26775): emit offer sdp print:::v=0 I/flutter (26775): o=- 580363451 580363451 IN IP4 104.131.13.81 I/flutter (26775): s=Asterisk I/flutter (26775): c=IN IP4 104.131.13.81 I/flutter (26775): t=0 0 I/flutter (26775): a=group:BUNDLE audio-0 video-1 I/flutter (26775): m=audio 18182 UDP/TLS/RTP/SAVPF 9 0 8 3 111 101 I/flutter (26775): a=connection:new I/flutter (26775): a=setup:actpass I/flutter (26775): a=fingerprint:SHA-256 F3:72:D2:CA:C6:B9:D5:D7:F4:98:AE:4D:36:90:82:36:85:8E:D5:A1:E3:FA:E9:BF:C2:93:4C:87:96:88:11:D3 I/flutter (26775): a=ice-ufrag:447a9d914c215e2c4120c86b69981ea8 I/flutter (26775): a=ice-pwd:4d70085571269950757b16593f471b44 I/flutter (26775): a=candidate:H68830d51 1 UDP 2130706431 104.131.13.81 18182 typ host I/flutter (26775): a=candidate:Ha110005 1 UDP 2130706431 10.17.0.5 18182 typ host I/flutter (26775): a=candidate:Hae5d800d 1 UDP 2130706431 fe80::1c14:6eff:fe6d:60a7 18182 typ host I/flutter (26775): a=rtpmap:9 G722/8000 I/flutter (26775): a=rtpmap:0 PCMU/8000 I/flutter (26775): a=rtpmap:8 PCMA/8000 I/flutter (26775): a=rtpmap:3 GSM/8000 I/flutter (26775): a=rtpmap:111 G726-32/8000 I/flutter (26775): a=rtpmap:101 telephone-event/8000 I/flutter (26775): a=fmtp:101 0-16 I/flutter (26775): a=ptime:20 I/flutter (26775): a=maxptime:150 I/flutter (26775): a=sendrecv I/flutter (26775): a=rtcp-mux I/flutter (26775): a=ssrc:416884774 cname:ad8823c8-1969-4a13-af1e-8d4b89bfcad9 I/flutter (26775): a=mid:audio-0 I/flutter (26775): m=video 15124 UDP/TLS/RTP/SAVPF 99 I/flutter (26775): a=connection:new I/flutter (26775): a=setup:actpass I/flutter (26775): a=

It seems to be uncomplete, because if I print the same, I get this:

v=0 o=- 1156026974 1156026974 IN IP4 104.131.13.81 s=Asterisk c=IN IP4 104.131.13.81 t=0 0 a=group:BUNDLE audio-0 video-1 m=audio 19778 UDP/TLS/RTP/SAVPF 9 0 8 3 111 101 a=connection:new a=setup:actpass a=fingerprint:SHA-256 F3:72:D2:CA:C6:B9:D5:D7:F4:98:AE:4D:36:90:82:36:85:8E:D5:A1:E3:FA:E9:BF:C2:93:4C:87:96:88:11:D3 a=ice-ufrag:195cc5ff1bb611a467db61d23e5237fc a=ice-pwd:20ae44d941fc40ba6f1c652524a75b8e a=candidate:H68830d51 1 UDP 2130706431 104.131.13.81 19778 typ host a=candidate:Ha110005 1 UDP 2130706431 10.17.0.5 19778 typ host a=candidate:Hae5d800d 1 UDP 2130706431 fe80::1c14:6eff:fe6d:60a7 19778 typ host a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/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:1638864815 cname:0908c0de-bb82-43f6-a290-8576801a5259 a=mid:audio-0 m=video 18302 UDP/TLS/RTP/SAVPF 99 a=connection:new a=setup:actpass a=fingerprint:SHA-256 F3:72:D2:CA:C6:B9:D5:D7:F4:98:AE:4D:36:90:82:36:85:8E:D5:A1:E3:FA:E9:BF:C2:93:4C:87:96:88:11:D3 a=ice-ufrag:112b1a7c7d850a2a61441a93128ecb0f a=ice-pwd:52e742df6890498e798d932d0d36878b a=candidate:H68830d51 1 UDP 2130706431 104.131.13.81 18302 typ host a=candidate:Ha110005 1 UDP 2130706431 10.17.0.5 18302 typ host a=candidate:Hae5d800d 1 UDP 2130706431 fe80::1c14:6eff:fe6d:60a7 18302 typ host a=rtpmap:99 H264/90000 a=fmtp:99 packetization-mode=1;profile-level-id=42801E a=sendrecv a=rtcp-mux a=ssrc:655909301 cname:e6c0dc5b-04d6-42a1-aaa9-7d6b5e070eda a=mid:video-1

cloudwebrtc commented 3 years ago

In my past experience, it is very likely that the H264 profile-level-id sent by the offer does not match the webrtc You can check the H264 profile-level-id on both sides, you should find the answer in it

joaquin03 commented 3 years ago

I saw that possible problem in forums, but I think it is alright:

  if (payload == DefaultPayloadTypeH264) {
        fmtp.add(<String, dynamic>{
          'payload': payload, 
          'config':
              'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f'
        });
      }
aososam commented 2 years ago

@joaquin03 Is this code fixing the issue for you? could you please share where should it be used? Thanks.