From e06d58facf36cc474433a9fa9f5f210f32dc6bd9 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Mon, 2 Mar 2026 18:53:15 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BD=D0=B3=D0=B0=20=D0=B8=20=D0=BE=D0=B1=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/Call/Call.tsx | 6 ++++- app/providers/CallProvider/CallProvider.tsx | 23 +------------------ .../protocol/packets/packet.signal.ts | 8 +++---- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/app/components/Call/Call.tsx b/app/components/Call/Call.tsx index 7538217..0b8b8b1 100644 --- a/app/components/Call/Call.tsx +++ b/app/components/Call/Call.tsx @@ -74,8 +74,12 @@ export function Call(props: CallProps) { {callState == CallState.CONNECTING && (Connecting...)} {callState == CallState.INCOMING && (Incoming call...)} {callState == CallState.KEY_EXCHANGE && (Exchanging encryption keys...)} + {callState == CallState.WEB_RTC_EXCHANGE && (Exchanging encryption keys...)} - {callState == CallState.ACTIVE || callState == CallState.CONNECTING || callState == CallState.KEY_EXCHANGE && ( + {(callState == CallState.ACTIVE + || callState == CallState.WEB_RTC_EXCHANGE + || callState == CallState.CONNECTING + || callState == CallState.KEY_EXCHANGE) && ( <> setSound(!sound)} style={{ borderRadius: 25, diff --git a/app/providers/CallProvider/CallProvider.tsx b/app/providers/CallProvider/CallProvider.tsx index a8e4d4a..ff726de 100644 --- a/app/providers/CallProvider/CallProvider.tsx +++ b/app/providers/CallProvider/CallProvider.tsx @@ -26,6 +26,7 @@ export interface CallContextValue { export enum CallState { CONNECTING, KEY_EXCHANGE, + WEB_RTC_EXCHANGE, ACTIVE, ENDED, INCOMING @@ -128,28 +129,6 @@ export function CallProvider(props : CallProviderProps) { info("Generated shared secret for call session: " + Buffer.from(computedSharedSecret).toString('hex')); setSharedSecret(Buffer.from(computedSharedSecret).toString('hex')); } - if(signalType == SignalType.OFFER){ - const offerJson = packet.getOffer(); - if(!offerJson || !peerConnectionRef.current){ - info("Received offer but peer connection is not ready"); - return; - } - - handleOffer(offerJson); - } - - if(signalType == SignalType.ANSWER){ - const answerJson = packet.getAnswer(); - if(!answerJson || !peerConnectionRef.current){ - info("Received answer but peer connection is not ready"); - return; - } - - handleAnswer(answerJson); - } - if(signalType == SignalType.ACTIVE_CALL) { - setCallState(CallState.ACTIVE); - } }, [activeCall, sessionKeys]); const generateSessionKeys = () => { diff --git a/app/providers/ProtocolProvider/protocol/packets/packet.signal.ts b/app/providers/ProtocolProvider/protocol/packets/packet.signal.ts index 9d27d21..b57dd9d 100644 --- a/app/providers/ProtocolProvider/protocol/packets/packet.signal.ts +++ b/app/providers/ProtocolProvider/protocol/packets/packet.signal.ts @@ -5,12 +5,12 @@ export enum SignalType { CALL = 0, KEY_EXCHANGE = 1, ACTIVE_CALL = 2, - END_CALL = 3, - OFFER = 4, - ANSWER = 5, - ICE_CONFIG = 6 + END_CALL = 3 } +/** + * Пакет сигналинга, для сигналов WebRTC используется отдельный пакет 27 PacketWebRTCExchange + */ export class PacketSignal extends Packet { private src: string = "";