Reconnect call. Ice Restart.

3,760 views
Skip to first unread message

Vasiliy Komarov

unread,
Jun 22, 2016, 11:56:48 AM6/22/16
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
Hello.
I have a question about the connection.
Example:
Alice calls Bob.
Bob receives a call and the conversation begins.
Bob loses Internet connection.
Alice gets Event "disconnected".
How do I restore the conversation, if Bob is reconnected to the network after 2 minutes (for example).

I try as follows.
When Alice gets Event "disconnected" I call 'createOffer' with iceRestart = true;
But Bob is not yet connected to the network. Appropriately, he will not get offer.
Then Alice gets event 'failed'. After that I again try to send offer, but after that 'oniceconnectionstate' does not catch events.

Perhaps I'm doing something wrong. You could describe the full script to reconnect?
Message has been deleted

Vasiliy Komarov

unread,
Jun 23, 2016, 8:42:16 AM6/23/16
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
If I understand correctly, I have to make a new offer with 'iceRestart' when Bob reconnect.
If you do this in Chrome, then all is well. However, if you try in firefox, the error appears in the console ( "InvalidStateError", "RTCPeerConnection is gone (did you enter Offline mode?)).

Arun Ganeshan

unread,
Nov 17, 2016, 8:48:32 AM11/17/16
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
Hi Vasiliy you are correct . I am also trying to reconnect a call after network change . Any idea how you did it ?

Regards,
Arun

Vasiliy Komarov

unread,
Nov 17, 2016, 8:56:24 AM11/17/16
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
Hi.

When user2 loses connection (network change) I'm waiting for the moment when he becomes online. (Online event). After that, I do reconnect.
Reconnect it just new offer with specific paramater.

parameter - 
{'iceRestart': true}



example: 
this.__peercall.createOffer(function (sdp) {
                _this
.__peercall.setLocalDescription(sdp);

                sendMessage
('#webrtc-video-offer',
                    JSON
.stringify({offerSDP: sdp,}));
           
}, function onfailure(error) {
                console
.error(error);
           
}, {'iceRestart': true});



But now it work only for chrome.

When you catch event 'disconnected' you need set variable. Example 'isReconnect'
Because user2 can give status 'online' after one minutes. But event 'failed' you will catch after 10-20 seconds.
Then you dont need close 'peer connection' if it 'reconnect'.
Sorry for my english.

peer.oniceconnectionstatechange = function (ev) {
               
var currentState = ev.currentTarget.iceConnectionState;

               
if (currentState === 'disconnected') {
                    _this
.__isReconnect = true;

                    _this
.__sendMessage('#webrtc-video-disconnected');
               
} else if (currentState === 'connected') {
                    _this
.__isReconnect = false;

                    _this
.__sendMessage('#webrtc-video-connected');
               
} else if (currentState === 'failed' || currentState === 'closed') {
                   
if (_this.__isReconnect && !$.isFirefox)
                   
else
                        _this
.__sendMessage('#webrtc-video-closed'); // close call

               
}



четверг, 17 ноября 2016 г., 16:48:32 UTC+3 пользователь Arun Ganeshan написал:

Sergey Grigoryev

unread,
Dec 11, 2016, 2:46:05 AM12/11/16
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
Have you tried using IceGatheringPolicy set to Continuous?
At least for network changes it works fine for me.

When disconnection occurs, I just start the timer. If the user connects again, he receive new IceCandidates and can send them to other side.
If the timer is fired before he gets connected back, I suppose that the call absolutely broken and sending drop.
The main problem is that our webapp has not got this flag, so at the moment this task is postponed.

Best regards,
Sergey

среда, 22 июня 2016 г., 18:56:48 UTC+3 пользователь Vasiliy Komarov написал:

Manit C

unread,
Sep 4, 2017, 2:52:26 AM9/4/17
to discuss-webrtc, nexs...@mail.ru, vkom...@abisoft.spb.ru
I'm working on the same issue. 

Where is the IceGatheringPolicy ? I don't see it in the specs?

What happens when both peers issues an ice restart at the same time? Will both peers sending offer/answer at the same time cause any issues?

PHAM LONG

unread,
Apr 26, 2021, 1:11:06 AM4/26/21
to discuss-webrtc
Hi  Vasiliy Komarov,
Can you say your flow reconnect? I don't quite understand. Or Can I have a document about it?
Thanks you

Reply all
Reply to author
Forward
0 new messages