cordova-rtc / cordova-plugin-iosrtc

Cordova iOS plugin exposing the WebRTC W3C API
MIT License
690 stars 338 forks source link

Call canceled when callee pickup the phone. #765

Closed seoplague closed 1 year ago

seoplague commented 1 year ago

YOU MUST read first!

Please use Community Forum for general technical discussions and questions.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

Description

Hi!

When I make a call from IOS I face an error. In case when callee immediately pickup the phone everything is ok. But in case when callee wait a few seconds after ringing the call canceled by caller. In trace I see the following error:

SIP/2.0 200 OK
Via: SIP/2.0/WSS 192.0.2.236;rport=36520;received=127.0.0.1;branch=z9hG4bK6752300
Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=e69se52rc0;did=259.d59;nat=yes>
Record-Route: <sip:127.0.0.1:8088;transport=ws;r2=on;lr=on;ftag=e69se52rc0;did=259.d59;nat=yes>
From: <sip:112@testserver.com>;tag=e69se52rc0
To: <sip:109@testserver.com>;tag=as61d466c8
Call-ID: 1alkkgh33eati7vo9sfn
CSeq: 2 INVITE
Server: TestServer SBC
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:109@127.0.0.1:5080>
Remote-Party-ID: "Sasha" <sip:109@testserver.com>;party=called;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 647

v=0
o=root 1010757735 1010757735 IN IP4 11.11.11.11
s=Asterisk PBX 18.15.1
c=IN IP4 11.11.11.11
t=0 0
m=audio 13920 RTP/SAVPF 111 8 0 126
a=maxptime:20
a=mid:0
a=rtpmap:111 opus/48000/2
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:111 useinbandfec=1
a=fmtp:126 0-16
a=sendrecv
a=rtcp:13920
a=rtcp-mux
a=setup:passive
a=fingerprint:sha-1 72:0C:71:3D:1B:F6:1C:94:B0:1B:43:D9:C4:25:E6:69:D1:53:E3:C5
a=ptime:20
a=ice-ufrag:SQinxRl5
a=ice-pwd:dA7DFQcvLAzmWkQtacfts7tUf0
a=ice-options:trickle
a=candidate:D7dgfODEHvawBWBH 1 UDP 2130706431 11.11.11.11 13920 typ host
a=end-of-candidates

2023-02-24 15:50:44.546113+0300 MyApplication[45465:3119271] iosrtcPlugin#RTCPeerConnection_setRemoteDescription()
2023-02-24 15:50:44.546312+0300 MyApplication[45465:3119589] PluginRTCPeerConnection#setRemoteDescription()
2023-02-24 15:50:44.548739+0300 MyApplication[45465:3119542] PluginRTCPeerConnection#setRemoteDescription() | failure callback: Error Domain=org.webrtc.RTCPeerConnection Code=-1 "Failed to set remote answer sdp: Failed to apply the description for 0: Failed to set SSL role for the transport." UserInfo={NSLocalizedDescription=Failed to set remote answer sdp: Failed to apply the description for 0: Failed to set SSL role for the transport.}
2023-02-24 15:50:44.554663+0300 MyApplication[45465:3119271] ERROR: {"name":"InvalidSessionDescriptionError","message":"setRemoteDescription() failed: Failed to set remote answer sdp: Failed to apply the description for 0: Failed to set SSL role for the transport."}
2023-02-24 15:50:44.554874+0300 MyApplication[45465:3119271] ERROR: {"code":8,"name":"SESSION_DESCRIPTION_HANDLER_ERROR","type":27,"method":"setDescription","error":{"name":"InvalidSessionDescriptionError","message":"setRemoteDescription() failed: Failed to set remote answer sdp: Failed to apply the description for 0: Failed to set SSL role for the transport."}}

In case when everything is ok I see the following:

