Add event handlers for iceConnection errors

This commit is contained in:
Oswaldo Acauan 2018-04-03 10:50:18 -03:00
parent 04b98036e7
commit 3d74ad4847

View File

@ -297,10 +297,21 @@ export default class SIPBridge extends BaseAudioBridge {
}); });
}; };
const handleConnectionTerminated = peer => this.callback({
status: this.baseCallStates.failed,
error: this.baseErrorCodes.CONNECTION_ERROR,
bridgeError: peer,
});
currentSession.on('terminated', handleSessionTerminated); currentSession.on('terminated', handleSessionTerminated);
currentSession.mediaHandler.on('iceConnectionCompleted', handleConnectionCompleted); currentSession.mediaHandler.on('iceConnectionCompleted', handleConnectionCompleted);
currentSession.mediaHandler.on('iceConnectionConnected', handleConnectionCompleted); currentSession.mediaHandler.on('iceConnectionConnected', handleConnectionCompleted);
currentSession.mediaHandler.on('iceConnectionFailed', handleConnectionTerminated);
currentSession.mediaHandler.on('iceConnectionDisconnected', handleConnectionTerminated);
currentSession.mediaHandler.on('iceConnectionClosed', handleConnectionTerminated);
this.currentSession = currentSession; this.currentSession = currentSession;
}); });
} }