Call
public class Call
A Call represents a media call on Cisco Spark.
The application can create an outgoing call by calling phone.dial function:
let address = "coworker@example.com"
let localVideoView = MediaRenderView()
let remoteVideoView = MediaRenderView()
let mediaOption = MediaOption.audioVideo(local: localVideoView, remote: remoteVideoView)
spark.phone.dial(address, option:mediaOption) {
switch ret {
case .success(let call):
// success
call.onConnected = {
}
call.onDisconnected = { reason in
}
case .failure(let error):
// failure
}
}
The application can receive an incoming call on phone.onIncoming function:
spark.phone.onIncoming = { call in
call.answer(option: mediaOption) { error in
if let error = error {
// success
}
else {
// failure
}
}
}
See
see Phone API about how to create calls.See
CallStatus for the states and transitions of a Call.Since
1.2.0-
Declaration
Swift
public enum Direction
-
Declaration
Swift
public enum DisconnectReason
-
Declaration
Swift
public enum MediaChangedEvent
-
Declaration
Swift
public enum CallMembershipChangedEvent
-
Declaration
Swift
public enum iOSBroadcastingEvent
-
Declaration
Swift
public enum Capabilities
-
Callback when remote participant(s) is ringing.
Since
1.2.0Declaration
Swift
public var onRinging: (() -> Void)? { get set }
-
Callback when remote participant(s) answered and this call is connected.
Since
1.2.0Declaration
Swift
public var onConnected: (() -> Void)? { get set }
-
Callback when this call is disconnected (hangup, cancelled, get declined or other self device pickup the call).
Since
1.2.0Declaration
Swift
public var onDisconnected: ((Call.DisconnectReason) -> Void)?
-
Callback when the memberships of this call have changed.
Since
1.3.0Declaration
Swift
public var onCallMembershipChanged: ((Call.CallMembershipChangedEvent) -> Void)?
-
Callback when the media types of this call have changed.
Since
1.2.0Declaration
Swift
public var onMediaChanged: ((Call.MediaChangedEvent) -> Void)?
-
Callback when the capabilities of this call have changed.
Since
1.2.0Declaration
Swift
public var onCapabilitiesChanged: ((Call.Capabilities) -> Void)?
-
Callback when the iOS broadcasting status of this call have changed.
Since
1.4.0Declaration
Swift
public var oniOSBroadcastingChanged: ((Call.iOSBroadcastingEvent) -> Void)?
-
The status of this call.
Since
1.2.0See
CallStatusDeclaration
Swift
public internal(set) var status: CallStatus
-
The direction of this call.
Since
1.2.0Declaration
Swift
public private(set) var direction: Direction
-
True if the DTMF keypad is enabled for this call. Otherwise, false.
Since
1.2.0Declaration
Swift
public var sendingDTMFEnabled: Bool { get }
-
True if the remote party of this call is sending video. Otherwise, false.
Since
1.2.0Declaration
Swift
public var remoteSendingVideo: Bool { get }
-
True if the remote party of this call is sending audio. Otherwise, false.
Since
1.2.0Declaration
Swift
public var remoteSendingAudio: Bool { get }
-
True if the remote party of this call is sending screen share. Otherwise, false.
Since
1.3.0Declaration
Swift
public var remoteSendingScreenShare: Bool { get }
-
True if the local party of this call is sending video. Otherwise, false.
Since
1.2.0Declaration
Swift
public var sendingVideo: Bool { get set }
-
True if this call is sending audio. Otherwise, false.
Since
1.2.0Declaration
Swift
public var sendingAudio: Bool { get set }
-
True if the local party of this call is sending screen share. Otherwise, false.
Since
1.4.0Declaration
Swift
public var sendingScreenShare: Bool { get set }
-
True if the local party of this call is receiving video. Otherwise, false.
Since
1.2.0Declaration
Swift
public var receivingVideo: Bool { get set }
-
True if the local party of this call is receiving audio. Otherwise, false.
Since
1.2.0Declaration
Swift
public var receivingAudio: Bool { get set }
-
True if the local party of this call is receiving screen share. Otherwise, false.
Since
1.3.0Declaration
Swift
public var receivingScreenShare: Bool { get set }
-
True if the loud speaker is selected as the audio output device for this call. Otherwise, false.
Since
1.2.0Declaration
Swift
public var isSpeaker: Bool { get set }
-
The camera facing mode selected for this call.
Since
1.2.0Declaration
Swift
public var facingMode: Phone.FacingMode { get set }
-
The local video render view dimensions (points) of this call.
Since
1.2.0Declaration
Swift
public var localVideoViewSize: CMVideoDimensions { get }
-
The remote video render view dimensions (points) of this call.
Since
1.2.0Declaration
Swift
public var remoteVideoViewSize: CMVideoDimensions { get }
-
The remote screen share render view dimensions (points) of this call.
Since
1.3.0Declaration
Swift
public var remoteScreenShareViewSize: CMVideoDimensions { get }
-
The local screen share render view dimensions (points) of this call.
Since
1.4.0Declaration
Swift
public var localScreenShareViewSize: CMVideoDimensions { get }
-
Call Memberships represent participants in this call.
Since
1.2.0Declaration
Swift
public private(set) var memberships: [CallMembership] { get set }
-
The initiator of this call.
Since
1.2.0Declaration
Swift
public var from: CallMembership? { get }
-
The intended recipient of this call.
Since
1.2.0Declaration
Swift
public var to: CallMembership? { get }
-
The render views for local and remote video of this call. If is nil, it will update the video state as inactive to the server side.
Since
1.3.0Declaration
Swift
public var videoRenderViews: (local: MediaRenderView, remote: MediaRenderView)? { get set }
-
The render view for the remote screen share of this call. If is nil, it will update the screen sharing state as inactive to the server side.
Since
1.3.0Declaration
Swift
public var screenShareRenderView: MediaRenderView? { get set }
-
Acknowledge (without answering) an incoming call. Will cause the initiator’s Call instance to emit the ringing event.
See
see CallStatusSince
1.2.0Declaration
Swift
public func acknowledge(completionHandler: @escaping (Error?) -> Void)
Parameters
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Answers this call. This can only be invoked when this call is incoming and in ringing status.
See
see CallStatusSince
1.2.0Declaration
Swift
public func answer(option: MediaOption, completionHandler: @escaping (Error?) -> Void)
Parameters
option
Intended media options - audio only or audio and video - for the call.
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Rejects this call. This can only be invoked when this call is incoming and in ringing status.
Since
1.2.0See
see CallStatusDeclaration
Swift
public func reject(completionHandler: @escaping (Error?) -> Void)
Parameters
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Disconnects this call. This can only be invoked when this call is in answered status.
Since
1.2.0See
see CallStatusDeclaration
Swift
public func hangup(completionHandler: @escaping (Error?) -> Void)
Parameters
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Sends feedback for this call to Cisco Spark team.
Since
1.2.0Declaration
Swift
public func sendFeedbackWith(rating: Int, comments: String? = nil, includeLogs: Bool = false)
Parameters
rating
The rating of the quality of this call between 1 and 5 where 5 means excellent quality.
comments
The comments for this call.
includeLogs
True if to include logs, False as not.
Return Value
Void
-
Sends DTMF events to the remote party. Valid DTMF events are 0-9, *, #, a-d, and A-D.
Since
1.2.0Declaration
Swift
public func send(dtmf: String, completionHandler: ((Error?) -> Void)?)
Parameters
dtmf
any combination of valid DTMF events matching regex mattern
^[0-9#\*abcdABCD]+$
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Start screen sharing in this call.
Since
1.4.0Declaration
Swift
@available(iOS 11.2, *) public func startSharing(completionHandler: @escaping ((Error?) -> Void))
Parameters
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
Stop screen sharing in this call.
Since
1.4.0Declaration
Swift
@available(iOS 11.2, *) public func stopSharing(completionHandler: @escaping ((Error?) -> Void))
Parameters
completionHandler
A closure to be executed when completed, with error if the invocation is illegal or failed, otherwise nil.
Return Value
Void
-
A local unique identifier of a Call for Apple CallKit.
Since
1.2.0Declaration
Swift
public var uuid: UUID { get }
-
Update audio session for CallKit. This must be called on provider:didActivateAudioSession: to reactivate the audio session.
Since
1.3.0Declaration
Swift
public func updateAudioSession()