added error code handling for fail cases
This commit is contained in:
parent
545a9ea978
commit
d9a115aab6
@ -69,9 +69,12 @@ class AudioManager {
|
||||
this.callStates = CallStates;
|
||||
this.currentState = this.callStates.init;
|
||||
|
||||
callbackToAudioBridge = function (audio) {
|
||||
switch (audio.status) {
|
||||
|
||||
callbackToAudioBridge = function (message) {
|
||||
switch (message.status) {
|
||||
case 'failed':
|
||||
console.log(message.errorcode);
|
||||
handleFail(message.errorcode);
|
||||
let audioFailed = new CustomEvent('bbb.webrtc.failed', {
|
||||
status: 'Failed', });
|
||||
window.dispatchEvent(audioFailed);
|
||||
@ -100,7 +103,7 @@ class AudioManager {
|
||||
this.currentState = this.callStates.init;
|
||||
}
|
||||
|
||||
joinAudio(listenOnly) {
|
||||
joinAudio(listenOnly) {
|
||||
if (listenOnly || this.microphoneLockEnforced) {
|
||||
this.isListenOnly = true;
|
||||
this.bridge.joinListenOnly(callbackToAudioBridge);
|
||||
@ -128,10 +131,58 @@ class AudioManager {
|
||||
}
|
||||
|
||||
webRTCCallFailed(inEchoTest, errorcode, cause) {
|
||||
console.log("REACHED CALL MANAGER " + errorcode);
|
||||
if (this.currentState !== this.CallStates.reconecting) {
|
||||
this.currentState = this.CallStates.reconecting;
|
||||
}
|
||||
}
|
||||
|
||||
handleFail(errorcode) {
|
||||
var errorMessage = "";
|
||||
switch(errorcode) {
|
||||
case '1001':
|
||||
errorMessage = "WebSocket disconnected";
|
||||
break;
|
||||
case '1002':
|
||||
errorMessage = "Could not make a WebSocket connection";
|
||||
break;
|
||||
case '1003':
|
||||
errorMessage = "Browser version not supported";
|
||||
break;
|
||||
case '1004':
|
||||
errorMessage = "Failure on call";
|
||||
break;
|
||||
case '1005':
|
||||
errorMessage = "Call ended unexpectedly";
|
||||
break;
|
||||
case '1006':
|
||||
errorMessage = "Call timed out";
|
||||
break;
|
||||
case '1007':
|
||||
errorMessage = "ICE negotiation failed";
|
||||
break;
|
||||
case '1008':
|
||||
errorMessage = "Call transfer failed";
|
||||
break;
|
||||
case '1009':
|
||||
errorMessage = "Could not fetch STUN/TURN server information";
|
||||
break;
|
||||
case '1010':
|
||||
errorMessage = "ICE negotiation timeout";
|
||||
break;
|
||||
case '1011':
|
||||
errorMessage = "ICE gathering timeout";
|
||||
break;
|
||||
default:
|
||||
errorMessage = "unknown error code";
|
||||
break;
|
||||
}
|
||||
|
||||
let failedEvent = new CustomEvent('bbb.webrtc.failed', {
|
||||
status: 'Failed', });
|
||||
window.dispatchEvent(failedEvent);
|
||||
exitAudio();
|
||||
}
|
||||
|
||||
getMicId() {
|
||||
// Placeholder, will get the microphone ID for switching input device
|
||||
|
Loading…
Reference in New Issue
Block a user