|
||
This state diagram shows how to dial or answer one or two calls at a time. It presume that no other code is making any calls; only you are making calls.
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; see Status of voice calls you own
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. Now
go to point four below
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?
When you successfully dial or answer a call, you will be given a
CTelephony::TCallId
the identifies the call. You must keep
this safe. To control your call (hang-up, hold, resume etc) you call
CTelephony
methods. Each method must be passed the ID of a call to
operate on.
Once a call is connected you have a number of options. You can perform these operations on your call. They are the same as those in Handling one call at a time:
Find out about the call and the call; see Detailed line and call information and Remote party information
In addition, you can dial or answer a second call:
At some point, a remote party might try to ring your phone. It is answered in the same way as the first.
The voice line state will change to
CTelephony::EStatusRinging
. You can receive notification
when this occurs; see Detect an incoming call. Before answering the second call, you must
put the original call on hold. This is shown in the diagram above.
You can also dial a second call in the same way as the first. Once again, you must put your original call on hold before dialling the second call.
A CTelephony::TCallId
will be given to you
when you successfully connect a second call. You will also have a
CTelephony::TCallId
from the first call. Now you will be the owner
of two calls: at any one time, one will always be active and one
will always be on hold.
Now you can:
Terminate either call. If you terminate the active call then you will be left with a call on hold. If you terminate the on-hold call then you will be left with an active call.
Detect remote party terminating either call. Once again, if the active call ends then you will be left with a call on hold and vice versa.
Find out about the call and the call; see Detailed line and call information and Remote party information