Class

CXProvider

An object that represents a telephony provider.

Declaration

class CXProvider : NSObject

Overview

A CXProvider object is responsible for reporting out-of-band notifications that occur to the system. A VoIP app should create only one instance of CXProvider and store it for use globally. A CXProvider object is initialized with a CXProviderConfiguration object to specify the behavior and capabilities of calls. Each provider can specify an object conforming to the CXProviderDelegate protocol to respond to events, such as the call starting, the call being put on hold, or the provider’s audio session being activated.

Subclassing Notes

CXProvider is not intended for subclassing.

Topics

Creating New Providers

init(configuration: CXProviderConfiguration)

Initializes a new provider with the specified configuration.

Setting the Delegate

func setDelegate(CXProviderDelegate?, queue: DispatchQueue?)

Sets a provider delegate, specifying an optional queue on which to execute delegate methods.

Accessing Provider Attributes

var configuration: CXProviderConfiguration

The configuration of the provider.

Accessing Pending Transaction and Call Actions

var pendingTransactions: [CXTransaction]

Returns all transactions that are not yet completed.

func pendingCallActions(of: AnyClass, withCall: UUID) -> [CXCallAction]

Returns all call actions in any pending transactions of the specified class for the specified call identifier that are not yet completed.

Reporting Calls

func reportNewIncomingCall(with: UUID, update: CXCallUpdate, completion: (Error?) -> Void)

Reports a new incoming call with the specified unique identifier to the provider.

func reportOutgoingCall(with: UUID, startedConnectingAt: Date?)

Reports to the provider that an outgoing call with the specified unique identifier started connecting at a particular time.

func reportOutgoingCall(with: UUID, connectedAt: Date?)

Reports to the provider that an outgoing call with the specified unique identifier finished connecting at a particular time.

func reportCall(with: UUID, updated: CXCallUpdate)

Reports to the provider that an active call updated its information.

func reportCall(with: UUID, endedAt: Date?, reason: CXCallEndedReason)

Reports to the provider that a call with the specified identifier ended at a given date for a particular reason.

Invalidating a Provider

func invalidate()

Invalidates the provider and completes all active calls with an error.

Constants

enum CXCallEndedReason

Reasons for a call to end, as reported by the reportCall(with:endedAt:reason:) method.

enum CXErrorCodeIncomingCallError.Code

Error codes for the CallKit Constants error domain.

let CXErrorDomain: String

Domain for CallKit errrors. See CallKit Constants for possible error codes.

let CXErrorDomainIncomingCall: String

Domain for errors during incoming calls. See CallKit Constants for possible error codes.

Relationships

Inherits From

Conforms To

See Also

Essentials

protocol CXProviderDelegate

A collection of methods that are called by a telephony provider object.

class CXProviderConfiguration

An encapsulation of the configuration of a provider object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software