Реализация сигналинга и обмена ключами
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user