Защита от принятия звонка принятого на другом устройстве
This commit is contained in:
@@ -293,8 +293,19 @@ export function CallProvider(props : CallProviderProps) {
|
|||||||
setCallState(CallState.WEB_RTC_EXCHANGE);
|
setCallState(CallState.WEB_RTC_EXCHANGE);
|
||||||
}
|
}
|
||||||
if(signalType == SignalType.CREATE_ROOM) {
|
if(signalType == SignalType.CREATE_ROOM) {
|
||||||
|
if(!sessionKeys){
|
||||||
/**
|
/**
|
||||||
* Создана комната для обмена WebRTC потоками
|
* Сервер может отправить CREATE_ROOM сигнал, даже если мы приняли звонок на другом устройстве, по этому проверяем,
|
||||||
|
* на этом ли устройстве звонок принят посредством проверки наличия сгенерированных ключей шифрования
|
||||||
|
*/
|
||||||
|
stopLoopSound();
|
||||||
|
stopSound();
|
||||||
|
end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Создана комната для обмена WebRTC потоками, но такое событие сервер может отправить даже если звонок
|
||||||
|
* был принят с другого устройства, по этому проверяем, наш ли звонок
|
||||||
*/
|
*/
|
||||||
roomIdRef.current = packet.getRoomId();
|
roomIdRef.current = packet.getRoomId();
|
||||||
info("WebRTC room created with id: " + packet.getRoomId());
|
info("WebRTC room created with id: " + packet.getRoomId());
|
||||||
@@ -443,8 +454,7 @@ export function CallProvider(props : CallProviderProps) {
|
|||||||
/**
|
/**
|
||||||
* Только если звонок был активен воспроизводим звуки
|
* Только если звонок был активен воспроизводим звуки
|
||||||
*/
|
*/
|
||||||
stopLoopSound();
|
playSound("end_call.mp3");
|
||||||
stopSound();
|
|
||||||
}
|
}
|
||||||
if (remoteAudioRef.current) {
|
if (remoteAudioRef.current) {
|
||||||
remoteAudioRef.current.pause();
|
remoteAudioRef.current.pause();
|
||||||
@@ -454,7 +464,6 @@ export function CallProvider(props : CallProviderProps) {
|
|||||||
setDuration(0);
|
setDuration(0);
|
||||||
durationIntervalRef.current && clearInterval(durationIntervalRef.current);
|
durationIntervalRef.current && clearInterval(durationIntervalRef.current);
|
||||||
setWindowPriority(false);
|
setWindowPriority(false);
|
||||||
playSound("end_call.mp3");
|
|
||||||
peerConnectionRef.current?.close();
|
peerConnectionRef.current?.close();
|
||||||
peerConnectionRef.current = null;
|
peerConnectionRef.current = null;
|
||||||
roomIdRef.current = "";
|
roomIdRef.current = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user