iOS Developer Library

Developer

CoreTelephony Framework Reference CTCallCenter Class Reference

Options
Deployment Target:

On This Page
Language:

CTCallCenter

Use the CTCallCenter class to obtain a list of current cellular calls, and to respond to state changes for calls such as from a dialing state to a connected state. Such state changes are known as cellular call events.

Inheritance


Conforms To


Import Statement


Swift

import CoreTelephony

Objective-C

@import CoreTelephony;

Availability


Available in iOS 4.0 and later.
  • Dispatched when a call changes state.

    Declaration

    Swift

    var callEventHandler: ((CTCall!) -> Void)!

    Objective-C

    @property(nonatomic, copy) void (^callEventHandler)( CTCall *)

    Discussion

    This property’s block object is dispatched on the default priority global dispatch queue when a call changes state. To handle such call events, define a handler block in your application and assign it to this property. You must implement the handler block to support being invoked from any context.

    If your application is active when a call event takes place, the system dispatches the event to your handler immediately. However, call events can also take place while your application is suspended. While it is suspended, your application does not receive call events. When your application resumes the active state, it receives a single call event for each call that changed state—no matter how many state changes the call experienced while your application was suspended. The single call event sent to your handler, upon your application returning to the active state, describes the call’s state at that time.

    For example, suppose your application changes from the active to the suspended state while a call is in the connected state. Suppose also that while your application is suspended, the call disconnects. When your application returns to the active state, you get a cellular call event indicating that the call is disconnected.

    Here is a more complex example. Suppose your application changes from the active to the suspended state after the user has initiated a call but before it connects (that is, your application suspends while the call is in the dialing state). Suppose further that, while your application is suspended, the call changes first to the connected state and then to the disconnected state. When your application returns to the active state, you get a single cellular call event indicating that the call is disconnected.

    See Cellular_Call_States for the various call states. For an explanation of application states, see Understanding an Application’s States and Transitions.

    Import Statement

    Objective-C

    @import CoreTelephony;

    Swift

    import CoreTelephony

    Availability

    Available in iOS 4.0 and later.

  • An array representing the cellular calls in progress. (read-only)

    Declaration

    Swift

    var currentCalls: NSSet! { get }

    Objective-C

    @property(readonly, retain) NSSet *currentCalls

    Discussion

    An array containing a CTCall object for each cellular call in progress. If no calls are in progress, the value of this property is nil.

    Import Statement

    Objective-C

    @import CoreTelephony;

    Swift

    import CoreTelephony

    Availability

    Available in iOS 4.0 and later.