Skip to content

Commit

Permalink
Merge pull request #133 from team-telnyx/IS/Fix/AttachActiveCall
Browse files Browse the repository at this point in the history
Is/fix/attach active call
  • Loading branch information
isaacakakpo1 authored Oct 29, 2024
2 parents 854e814 + 74b9af1 commit 016bc2e
Show file tree
Hide file tree
Showing 20 changed files with 545 additions and 98 deletions.
43 changes: 33 additions & 10 deletions TelnyxRTC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
/* Begin PBXBuildFile section */
1B0B82F8E58A096FBA0FB9CC /* (null) in Frameworks */ = {isa = PBXBuildFile; };
3B0F56CB2C7F15830011A48A /* StatsMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B0F56CA2C7F15830011A48A /* StatsMessage.swift */; };
3B0F56CD2C7F1CCA0011A48A /* Reachability.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B0F56CC2C7F1CCA0011A48A /* Reachability.framework */; };
3B1BE6F72AA9A467000B7962 /* TxPushIPConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B1BE6F62AA9A467000B7962 /* TxPushIPConfig.swift */; };
3B1F43EF2AE0B01E00A610BA /* Params.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B1F43EE2AE0B01E00A610BA /* Params.swift */; };
3B49B7152AA9B0A20026D36D /* AttachCallMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B49B7142AA9B0A20026D36D /* AttachCallMessage.swift */; };
3B72695D2A9396BF00D2A602 /* DisablePushMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B72695C2A9396BF00D2A602 /* DisablePushMessage.swift */; };
3B758F1A2BF44D7800D50069 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3B758F192BF44D7800D50069 /* PrivacyInfo.xcprivacy */; };
3B758F1E2BF97E8C00D50069 /* FileLoger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B758F1D2BF97E8C00D50069 /* FileLoger.swift */; };
3B91C0F52BE3A44600A03067 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3B91C0F42BE3A44600A03067 /* PrivacyInfo.xcprivacy */; };
3BC03B4E2CC25F5F00FD2B29 /* Reachability.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B0F56CC2C7F1CCA0011A48A /* Reachability.framework */; };
3BC03B572CC261F500FD2B29 /* Bugsnag.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC03B562CC261F500FD2B29 /* Bugsnag.framework */; };
3BC03B592CC2653700FD2B29 /* TelnyxRTC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B368BEC025EDDB610032AE52 /* TelnyxRTC.framework */; };
3BC03B5E2CC2659500FD2B29 /* Pods_TelnyxRTC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A11DAA0171B02D67683620E /* Pods_TelnyxRTC.framework */; };
3BF1D5842BEB7B8F0097453F /* TelnyxRTC.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 3BF1D5832BEB7B8F0097453F /* TelnyxRTC.podspec */; };
9578D6261E82279EDEDFA516 /* Pods_TelnyxWebRTCDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7CE9BEFEDE503E7BC7BE3C8 /* Pods_TelnyxWebRTCDemo.framework */; };
AE43DF75B2F7AE413F1EE1B0 /* Pods_TelnyxRTC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A11DAA0171B02D67683620E /* Pods_TelnyxRTC.framework */; };
B309D13D25EF119E00A2AADF /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B309D11125EF107F00A2AADF /* Starscream.framework */; };
B309D1D625F020B300A2AADF /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = B309D1D525F020B300A2AADF /* Message.swift */; };
B309D1DB25F020D400A2AADF /* Method.swift in Sources */ = {isa = PBXBuildFile; fileRef = B309D1DA25F020D400A2AADF /* Method.swift */; };
Expand Down Expand Up @@ -81,6 +82,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
3BC03B5B2CC2653700FD2B29 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B368BEB725EDDB610032AE52 /* Project object */;
proxyType = 1;
remoteGlobalIDString = B368BEBF25EDDB610032AE52;
remoteInfo = TelnyxRTC;
};
B368BED725EDDBC90032AE52 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B368BEB725EDDB610032AE52 /* Project object */;
Expand Down Expand Up @@ -112,11 +120,14 @@
3B0F56CC2C7F1CCA0011A48A /* Reachability.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Reachability.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B1BE6F62AA9A467000B7962 /* TxPushIPConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TxPushIPConfig.swift; sourceTree = "<group>"; };
3B1F43EE2AE0B01E00A610BA /* Params.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Params.swift; sourceTree = "<group>"; };
3B304DB22CAD823600459A97 /* Pods_TelnyxRTC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_TelnyxRTC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B49B7142AA9B0A20026D36D /* AttachCallMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachCallMessage.swift; sourceTree = "<group>"; };
3B72695C2A9396BF00D2A602 /* DisablePushMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisablePushMessage.swift; sourceTree = "<group>"; };
3B758F192BF44D7800D50069 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B758F1D2BF97E8C00D50069 /* FileLoger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileLoger.swift; sourceTree = "<group>"; };
3B91C0F42BE3A44600A03067 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3BC03B462CC2544800FD2B29 /* Pods_TelnyxRTC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_TelnyxRTC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3BC03B562CC261F500FD2B29 /* Bugsnag.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Bugsnag.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3BF1D5832BEB7B8F0097453F /* TelnyxRTC.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TelnyxRTC.podspec; sourceTree = "<group>"; };
3F6CE2F8F9D0DBE4DA219605 /* Pods-TelnyxRTC-TelnyxRTCTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TelnyxRTC-TelnyxRTCTests.release.xcconfig"; path = "Target Support Files/Pods-TelnyxRTC-TelnyxRTCTests/Pods-TelnyxRTC-TelnyxRTCTests.release.xcconfig"; sourceTree = "<group>"; };
4DE56344987C90A16F102652 /* Pods-TelnyxWebRTCDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TelnyxWebRTCDemo.release.xcconfig"; path = "Target Support Files/Pods-TelnyxWebRTCDemo/Pods-TelnyxWebRTCDemo.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -192,9 +203,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3BC03B572CC261F500FD2B29 /* Bugsnag.framework in Frameworks */,
B309D13D25EF119E00A2AADF /* Starscream.framework in Frameworks */,
3BC03B5E2CC2659500FD2B29 /* Pods_TelnyxRTC.framework in Frameworks */,
B309D26225F1574C00A2AADF /* (null) in Frameworks */,
AE43DF75B2F7AE413F1EE1B0 /* Pods_TelnyxRTC.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -211,9 +223,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3BC03B592CC2653700FD2B29 /* TelnyxRTC.framework in Frameworks */,
1B0B82F8E58A096FBA0FB9CC /* (null) in Frameworks */,
3B0F56CD2C7F1CCA0011A48A /* Reachability.framework in Frameworks */,
9578D6261E82279EDEDFA516 /* Pods_TelnyxWebRTCDemo.framework in Frameworks */,
3BC03B4E2CC25F5F00FD2B29 /* Reachability.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -449,6 +461,9 @@
EA45B40E24738E41F9F44AA0 /* Frameworks */ = {
isa = PBXGroup;
children = (
3BC03B562CC261F500FD2B29 /* Bugsnag.framework */,
3BC03B462CC2544800FD2B29 /* Pods_TelnyxRTC.framework */,
3B304DB22CAD823600459A97 /* Pods_TelnyxRTC.framework */,
3B0F56CC2C7F1CCA0011A48A /* Reachability.framework */,
B309D11125EF107F00A2AADF /* Starscream.framework */,
8A11DAA0171B02D67683620E /* Pods_TelnyxRTC.framework */,
Expand Down Expand Up @@ -525,6 +540,7 @@
buildRules = (
);
dependencies = (
3BC03B5C2CC2653700FD2B29 /* PBXTargetDependency */,
);
name = TelnyxWebRTCDemo;
productName = TelnyxWebRTCDemo;
Expand Down Expand Up @@ -785,6 +801,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
3BC03B5C2CC2653700FD2B29 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B368BEBF25EDDB610032AE52 /* TelnyxRTC */;
targetProxy = 3BC03B5B2CC2653700FD2B29 /* PBXContainerItemProxy */;
};
B368BED825EDDBC90032AE52 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B368BEBF25EDDB610032AE52 /* TelnyxRTC */;
Expand Down Expand Up @@ -939,8 +960,10 @@
baseConfigurationReference = 711958501DD45FDFBD112FC6 /* Pods-TelnyxRTC.debug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = YKUVNPU9FS;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -1050,7 +1073,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = TelnyxWebRTCDemo/TelnyxWebRTCDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = YKUVNPU9FS;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = TelnyxWebRTCDemo/Info.plist;
Expand All @@ -1059,7 +1082,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.17;
MARKETING_VERSION = 0.1.19;
PRODUCT_BUNDLE_IDENTIFIER = com.telnyx.webrtcapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1075,7 +1098,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = TelnyxWebRTCDemo/TelnyxWebRTCDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = YKUVNPU9FS;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = TelnyxWebRTCDemo/Info.plist;
Expand All @@ -1084,7 +1107,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.17;
MARKETING_VERSION = 0.1.19;
PRODUCT_BUNDLE_IDENTIFIER = com.telnyx.webrtcapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
revealArchiveInOrganizer = "YES"
allowsArchivingForSimulator = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion TelnyxRTC/Telnyx/Models/TxConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct TxConfig {

public internal(set) var ringBackTone: String?
public internal(set) var ringtone: String?
public internal(set) var reconnectClient: Bool = false
public internal(set) var reconnectClient: Bool = true
public internal(set) var pushEnvironment: PushEnvironment?

// MARK: - Initializers
Expand Down
18 changes: 18 additions & 0 deletions TelnyxRTC/Telnyx/Models/TxServerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,21 @@ public struct TxServerConfiguration {
}
}
}

import Foundation

extension String {

func fromBase64() -> String? {
guard let data = Data(base64Encoded: self) else {
return nil
}

return String(data: data, encoding: .utf8)
}

func toBase64() -> String {
return Data(self.utf8).base64EncodedString()
}

}
11 changes: 8 additions & 3 deletions TelnyxRTC/Telnyx/Services/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Socket {
weak var delegate: SocketDelegate?
var isConnected : Bool = false
private var socket : WebSocket?
private var reconnect : Bool = false

func connect(signalingServer: URL) {
Logger.log.i(message: "Socket:: connect()")
Expand All @@ -23,11 +24,13 @@ class Socket {

self.socket = WebSocket(request: request, certPinner: pinner)
self.socket?.delegate = self
self.socket?.request.timeoutInterval = TimeInterval(120)
self.socket?.connect()
}

func disconnect() {
func disconnect(reconnect:Bool) {
Logger.log.i(message: "Socket:: disconnect()")
self.reconnect = reconnect
self.socket?.disconnect()
}

Expand Down Expand Up @@ -58,7 +61,7 @@ extension Socket : WebSocketDelegate {
case .disconnected(let reason, let code):
//This are server side disconnections
isConnected = false
self.delegate?.onSocketDisconnected()
self.delegate?.onSocketDisconnected(reconnect: self.reconnect)
Logger.log.i(message: "Socket:: websocket is disconnected: \(reason) with code: \(code)")
break;

Expand All @@ -70,7 +73,8 @@ extension Socket : WebSocketDelegate {

case .cancelled:
isConnected = false
self.delegate?.onSocketDisconnected()
self.delegate?.onSocketDisconnected(reconnect: self.reconnect)
self.reconnect = false
Logger.log.i(message: "Socket:: WebSocketDelegate .cancelled")
break

Expand All @@ -94,6 +98,7 @@ extension Socket : WebSocketDelegate {
Logger.log.i(message: "Socket:: WebSocketDelegate viablility Changed")
break
case .reconnectSuggested(_):
self.delegate?.onSocketReconnectSuggested()
Logger.log.i(message: "Socket:: WebSocketDelegate reconnect Suggested")
break
case .peerClosed:
Expand Down
3 changes: 2 additions & 1 deletion TelnyxRTC/Telnyx/Services/SocketDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Foundation

protocol SocketDelegate: AnyObject {
func onSocketConnected()
func onSocketDisconnected()
func onSocketReconnectSuggested()
func onSocketDisconnected(reconnect:Bool)
func onSocketError(error: Error)
func onMessageReceived(message: String)
}
Loading

0 comments on commit 016bc2e

Please sign in to comment.