fix(mobile/call-integration): cleanup if leave takes too long
The conference disconnection process is asynchronous which means there's no guarantee that there will be CONFERENCE_LEFT event for the old conference, before the next conference is joined. Because of that we can end up with two simultaneous calls on the native side which is not always supported. End the call on CONFERENCE_WILL_LEAVE to fix this corner case.
This commit is contained in:
parent
16b440bbd0
commit
54c36198d0
|
@ -8,9 +8,10 @@ import { appNavigate } from '../../app';
|
|||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
|
||||
import {
|
||||
CONFERENCE_FAILED,
|
||||
CONFERENCE_JOINED,
|
||||
CONFERENCE_LEFT,
|
||||
CONFERENCE_WILL_JOIN,
|
||||
CONFERENCE_JOINED,
|
||||
CONFERENCE_WILL_LEAVE,
|
||||
SET_AUDIO_ONLY,
|
||||
getConferenceName,
|
||||
getCurrentConference
|
||||
|
@ -63,7 +64,14 @@ CallIntegration && MiddlewareRegistry.register(store => next => action => {
|
|||
case CONFERENCE_JOINED:
|
||||
return _conferenceJoined(store, next, action);
|
||||
|
||||
// If a conference is being left in a graceful manner then
|
||||
// the CONFERENCE_WILL_LEAVE fires as soon as the conference starts
|
||||
// disconnecting. We need to destroy the call on the native side as soon
|
||||
// as possible, because the disconnection process is asynchronous and
|
||||
// Android not always supports two simultaneous calls at the same time
|
||||
// (even though it should according to the spec).
|
||||
case CONFERENCE_LEFT:
|
||||
case CONFERENCE_WILL_LEAVE:
|
||||
return _conferenceLeft(store, next, action);
|
||||
|
||||
case CONFERENCE_WILL_JOIN:
|
||||
|
@ -141,6 +149,7 @@ function _conferenceFailed(store, next, action) {
|
|||
const { callUUID } = action.conference;
|
||||
|
||||
if (callUUID) {
|
||||
delete action.conference.callUUID;
|
||||
CallIntegration.reportCallFailed(callUUID);
|
||||
}
|
||||
}
|
||||
|
@ -192,6 +201,7 @@ function _conferenceLeft(store, next, action) {
|
|||
const { callUUID } = action.conference;
|
||||
|
||||
if (callUUID) {
|
||||
delete action.conference.callUUID;
|
||||
CallIntegration.endCall(callUUID);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue