This state diagram shows how to dial or answer one call at a time. It presumes there are no other calls being made by any other code.
The boxes are states. The 'E...' value in each box is the status of the phone's voice line. Voice line status describes these states and their meaning. You can also find the status of individual calls. However, when only one call is in progress then the line state and the call state are the same.
The arrows show events that trigger a change of state. In these
events, a word in bold indicates a CTelephony
method that you can call.
To dial or answer a call:
Check for other calls by getting the Voice line status.
If the line is Idle
(CTelephony::EStatusIdle
) then no calls are in
progress
If the line is on hold
(CTelephony::EStatusHold
) then there is another call in
progress, but it is on hold and you can still dial or answer a second call; see
Handling Two Calls at once
Otherwise, another call is active: you must wait until it finishes before you can dial or receive a call. To detect when this occurs, see the example in How to get notification when information changes
Dialling a call
While no calls are in progress, the line's status is
CTelephony::EStatusIdle
. To dial a call, use
CTelephony::DialNewCall()
; see
Dial a call. If dialling was
successful and the remotes party answers the call then the line's status will
become CTelephony::EStatusConnected
.
Answering a call
While no calls are in progress, the line's status is
CTelephony::EStatusIdle
. When a remote party calls your
phone, the voice line's status will change to
CTelephony::EStatusRinging
.
Detect an incoming call
describes how to detect this change.
When the status is CTelephony::EStatusRinging
, use
CTelephony::AnswerIncomingCall()
to answer the call. The
status will change to CTelephony::EStatusConnected
and the
phone user can talk to the remote party.
What next?
You now have several options. They are the same for both answered calls and calls you dial yourself:
Find out about the call and the call; see Detailed line and call information and Remote party information
When you successfully dial or answer a call, you will be given a
CTelephony::TCallId
the identifies the call. You must keep
this safe - it is needed to perform each of the opeations above.
At some point, a remote party might try to ring your phone. The
voice line state will change to
CTelephony::EStatusRinging
. You can ignore this call; you
can still terminate, hold, resume and send DTMF.