diff --git a/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/Call.kt b/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/Call.kt index 153a66b2..f5a8d342 100644 --- a/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/Call.kt +++ b/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/Call.kt @@ -41,7 +41,7 @@ import kotlin.concurrent.timerTask */ data class CustomHeaders(val name: String, val value: String) - data class Call( +data class Call( val context: Context, val client: TelnyxClient, var socket: TxSocket, @@ -49,19 +49,19 @@ data class CustomHeaders(val name: String, val value: String) val audioManager: AudioManager, val providedTurn: String = Config.DEFAULT_TURN, val providedStun: String = Config.DEFAULT_STUN, - ) { +) { companion object { const val ICE_CANDIDATE_DELAY: Long = 400 } + internal var peerConnection: Peer? = null internal var earlySDP = false - var inviteResponse:InviteResponse? = null - var answerResponse:AnswerResponse? = null - + var inviteResponse: InviteResponse? = null + var answerResponse: AnswerResponse? = null lateinit var callId: UUID internal var telnyxSessionId: UUID? = null @@ -85,19 +85,18 @@ data class CustomHeaders(val name: String, val value: String) loudSpeakerLiveData.postValue(audioManager.isSpeakerphoneOn) } - fun startDebug(){ + fun startDebug() { Timber.d("Peer connection debug started") peerConnection?.startTimer() } - fun stopDebug(){ + fun stopDebug() { Timber.d("Peer connection debug stopped") peerConnection?.stopTimer() } - /** * Initiates a new call invitation * @param callerName, the name to appear on the invitation @@ -142,7 +141,7 @@ data class CustomHeaders(val name: String, val value: String) destinationNumber: String, customHeaders: Map? = null ) { - client.acceptCall(callId, destinationNumber, customHeaders) + client.acceptCall(callId, destinationNumber, customHeaders) } @@ -183,7 +182,7 @@ data class CustomHeaders(val name: String, val value: String) * @see [Call] */ fun endCall(callId: UUID) { - client.endCall(callId) + client.endCall(callId) } /** @@ -220,7 +219,6 @@ data class CustomHeaders(val name: String, val value: String) } - /** * Either places a call on hold, or unholds a call based on the current [holdLiveData] value * @param callId, the unique UUID of the call you want to place or remove from hold with the [sendHoldModifier] method @@ -337,8 +335,6 @@ data class CustomHeaders(val name: String, val value: String) } - - fun JsonArray.toCustomHeaders(): ArrayList { val customHeaders = arrayListOf() return try { @@ -355,8 +351,6 @@ data class CustomHeaders(val name: String, val value: String) } - - fun setCallRecovering() { callStateLiveData.postValue(CallState.RECOVERING) } diff --git a/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/peer/Peer.kt b/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/peer/Peer.kt index b4690bda..255aef1b 100644 --- a/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/peer/Peer.kt +++ b/telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/peer/Peer.kt @@ -55,6 +55,7 @@ internal class Peer( } private val rootEglBase: EglBase = EglBase.create() + private var isDebugStats = false internal var debugStatsId = UUID.randomUUID() @@ -173,6 +174,7 @@ internal class Peer( } internal fun startTimer() { + isDebugStats = true if (!client.debugReportStarted){ debugStatsId = UUID.randomUUID() client.startStats(debugStatsId) @@ -384,7 +386,9 @@ internal class Peer( disconnect() peerConnectionFactory.dispose() } - stopTimer() + if (isDebugStats){ + stopTimer() + } } init {