MT#56085 Reply with 486 from WebRTC when the user is busy in another conversation

Change-Id: I3eea53440fe14452e0abe8d873f6ac99961e45f6
dependabot/npm_and_yarn/decode-uri-component-0.4.0
Hugo Zigha 3 years ago
parent dcb49ebd6d
commit 175c344157

@ -134,6 +134,12 @@ export function callRegister ({ instanceId }) {
delegateEvent('registrationFailed') delegateEvent('registrationFailed')
$userAgent.on('newRTCSession', (event) => { $userAgent.on('newRTCSession', (event) => {
if (event.originator === 'remote') { if (event.originator === 'remote') {
if ($incomingRtcSession || $outgoingRtcSession) {
event.session.terminate({
status_code: 486,
reason_phrase: 'Busy'
})
} else {
$incomingRtcSession = event.session $incomingRtcSession = event.session
$incomingRtcSession.on('peerconnection', () => { $incomingRtcSession.on('peerconnection', () => {
$incomingRtcSession.connection.ontrack = handleRemoteMediaStream $incomingRtcSession.connection.ontrack = handleRemoteMediaStream
@ -147,6 +153,7 @@ export function callRegister ({ instanceId }) {
}) })
callEvent.emit('incoming', $incomingRtcSession) callEvent.emit('incoming', $incomingRtcSession)
} }
}
}) })
$userAgent.start() $userAgent.start()
} }

@ -77,6 +77,7 @@ export default {
context.commit('hangUpCall') context.commit('hangUpCall')
} else if (options.cause && !errorVisibilityTimer) { } else if (options.cause && !errorVisibilityTimer) {
context.commit('endCall', options.cause) context.commit('endCall', options.cause)
if (options.cause !== 'Busy') {
errorVisibilityTimer = setTimeout(() => { errorVisibilityTimer = setTimeout(() => {
if (context.state.callState === 'ended') { if (context.state.callState === 'ended') {
context.commit('hangUpCall') context.commit('hangUpCall')
@ -84,6 +85,7 @@ export default {
errorVisibilityTimer = null errorVisibilityTimer = null
}, errorVisibilityTimeout) }, errorVisibilityTimeout)
} }
}
}, },
sendDTMF (context, tone) { sendDTMF (context, tone) {
callSendDTMF(tone) callSendDTMF(tone)

Loading…
Cancel
Save