CTCallCenter Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreTelephony.framework
Availability
Available in iOS 4.0 and later.
Declared in
CTCallCenter.h
Related sample code

Overview

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.

Tasks

Responding to Cellular Call Events

Properties

callEventHandler

Dispatched when a call changes state.

@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” in iOS App Programming Guide.

Availability
  • Available in iOS 4.0 and later.
Declared In
CTCallCenter.h

currentCalls

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

@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.

Availability
  • Available in iOS 4.0 and later.
Declared In
CTCallCenter.h