VoiceSDK
public final class VoiceSDK
VoiceSDK
is an SDK facade object.
The inception point of all communications between client and SDK.
-
The state refects the current SDK state. The client may adopt
VoiceSDKObserverProtocol
and subscribe for changes.Declaration
Swift
public private(set) var state: State { get set }
-
The configuration contains SDK settings. It should be set at least once before activation.
Declaration
Swift
public var configuration: Configuration { get set }
-
The authenticationContext contains authentication token. It should be set at least once before activation.
Declaration
Swift
public var authenticationContext: AuthenticationContext { get }
-
The networkReachabilityStatus refelects the current network reachability status. The client may adopt
NetworkReachabilityObserverProtocol
and subscribe for changes.Declaration
Swift
public var networkReachabilityStatus: ReachabilityStatus { get }
-
The calls contains active calls. The client may adopt
CallSetObserverProtocol
and subscribe for changes.Declaration
Swift
public var calls: [VoiceCall] { get }
-
The pushToken contains push notification token (PushKit). The client may adopt
PushNotificationObserverProtocol
and subscribe for changes.Declaration
Swift
public var pushToken: String { get }
-
Undocumented
Declaration
Swift
public var audioSessionActivated: CurrentValueSubject<Bool, Never> { get }
-
The
preinit()
function prepares the SDK for receiving VoIP push notifications.Note
The application should call this function asap inapplication(_:didFinishLaunchingWithOptions:)
. But even so, it is recommended to setuplogMessageCallback
in the first place.Declaration
Swift
public class func preinit()
-
The shared is a reference on a
VoiceSDK
singleton (SDK facade object).Declaration
Swift
public static let shared: VoiceSDK
-
The
activate(completion:)
function creates (setup) the internal SDK components. It should be called by app on user login (autologin) completion.Declaration
Swift
public func activate(completion: @escaping (_ result: Result<Void, ErrorType>) -> Void)
Parameters
completion
The completion is called on main thread.
result
It contains the SDK activation result.
-
The
deactivate(completion:)
function destroys the internal SDK components. It should be called by app upon user logout.Declaration
Swift
public func deactivate(completion: @escaping (_ result: Result<Void, ErrorType>) -> Void)
Parameters
completion
The completion is called on main thread.
result
It contains the SDK deactivation result.
-
The
placeCall(with:completion)
function places outgoing call.Precondition
TheVoiceSDK
object should be inactive
state.Declaration
Swift
public func placeCall(with parameters: OutgoingCallParameters, completion: @escaping (_ result: Result<VoiceCall, ErrorType>) -> Void)
-
The
updatePhoneNumber(:)
function updates phone number.Declaration
Swift
public func updatePhoneNumber(_ number: String?, completion: @escaping (_ result: Result<Void, ErrorType>) -> Void)
Parameters
number
It updates (sets) the current device phone number.
completion
The completion is called on main thread.
result
The result is either
success
orfailure
withErrorType
value. -
The
updateInboundCallPath(:)
function updates inbound call path.Declaration
Swift
public func updateInboundCallPath(_ path: InboundCallPath, completion: @escaping (_ result: Result<Void, ErrorType>) -> Void)
Parameters
path
It updates (sets) the current prefered path for receiving the incoming call on this device.
completion
The completion is called on main thread.
result
The result is either
success
orfailure
withErrorType
value. -
The
version()
function returns Voice SDK version.Declaration
Swift
@discardableResult public func version() -> String
Return Value
The string value indicating the Voice SDK version.
-
The
voiceStackVersion()
function returns version of Voice Stack used by Voice SDK.Declaration
Swift
@discardableResult public func voiceStackVersion() -> String
Return Value
The string value indicating the version or Voice Stack.
-
The logMessageCallback is used to route SDK log messages to client.
Declaration
Swift
public static var logMessageCallback: LogMessageCallback? { get set }
-
The contactResolverCallback is used to request Contact Info from client.
Declaration
Swift
public static var contactResolverCallback: ContactResolverCallback? { get set }
-
The audioSessionConfigurationCallback is used to let client configure audio session for call.
Declaration
Swift
public static var audioSessionConfigurationCallback: AudioSessionConfigurationCallback? { get set }
-
The
addObserver(_:)
function adds observer object.Note
The weak reference is stored.Precondition
In order to be notified the observer should adopt at least one the following protocols:
Declaration
Swift
public func addObserver(_ observer: AnyObject)
Parameters
observer
The reference on the object.
-
The
removeObserver(_:)
function removes observer object.Declaration
Swift
public func removeObserver(_ observer: AnyObject)
Parameters
observer
The reference on the object.