Merge pull request #1741 from famedly/td/emitOnIceFail
chore: emit handleCallEnded on ice fail
This commit is contained in:
commit
dc895134c8
|
|
@ -525,7 +525,7 @@ class CallSession {
|
|||
Logs().v('[VOIP] Call invite has expired. Hanging up.');
|
||||
hangupParty = CallParty.kRemote; // effectively
|
||||
fireCallEvent(CallEvent.kHangup);
|
||||
hangup(CallErrorCode.InviteTimeout);
|
||||
hangup(reason: CallErrorCode.InviteTimeout);
|
||||
}
|
||||
ringingTimer?.cancel();
|
||||
ringingTimer = null;
|
||||
|
|
@ -550,7 +550,7 @@ class CallSession {
|
|||
successor = newCall;
|
||||
onCallReplaced.add(newCall);
|
||||
// ignore: unawaited_futures
|
||||
hangup(CallErrorCode.Replaced, true);
|
||||
hangup(reason: CallErrorCode.Replaced);
|
||||
}
|
||||
|
||||
Future<void> sendAnswer(RTCSessionDescription answer) async {
|
||||
|
|
@ -1164,7 +1164,7 @@ class CallSession {
|
|||
if (state != CallState.kRinging && state != CallState.kFledgling) {
|
||||
Logs().e(
|
||||
'[VOIP] Call must be in \'ringing|fledgling\' state to reject! (current state was: ${state.toString()}) Calling hangup instead');
|
||||
await hangup(reason, shouldEmit);
|
||||
await hangup(reason: reason, shouldEmit: shouldEmit);
|
||||
return;
|
||||
}
|
||||
Logs().d('[VOIP] Rejecting call: $callId');
|
||||
|
|
@ -1174,7 +1174,7 @@ class CallSession {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> hangup([String? reason, bool shouldEmit = true]) async {
|
||||
Future<void> hangup({String? reason, bool shouldEmit = true}) async {
|
||||
await terminate(
|
||||
CallParty.kLocal, reason ?? CallErrorCode.UserHangup, shouldEmit);
|
||||
|
||||
|
|
@ -1303,8 +1303,9 @@ class CallSession {
|
|||
capabilities: callCapabilities,
|
||||
metadata: metadata);
|
||||
// just incase we ended the call but already sent the invite
|
||||
// raraley happens during glares
|
||||
if (state == CallState.kEnded) {
|
||||
await hangup(CallErrorCode.Replaced, false);
|
||||
await hangup(reason: CallErrorCode.Replaced);
|
||||
return;
|
||||
}
|
||||
inviteOrAnswerSent = true;
|
||||
|
|
@ -1318,7 +1319,7 @@ class CallSession {
|
|||
|
||||
inviteTimer = Timer(CallTimeouts.callInviteLifetime, () {
|
||||
if (state == CallState.kInviteSent) {
|
||||
hangup(CallErrorCode.InviteTimeout);
|
||||
hangup(reason: CallErrorCode.InviteTimeout);
|
||||
}
|
||||
inviteTimer?.cancel();
|
||||
inviteTimer = null;
|
||||
|
|
@ -1404,7 +1405,7 @@ class CallSession {
|
|||
await updateMuteStatus();
|
||||
missedCall = false;
|
||||
} else if (state == RTCIceConnectionState.RTCIceConnectionStateFailed) {
|
||||
await hangup(CallErrorCode.IceFailed, false);
|
||||
await hangup(reason: CallErrorCode.IceFailed);
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
|
|
@ -1614,7 +1615,7 @@ class CallSession {
|
|||
'Failed to send candidates on attempt $candidateSendTries Giving up on this call.');
|
||||
lastError =
|
||||
CallError(CallErrorCode.SignallingFailed, 'Signalling failed', e);
|
||||
await hangup(CallErrorCode.SignallingFailed, true);
|
||||
await hangup(reason: CallErrorCode.SignallingFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1655,7 +1656,7 @@ class CallSession {
|
|||
fireCallEvent(CallEvent.kError);
|
||||
lastError = CallError(
|
||||
CallErrorCode.LocalOfferFailed, 'Failed to get local offer!', err);
|
||||
await terminate(CallParty.kLocal, CallErrorCode.LocalOfferFailed, false);
|
||||
await terminate(CallParty.kLocal, CallErrorCode.LocalOfferFailed, true);
|
||||
}
|
||||
|
||||
Future<void> _getUserMediaFailed(dynamic err) async {
|
||||
|
|
@ -1666,7 +1667,7 @@ class CallSession {
|
|||
CallErrorCode.NoUserMedia,
|
||||
'Couldn\'t start capturing media! Is your microphone set up and does this app have permission?',
|
||||
err);
|
||||
await terminate(CallParty.kLocal, CallErrorCode.NoUserMedia, false);
|
||||
await terminate(CallParty.kLocal, CallErrorCode.NoUserMedia, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,9 @@ class GroupCall {
|
|||
}
|
||||
|
||||
if (call.state != CallState.kEnded) {
|
||||
await call.hangup(hangupReason, false);
|
||||
// no need to emit individual handleCallEnded on group calls
|
||||
// also prevents a loop of hangup and onCallHangupNotifierForGroupCalls
|
||||
await call.hangup(reason: hangupReason, shouldEmit: false);
|
||||
}
|
||||
|
||||
final usermediaStream = getUserMediaStreamByUserId(opponentMemberId);
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ class VoIP {
|
|||
(confId == null || confId != currentGroupCID)) {
|
||||
Logs().v(
|
||||
'[VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.');
|
||||
// no need to emit here because handleNewCall was never triggered yet
|
||||
await newCall.reject(reason: CallErrorCode.UserBusy, shouldEmit: false);
|
||||
await delegate.handleMissedCall(newCall);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue