Таймаут вызова

This commit is contained in:
RoyceDa
2026-04-04 17:46:38 +02:00
parent c8c85991c7
commit 5979c31120
2 changed files with 13 additions and 10 deletions

View File

@@ -216,16 +216,14 @@ export function CallProvider(props : CallProviderProps) {
openCallsModal("The connection with the user was lost. The call has ended.")
end();
}
if(activeCall){
if(signalType == SignalType.RINGING_TIMEOUT) {
/**
* У нас уже есть активный звонок, игнорируем все сигналы, кроме сигналов от текущего звонка
* Другой стороне был отправлен сигнал звонка, но она не ответила на него в течении определенного времени
*/
if(packet.getSrc() != activeCall && packet.getSrc() != publicKey){
console.info("Received signal from " + packet.getSrc() + " but active call is with " + activeCall + ", ignoring");
info("Received signal for another call, ignoring");
openCallsModal("The user did not answer the call in time. Please try again later.");
end();
return;
}
}
if(signalType == SignalType.END_CALL){
/**
* Сбросили звонок

View File

@@ -12,7 +12,8 @@ export enum SignalType {
ACTIVE = 4,
END_CALL_BECAUSE_PEER_DISCONNECTED = 5,
END_CALL_BECAUSE_BUSY = 6,
ACCEPT = 7
ACCEPT = 7,
RINGING_TIMEOUT = 8
}
/**
@@ -42,7 +43,9 @@ export class PacketSignalPeer extends Packet {
public _receive(stream: Stream): void {
this.signalType = stream.readInt8();
if(this.signalType == SignalType.END_CALL_BECAUSE_BUSY || this.signalType == SignalType.END_CALL_BECAUSE_PEER_DISCONNECTED){
if(this.signalType == SignalType.END_CALL_BECAUSE_BUSY
|| this.signalType == SignalType.RINGING_TIMEOUT
|| this.signalType == SignalType.END_CALL_BECAUSE_PEER_DISCONNECTED){
return;
}
this.src = stream.readString();
@@ -60,7 +63,9 @@ export class PacketSignalPeer extends Packet {
const stream = new Stream();
stream.writeInt16(this.getPacketId());
stream.writeInt8(this.signalType);
if(this.signalType == SignalType.END_CALL_BECAUSE_BUSY || this.signalType == SignalType.END_CALL_BECAUSE_PEER_DISCONNECTED){
if(this.signalType == SignalType.END_CALL_BECAUSE_BUSY
|| this.signalType == SignalType.RINGING_TIMEOUT
|| this.signalType == SignalType.END_CALL_BECAUSE_PEER_DISCONNECTED){
return stream;
}
stream.writeString(this.src);