Call Status and Call Control Tutorial

This tutorial describes how to manipulate the call status and control call information.

The two diagrams below show the call state transitions for:

  • outbound calls or Mobile Originated (MO) calls

  • inbound calls or Mobile Terminated (MT) calls

Figure 1. MO call state diagram
Figure 2. MT call state diagram

RMobileCall provides the functions to manipulate and control call actions.

The high level steps to use the call control information are:

  1. Use RMobileCall::GetMobileCallCaps() to get the dynamic call control and call event capabilities. The call control capabilities are dynamic and can change with the status of the active call and calls. The capabilities also depend on the network and the subscription of the user.
  2. Use RMobileCall::NotifyMobileCallCapsChange() to get the notification of the capability changes.
  3. Use RMobileCall::GetMobileCallStatus() to get the call status.
  4. Use RMobileCall::NotifyMobileCallStatusChange() to get the notification of call status changes.
  5. Use RMobileCall::NotifyCallEvent() to get the notification of call events.
  6. Use RMobileCall::Hold() to put a call on hold.
  7. Use RMobileCall::Resume() to resume a call from hold.
  8. Use RMobileCall::Swap() to swap between a call on hold and an active call.
  9. Use RMobileCall::Deflect() to divert an incoming call to another destination.
  10. Use RMobileCall::Transfer() to transfer a call to another user.
  11. Use RMobileCall::GoOneToOne() to transfer the call to one user of a conference call.

Call control example

The following code declares an enumeration that lists the various call control commands, and provides a switch function that carries out the specified command.

/// Call control commands
enum TCallControlCommand
    {
    EPutOnHold,            // Put call on hold
    EResumeHeld,        // Resume on hold call
    ESwapHoldAndOngoing,// Swap an on-hold and an ongoing call
    EDeflectIncoming,    // Redirect an incoming call
    ETransferToRemote,    // Transfer one call to remote party of another call
    EConferenceOneToOne // Go "one-to-one" within a conference call
    };

// Execute a call control command
void CClientApp::CallControlL(RMobileCall& aCall, TCallControlCommand aCommand, TRequestStatus& aStatus)
    {

    // Get call capabilities to check can execute command
    RMobileCall::TMobileCallCapsV1 callCaps;
    RMobileCall::TMobileCallCapsV1Pckg callCapsPckg(callCaps);
    
    User::LeaveIfError(aCall.GetMobileCallCaps(callCapsPckg));

    switch (aCommand)
        {
        case EPutOnHold:
            if (callCaps.iCallControlCaps & RMobileCall::KCapsHold)
             {
                aCall.Hold(aStatus);
             } 
        break;
     
        case EResumeHeld:
             if (callCaps.iCallControlCaps & RMobileCall::KCapsResume)
            {
                aCall.Resume(aStatus);
            }
        break;
     
        case ESwapHoldAndOngoing:
            if (callCaps.iCallControlCaps & RMobileCall::KCapsSwap)
            {
                aCall.Swap(aStatus);
            }    
        break;
     
        case EDeflectIncoming:
            if (callCaps.iCallControlCaps & RMobileCall::KCapsDeflect)
            {
                aCall.Deflect(aStatus, RMobileCall::EDeflectRegisteredNumber, RMobilePhone::TMobileAddress());
            }    
        break;
     
        case ETransferToRemote:
            if (callCaps.iCallControlCaps & RMobileCall::KCapsTransfer)
            {
                aCall.Transfer(aStatus);
            }
        break;
     
        case EConferenceOneToOne:
            if (callCaps.iCallControlCaps & RMobileCall::KCapsOneToOne)
            {
                aCall.GoOneToOne(aStatus);
            }
        break;
     
        default:
        break;
        };
    };