diff --git a/.gitignore b/.gitignore index fca7fc54..fe753915 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ Thumbs.db dist .devcontainer/devcontainer.json .devcontainer/Dockerfile +.claude/ +CLAUDE.md diff --git a/packages/common/src/webrtc/BaseCall.ts b/packages/common/src/webrtc/BaseCall.ts index 090a6f78..7f1f7b30 100644 --- a/packages/common/src/webrtc/BaseCall.ts +++ b/packages/common/src/webrtc/BaseCall.ts @@ -832,8 +832,8 @@ export default abstract class BaseCall implements IWebRTCCall { }) .catch((error) => { logger.error('Call setRemoteDescription Error: ', error) - this.hangup() - }) + this._disconnectAndReconnect() + }) } private _requestAnotherLocalDescription() { @@ -902,7 +902,7 @@ export default abstract class BaseCall implements IWebRTCCall { }) .catch((error) => { logger.error(`${this.id} - Sending ${type} error:`, error) - this.hangup() + this._disconnectAndReconnect() }) } @@ -985,6 +985,13 @@ export default abstract class BaseCall implements IWebRTCCall { } } + private _disconnectAndReconnect() { + logger.debug(`${this.id} - Triggering WebSocket reconnection due to error`) + // Trigger a socket error event which will cause the session to reconnect + // The BaseSession's _onSocketCloseOrError handler will automatically reconnect + trigger(SwEvent.SocketError, { type: 'error', message: 'Forced reconnection due to call error' }, this.session.uuid) + } + private _execute(msg: BaseMessage) { if (this.nodeId) { msg.targetNodeId = this.nodeId