Skip to content

Commit ebc81e2

Browse files
authored
Merge pull request #8660 from vector-im/feature/bma/stopInfiniteRingingCall
Ensure the incoming call will not ring forever, in case the call is not ended by another way
2 parents 9e74afc + 52082a9 commit ebc81e2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

changelog.d/8178.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure the incoming call will not ring forever, in case the call is not ended by another way.

vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import im.vector.app.features.call.vectorCallService
3434
import im.vector.app.features.session.coroutineScope
3535
import kotlinx.coroutines.CoroutineScope
3636
import kotlinx.coroutines.asCoroutineDispatcher
37+
import kotlinx.coroutines.delay
38+
import kotlinx.coroutines.launch
3739
import org.matrix.android.sdk.api.extensions.orFalse
3840
import org.matrix.android.sdk.api.extensions.tryOrNull
3941
import org.matrix.android.sdk.api.logger.LoggerTag
@@ -386,6 +388,14 @@ class WebRtcCallManager @Inject constructor(
386388
// Maybe increase sync freq? but how to set back to default values?
387389
}
388390
}
391+
392+
// ensure the incoming call will not ring forever
393+
sessionScope?.launch {
394+
delay(2 * 60 * 1000 /* 2 minutes */)
395+
if (mxCall.state is CallState.LocalRinging) {
396+
onCallEnded(mxCall.callId, EndCallReason.INVITE_TIMEOUT, rejected = false)
397+
}
398+
}
389399
}
390400

391401
override fun onCallAnswerReceived(callAnswerContent: CallAnswerContent) {

0 commit comments

Comments
 (0)