Phone

public class Phone

Phone represents a Cisco Spark calling device. The application can obtain a phone object from Spark object and use phone to call other Cisco Spark users or PSTN when enabled. The phone must be registered before it can make or receive calls.

    spark.phone.register() { error in
      if let error = error {
        ... // Device was not registered, and no calls can be sent or received
      } else {
        ... // Successfully registered device
      }
    }

Since

1.2.0
  • The enumeration of Camera facing modes.

    Since

    1.2.0
    See more

    Declaration

    Swift

    public enum FacingMode
  • The enumeration of common bandwidth choices.

    Since

    1.3.0
    See more

    Declaration

    Swift

    public enum DefaultBandwidth : UInt32
  • The max bandwidth for audio in unit bps for the call. Only effective if set before the start of call. if 0, default value of 64 * 1000 is used.

    Since

    1.3.0

    Declaration

    Swift

    public var audioMaxBandwidth: UInt32
  • The max bandwidth for video in unit bps for the call. Only effective if set before the start of call. if 0, default value of 2000*1000 is used.

    Since

    1.3.0

    Declaration

    Swift

    public var videoMaxBandwidth: UInt32
  • The max bandwidth for screen sharing in unit bps for the call. Only effective if set before the start of call. if 0, default value of 4000*1000 is used.

    Since

    1.3.0

    Declaration

    Swift

    public var screenShareMaxBandwidth: UInt32
  • Default camera facing mode of this phone, used as the default when dialing or answering a call. The default mode is the front camera.

    Note

    The setting is not persistent

    Since

    1.2.0

    Declaration

    Swift

    public var defaultFacingMode: Phone.FacingMode
  • Default loud speaker mode of this phone, used as the default when dialing or answering a call. True as using loud speaker, False as not. The default is using loud speaker.

    Note

    The setting is not persistent.

    Since

    1.2.0

    Declaration

    Swift

    public var defaultLoudSpeaker: Bool
  • Callback when call is incoming.

    Since

    1.2.0

    Declaration

    Swift

    public var onIncoming: ((Call) -> Void)?
  • Indicates whether or not the SDK is connected with the Cisco Spark cloud.

    Since

    1.4.0

    Declaration

    Swift

    public private(set) var connected: Bool
  • Indicates whether or not the SDK is registered with the Cisco Spark cloud.

    Since

    1.4.0

    Declaration

    Swift

    public var registered: Bool { get }
  • Registers this phone to Cisco Spark cloud on behalf of the authenticated user. It also creates the websocket and connects to Cisco Spark cloud. Subsequent invocations of this method refresh the registration.

    Since

    1.2.0

    Declaration

    Swift

    public func register(_ 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

  • Removes this phone from Cisco Spark cloud on behalf of the authenticated user. It also disconnects the websocket from Cisco Spark cloud. Subsequent invocations of this method behave as a no-op.

    Since

    1.2.0

    Declaration

    Swift

    public func deregister(_ 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

  • Makes a call to an intended recipient on behalf of the authenticated user. It supports the following address formats for the receipient:

  • throw:
  • Since

    1.2.0

    Attention

    Currently the SDK only supports one active call at a time. Invoking this function while there is an active call will generate an exception.

    Declaration

    Swift

    public func dial(_ address: String, option: MediaOption, completionHandler: @escaping ((Result<Call>) -> Void))

    Parameters

    address

    Intended recipient address in one of the supported formats.

    option

    Intended media options - audio only or audio and video - for the call.

    completionHandler

    A closure to be executed when completed.

    Return Value

    a Call object

  • Pops up an Alert for the end user to approve the use of H.264 codec license from Cisco Systems, Inc.

    Note

    Invoking this function is optional since the alert will appear automatically during the first video call.

    Since

    1.2.0

    Declaration

    Swift

    public func requestVideoCodecActivation()

    Return Value

    Void

  • Prevents Cisco Spark iOS SDK from poping up an Alert for the end user to approve the use of H.264 video codec license from Cisco Systems, Inc.

    Attention

    The function is expected to be called only by Cisco internal applications. 3rd-party applications should NOT call this function.

    Since

    1.2.0

    Declaration

    Swift

    public func disableVideoCodecActivation()

    Return Value

    Void

  • Render a preview of the local party before the call is answered.

    Declaration

    Swift

    public func startPreview(view: MediaRenderView)

    Parameters

    view

    an UI view for rendering video.

    Return Value

    Void

  • Stop rendering the preview of the local party.

    Declaration

    Swift

    public func stopPreview()

    Return Value

    Void