Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit a21bb73

Browse files
committed
Credential checks before notifiying calls to the telecomManager
1 parent d8f6833 commit a21bb73

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Basic-Video-Chat-ConnectionService-Kotlin/app/src/main/java/com/vonage/basic_video_chat_connectionservice/usecases/StartIncomingCallUseCase.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.vonage.basic_video_chat_connectionservice.usecases
22

33
import com.vonage.basic_video_chat_connectionservice.CallException
4+
import com.vonage.basic_video_chat_connectionservice.OpenTokConfig
45
import com.vonage.basic_video_chat_connectionservice.connectionservice.PhoneAccountManager
56
import javax.inject.Inject
67

@@ -12,10 +13,14 @@ private val phoneAccountManager: PhoneAccountManager
1213
val callerName = "Simulated Caller"
1314
val callerId = "+4401539702257"
1415

15-
if (phoneAccountManager.canPlaceIncomingCall()) {
16-
phoneAccountManager.notifyIncomingVideoCall(callerName, callerId)
17-
} else {
16+
if (!OpenTokConfig.isValid) {
17+
throw CallException("Invalid credentials", 1001)
18+
}
19+
20+
if (!phoneAccountManager.canPlaceIncomingCall()) {
1821
throw CallException("Can't launch incoming call", 1001)
1922
}
23+
24+
phoneAccountManager.notifyIncomingVideoCall(callerName, callerId)
2025
}
2126
}

Basic-Video-Chat-ConnectionService-Kotlin/app/src/main/java/com/vonage/basic_video_chat_connectionservice/usecases/StartOutgoingCallUseCase.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.vonage.basic_video_chat_connectionservice.usecases
22

33
import com.vonage.basic_video_chat_connectionservice.CallException
4+
import com.vonage.basic_video_chat_connectionservice.OpenTokConfig
45
import com.vonage.basic_video_chat_connectionservice.connectionservice.PhoneAccountManager
56
import javax.inject.Inject
67

@@ -12,10 +13,14 @@ private val phoneAccountManager: PhoneAccountManager
1213
val callerName = "Simulated Caller"
1314
val callerId = "+4401539702257"
1415

15-
if (phoneAccountManager.canPlaceOutgoingCall()) {
16-
phoneAccountManager.startOutgoingVideoCall(callerName, callerId)
17-
} else {
16+
if (!OpenTokConfig.isValid) {
17+
throw CallException("Invalid credentials", 1001)
18+
}
19+
20+
if (!phoneAccountManager.canPlaceOutgoingCall()) {
1821
throw CallException("Can't launch outgoing call", 1001)
1922
}
23+
24+
phoneAccountManager.startOutgoingVideoCall(callerName, callerId)
2025
}
2126
}

0 commit comments

Comments
 (0)