|
|
|
@ -2,6 +2,7 @@ import _ from 'lodash';
|
|
|
|
|
import { ToastUtils } from '.';
|
|
|
|
|
import { getCallMediaPermissionsSettings } from '../../components/session/settings/SessionSettings';
|
|
|
|
|
import { getConversationById } from '../../data/data';
|
|
|
|
|
import { ConversationModel } from '../../models/conversation';
|
|
|
|
|
import { MessageModelType } from '../../models/messageType';
|
|
|
|
|
import { SignalService } from '../../protobuf';
|
|
|
|
|
import {
|
|
|
|
@ -144,6 +145,15 @@ function sendVideoStatusViaDataChannel() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sendHangupViaDataChannel() {
|
|
|
|
|
const stringToSend = JSON.stringify({
|
|
|
|
|
hangup: true,
|
|
|
|
|
});
|
|
|
|
|
if (dataChannel && dataChannel.readyState === 'open') {
|
|
|
|
|
dataChannel?.send(stringToSend);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function selectCameraByDeviceId(cameraDeviceId: string) {
|
|
|
|
|
if (cameraDeviceId === INPUT_DISABLED_DEVICE_ID) {
|
|
|
|
|
selectedCameraId = INPUT_DISABLED_DEVICE_ID;
|
|
|
|
@ -456,6 +466,23 @@ function onDataChannelReceivedMessage(ev: MessageEvent<string>) {
|
|
|
|
|
try {
|
|
|
|
|
const parsed = JSON.parse(ev.data);
|
|
|
|
|
|
|
|
|
|
if (parsed.hangup !== undefined) {
|
|
|
|
|
const foundEntry = getConversationController()
|
|
|
|
|
.getConversations()
|
|
|
|
|
.find(
|
|
|
|
|
(convo: ConversationModel) =>
|
|
|
|
|
convo.callState === 'connecting' ||
|
|
|
|
|
convo.callState === 'offering' ||
|
|
|
|
|
convo.callState === 'ongoing'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!foundEntry || !foundEntry.id) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
handleCallTypeEndCall(foundEntry.id);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (parsed.video !== undefined) {
|
|
|
|
|
remoteVideoStreamIsMuted = !Boolean(parsed.video);
|
|
|
|
|
}
|
|
|
|
@ -596,6 +623,8 @@ export async function USER_rejectIncomingCallRequest(fromSender: string) {
|
|
|
|
|
window.inboxStore?.dispatch(endCall({ pubkey: fromSender }));
|
|
|
|
|
window.log.info('sending END_CALL MESSAGE');
|
|
|
|
|
|
|
|
|
|
sendHangupViaDataChannel();
|
|
|
|
|
|
|
|
|
|
await getMessageQueue().sendToPubKeyNonDurably(PubKey.cast(fromSender), endCallMessage);
|
|
|
|
|
|
|
|
|
|
const convos = getConversationController().getConversations();
|
|
|
|
|