SIP/2.0 200 OK
Via: SIP/2.0/WSS 192.0.2.54;rport=38948;received=127.0.0.1;branch=z9hG4bK6461463
Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=uneehmsq8m;did=af4.4951;nat=yes>
Record-Route: <sip:127.0.0.1:8088;transport=ws;r2=on;lr=on;ftag=uneehmsq8m;did=af4.4951;nat=yes>
From: <sip:112@testserver.com>;tag=uneehmsq8m
To: <sip:109@testserver.com>;tag=as33c3b06f
Call-ID: ta28k63gu1ebimn36m1m
CSeq: 2 INVITE
Server: TestServer SBC
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:109@127.0.0.1:5080>
Remote-Party-ID: "Sasha" <sip:109@testserver.com>;party=called;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 647

v=0
o=root 1097032673 1097032673 IN IP4 11.11.11.11
s=Asterisk PBX 18.15.1
c=IN IP4 11.11.11.11
t=0 0
m=audio 13956 RTP/SAVPF 111 8 0 126
a=maxptime:20
a=mid:0
a=rtpmap:111 opus/48000/2
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:111 useinbandfec=1
a=fmtp:126 0-16
a=sendrecv
a=rtcp:13956
a=rtcp-mux
a=setup:passive
a=fingerprint:sha-1 72:0C:71:3D:1B:F6:1C:94:B0:1B:43:D9:C4:25:E6:69:D1:53:E3:C5
a=ptime:20
a=ice-ufrag:AZOK3n56
a=ice-pwd:kqWNzbb8yKVToQTopALXtZDHcR
a=ice-options:trickle
a=candidate:D7dgfODEHvawBWBH 1 UDP 2130706431 11.11.11.11 13956 typ host
a=end-of-candidates

2023-02-24 16:22:50.207000+0300 MyApplication[45692:3131558] iosrtcPlugin#RTCPeerConnection_setRemoteDescription()
2023-02-24 16:22:50.207299+0300 MyApplication[45692:3131794] PluginRTCPeerConnection#setRemoteDescription()
2023-02-24 16:22:50.209936+0300 MyApplication[45692:3131828] PluginRTCPeerConnection | onsignalingstatechange [signalingState:Optional("stable")]
2023-02-24 16:22:50.213456+0300 MyApplication[45692:3131828] PluginRTCPeerConnection | oniceconnectionstatechange [iceConnectionState:Optional("checking")]
2023-02-24 16:22:50.214141+0300 MyApplication[45692:3131828] PluginRTCPeerConnection | ontrack
2023-02-24 16:22:50.214678+0300 MyApplication[45692:3131828] PluginMediaStreamTrack#init()
2023-02-24 16:22:50.214886+0300 MyApplication[45692:3131828] PluginMediaStreamTrack#run() [kind:audio, id:f2362563-6b98-4352-8974-a4623c21d345]
2023-02-24 16:22:50.215460+0300 MyApplication[45692:3131558] Fri Feb 24 2023 16:22:50 GMT+0300 (+03) | sip.invitecontext.sessionDescriptionHandler | ICE Connection State changed to iceConnectionChecking
2023-02-24 16:22:50.215705+0300 MyApplication[45692:3131828] PluginRTCPeerConnection#setRemoteDescription() | success callback

Steps to reproduce

  1. Make a call from IOS
  2. Callee is waiting a few second before pickup
  3. Pickup the phone
hthetiot commented 1 year ago

The error message that is the cause of the failure:

Failed to apply the description for 0: Failed to set SSL role for the transport." UserInfo={NSLocalizedDescription=Failed to set remote answer sdp: Failed to apply the description for 0: Failed to set SSL role for the transport.}

Steps to reproduce

I do not reproduce using sip.js and freeswitch, you need to provide the full context, no only what you are doing on your side, what client and server side third party are you using can help to narrow the cause of the error above.

hthetiot commented 1 year ago

Since we don't know you environment, when you google the error this stack overflow refer to the same error and provide some clues, that does not mean it's not iosrtc side that cause the issue yet.

https://stackoverflow.com/questions/44932655/failed-to-set-remote-answer-sdp-failed-to-push-down-transport-description-fail

hthetiot commented 1 year ago

@seoplague see https://github.com/react-native-webrtc/react-native-webrtc/issues/923#issuecomment-1407441650