hangup: Hang up all calls, warn if we can't find intended call
This commit is contained in:
parent
811f2f66c9
commit
2de45a341b
1 changed files with 23 additions and 14 deletions
|
@ -1059,24 +1059,33 @@ export class CallingClass {
|
||||||
hangup(conversationId: string): void {
|
hangup(conversationId: string): void {
|
||||||
log.info('CallingClass.hangup()');
|
log.info('CallingClass.hangup()');
|
||||||
|
|
||||||
const call = getOwn(this.callsByConversation, conversationId);
|
const specificCall = getOwn(this.callsByConversation, conversationId);
|
||||||
if (!call) {
|
if (!specificCall) {
|
||||||
log.warn('Trying to hang up a non-existent call');
|
log.error(
|
||||||
return;
|
`hangup: Trying to hang up a non-existent call for conversation ${conversationId}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.send('close-screen-share-controller');
|
ipcRenderer.send('close-screen-share-controller');
|
||||||
|
|
||||||
if (call instanceof Call) {
|
const entries = Object.entries(this.callsByConversation);
|
||||||
RingRTC.hangup(call.callId);
|
log.info(`hangup: ${entries.length} call(s) to hang up...`);
|
||||||
} else if (call instanceof GroupCall) {
|
|
||||||
// This ensures that we turn off our devices.
|
entries.forEach(([callConversationId, call]) => {
|
||||||
call.setOutgoingAudioMuted(true);
|
log.info(`hangup: Hanging up conversation ${callConversationId}`);
|
||||||
call.setOutgoingVideoMuted(true);
|
if (call instanceof Call) {
|
||||||
call.disconnect();
|
RingRTC.hangup(call.callId);
|
||||||
} else {
|
} else if (call instanceof GroupCall) {
|
||||||
throw missingCaseError(call);
|
// This ensures that we turn off our devices.
|
||||||
}
|
call.setOutgoingAudioMuted(true);
|
||||||
|
call.setOutgoingVideoMuted(true);
|
||||||
|
call.disconnect();
|
||||||
|
} else {
|
||||||
|
throw missingCaseError(call);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info('hangup: Done.');
|
||||||
}
|
}
|
||||||
|
|
||||||
setOutgoingAudio(conversationId: string, enabled: boolean): void {
|
setOutgoingAudio(conversationId: string, enabled: boolean): void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue