Merge pull request #8358 from capilkey/audio-improvements

Hangup sip.js on timeout and stop audio join double click
This commit is contained in:
Anton Georgiev 2019-11-22 17:23:10 -05:00 committed by GitHub
commit 4ccec9203f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 4 deletions

View File

@ -14,7 +14,7 @@ const CALL_HANGUP_MAX_RETRIES = MEDIA.callHangupMaximumRetries;
const RELAY_ONLY_ON_RECONNECT = MEDIA.relayOnlyOnReconnect; const RELAY_ONLY_ON_RECONNECT = MEDIA.relayOnlyOnReconnect;
const IPV4_FALLBACK_DOMAIN = Meteor.settings.public.app.ipv4FallbackDomain; const IPV4_FALLBACK_DOMAIN = Meteor.settings.public.app.ipv4FallbackDomain;
const ICE_NEGOTIATION_FAILED = ['iceConnectionFailed']; const ICE_NEGOTIATION_FAILED = ['iceConnectionFailed'];
const CALL_CONNECT_TIMEOUT = 15000; const CALL_CONNECT_TIMEOUT = 20000;
const ICE_NEGOTIATION_TIMEOUT = 20000; const ICE_NEGOTIATION_TIMEOUT = 20000;
const AUDIO_SESSION_NUM_KEY = 'AudioSessionNumber'; const AUDIO_SESSION_NUM_KEY = 'AudioSessionNumber';
@ -122,6 +122,9 @@ class SIPSession {
error: 1008, error: 1008,
bridgeError: 'Timeout on call transfer', bridgeError: 'Timeout on call transfer',
}); });
this.exitAudio();
reject(this.baseErrorCodes.REQUEST_TIMEOUT); reject(this.baseErrorCodes.REQUEST_TIMEOUT);
}, CALL_TRANSFER_TIMEOUT); }, CALL_TRANSFER_TIMEOUT);
@ -338,6 +341,8 @@ class SIPSession {
error: 1006, error: 1006,
bridgeError: `Call timed out on start after ${CALL_CONNECT_TIMEOUT / 1000}s`, bridgeError: `Call timed out on start after ${CALL_CONNECT_TIMEOUT / 1000}s`,
}); });
this.exitAudio();
}, CALL_CONNECT_TIMEOUT); }, CALL_CONNECT_TIMEOUT);
let iceNegotiationTimeout; let iceNegotiationTimeout;
@ -355,6 +360,8 @@ class SIPSession {
error: 1010, error: 1010,
bridgeError: `ICE negotiation timeout after ${ICE_NEGOTIATION_TIMEOUT / 1000}s`, bridgeError: `ICE negotiation timeout after ${ICE_NEGOTIATION_TIMEOUT / 1000}s`,
}); });
this.exitAudio();
}, ICE_NEGOTIATION_TIMEOUT); }, ICE_NEGOTIATION_TIMEOUT);
} }
}; };

View File

@ -206,6 +206,7 @@ class AudioModal extends Component {
this.setState({ this.setState({
content: null, content: null,
hasError: true, hasError: true,
disableActions: false,
}); });
} }
@ -249,20 +250,29 @@ class AudioModal extends Component {
joinEchoTest, joinEchoTest,
} = this.props; } = this.props;
const {
disableActions,
} = this.state;
if (disableActions) return;
this.setState({ this.setState({
hasError: false, hasError: false,
disableActions: true,
}); });
return joinEchoTest().then(() => { return joinEchoTest().then(() => {
console.log(inputDeviceId, outputDeviceId); //console.log(inputDeviceId, outputDeviceId);
this.setState({ this.setState({
content: 'echoTest', content: 'echoTest',
disableActions: false,
}); });
}).catch((err) => { }).catch((err) => {
if (err.type === 'MEDIA_ERROR') { if (err.type === 'MEDIA_ERROR') {
this.setState({ this.setState({
content: 'help', content: 'help',
errCode: err.code, errCode: err.code,
disableActions: false,
}); });
} }
}); });
@ -273,7 +283,21 @@ class AudioModal extends Component {
joinListenOnly, joinListenOnly,
} = this.props; } = this.props;
return joinListenOnly().catch((err) => { const {
disableActions,
} = this.state;
if (disableActions) return;
this.setState({
disableActions: true,
});
return joinListenOnly().then(() => {
this.setState({
disableActions: false,
});
}).catch((err) => {
if (err.type === 'MEDIA_ERROR') { if (err.type === 'MEDIA_ERROR') {
this.setState({ this.setState({
content: 'help', content: 'help',
@ -287,11 +311,22 @@ class AudioModal extends Component {
joinMicrophone, joinMicrophone,
} = this.props; } = this.props;
const {
disableActions,
} = this.state;
if (disableActions) return;
this.setState({ this.setState({
hasError: false, hasError: false,
disableActions: true,
}); });
joinMicrophone().catch(this.handleGoToAudioOptions); joinMicrophone().then(() => {
this.setState({
disableActions: false,
});
}).catch(this.handleGoToAudioOptions);
} }
skipAudioOptions() { skipAudioOptions() {