Skip to content

Commit

Permalink
Reconnect Socket to Voice SDK ID
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacakakpo1 committed Sep 5, 2024
1 parent 5cecdb2 commit e156114
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.suppressUnsupportedCompileSdk=34


6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 02 12:25:37 IST 2022
#Tue Aug 27 14:50:55 GMT 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion telnyx_rtc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ android {



compileSdkVersion 34
compileSdk 34

defaultConfig {
minSdkVersion 23
Expand Down
17 changes: 17 additions & 0 deletions telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/TelnyxClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class TelnyxClient(
private var providedPort: Int? = null
internal var providedTurn: String? = null
internal var providedStun: String? = null
private var voiceSDKID: String? = null

internal var debugReportStarted = false

Expand Down Expand Up @@ -370,6 +371,11 @@ class TelnyxClient(

}


if (voiceSDKID != null){
pushMetaData = PushMetaData(callerName = "", callerNumber = "", callId = "", voiceSdkId = voiceSDKID)
}

// Connect to new socket
socket.connect(this@TelnyxClient, providedHostAddress, providedPort, pushMetaData) {

Expand Down Expand Up @@ -518,6 +524,9 @@ class TelnyxClient(
providedStun = providedServerConfig.stun
if (ConnectivityHelper.isNetworkEnabled(context)) {
Timber.d("Provided Host Address: $providedHostAddress")
if (voiceSDKID != null){
pushMetaData = PushMetaData(callerName = "", callerNumber = "", callId = "", voiceSdkId = voiceSDKID)
}
socket.connect(this, providedHostAddress, providedPort, pushMetaData) {
if (autoLogin) {
credentialLogin(credentialConfig)
Expand Down Expand Up @@ -559,6 +568,9 @@ class TelnyxClient(
providedStun = providedServerConfig.stun
if (ConnectivityHelper.isNetworkEnabled(context)) {
Timber.d("Provided Host Address: $providedHostAddress")
if (voiceSDKID != null){
pushMetaData = PushMetaData(callerName = "", callerNumber = "", callId = "", voiceSdkId = voiceSDKID)
}
socket.connect(this, providedHostAddress, providedPort, pushMetaData) {
if (autoLogin) {
tokenLogin(tokenConfig)
Expand Down Expand Up @@ -1357,6 +1369,11 @@ class TelnyxClient(
val params = jsonObject.getAsJsonObject("params")
val offerCallId = UUID.fromString(params.get("callID").asString)
val remoteSdp = params.get("sdp").asString
val voiceSdkID = params.get("voice_sdk_id")?.asString
if (voiceSdkID != null) {
this@TelnyxClient.voiceSDKID = voiceSdkID
}

val callerName = params.get("caller_id_name").asString
val callerNumber = params.get("caller_id_number").asString
telnyxSessionId = UUID.fromString(params.get("telnyx_session_id").asString)
Expand Down

0 comments on commit e156114

Please sign in to comment.