Skip to content

Commit fcba53f

Browse files
committed
fix(sip): end dial-out calls if rejected by recepient
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent a5f6b67 commit fcba53f

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

src/store/participantsStore.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*/
55

66
import { isCancel } from '@nextcloud/axios'
7-
import { showError, showSuccess } from '@nextcloud/dialogs'
7+
import { showError, showInfo, showSuccess } from '@nextcloud/dialogs'
88
import { emit } from '@nextcloud/event-bus'
99
import { t } from '@nextcloud/l10n'
1010
import Hex from 'crypto-js/enc-hex.js'
1111
import SHA1 from 'crypto-js/sha1.js'
12-
import { ATTENDEE, PARTICIPANT } from '../constants.ts'
12+
import { ATTENDEE, CONVERSATION, PARTICIPANT } from '../constants.ts'
1313
import { banActor } from '../services/banService.ts'
1414
import {
1515
joinCall,
@@ -1250,14 +1250,35 @@ const actions = {
12501250
context.commit('setPhoneState', { callid })
12511251
},
12521252

1253-
processTransientCallStatus(context, { value }) {
1253+
async processTransientCallStatus(context, { value }) {
12541254
context.commit('setPhoneState', { callid: value.callid, value })
12551255

12561256
if (value.status === 'cleared' || value.status === 'rejected') {
12571257
setTimeout(() => {
12581258
context.commit('deletePhoneState', value.callid)
12591259
}, 5000)
12601260
}
1261+
1262+
// Special handling for dial-out rooms, if a call was rejected
1263+
if (value.status === 'rejected') {
1264+
const conversation = context.rootGetters.conversation(tokenStore.token)
1265+
const isConversationPhoneRoom = [
1266+
CONVERSATION.OBJECT_TYPE.PHONE_LEGACY,
1267+
CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT,
1268+
CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY,
1269+
].includes(conversation.objectType)
1270+
&& conversation.objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING
1271+
1272+
if (isConversationPhoneRoom) {
1273+
const actorStore = useActorStore()
1274+
await context.dispatch('leaveCall', {
1275+
token: tokenStore.token,
1276+
participantIdentifier: actorStore.participantIdentifier,
1277+
all: true,
1278+
})
1279+
showInfo(t('spreed', 'Call rejected'))
1280+
}
1281+
}
12611282
},
12621283

12631284
addPhonesStates(context, { phoneStates }) {

0 commit comments

Comments
 (0)