Dial a Call Tutorial

This tutorial describes how to dial a call with the telephony API for applications.

Steps

  1. create a new instance of [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony
  2. dial a call with [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::DialNewCall() pass the number to dial in a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::TTelNumber.CTelephony::DialNewCall() returns a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::TCallId that identifies the call. This will be either [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EISVCall1 or [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EISVCall2. You need this ID to place a call on hold and terminate a call.
  3. pass [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::DialNewCall() a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::TCallParamsV1 object to specify an option for your identity. You have three options:
    1. hide your identity
    2. display your identity
    3. use default setting
  4. pass the enumeration [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EDialNewCallCancel to cancel the dial request.

Dial a call example

This example dials the number 123456789 and allows the remote party to see the phone's number:

#include <e32base.h>
#include <Etel3rdParty.h>

_LIT(KTheNumber, "123456789");

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TCallId iCallId;

public:
    CClientApp(CTelephony* aTelephony);
    void SomeFunction();

private:
    /*
       These are the pure virtual methods from CActive that  
       MUST be implemented by all active objects
       */
    void RunL();
    void DoCancel();
   };

CClientApp::CClientApp(CTelephony* aTelephony)
    : CActive(EPriorityStandard),
      iTelephony(aTelephony)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    CTelephony::TTelNumber telNumber(KTheNumber);

    CTelephony::TCallParamsV1 callParams;
    callParams.iIdRestrict = CTelephony::ESendMyId;
    CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);

    iTelephony->DialNewCall(iStatus, callParamsPckg, telNumber, iCallId);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {} // The call has been dialled successfully;
          // iCallId contains the call's ID, needed when controlling the call.
    }

void CClientApp::DoCancel()
    {
    iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);
    }

Next actions

This describes how to dial a second call while another is in progress.

  1. Put the first call on hold.

    For more information. See Call Hold Tutorial.

    If the first call was not dialled or answered by you then you cannot control it, and so you cannot put it on hold. If it is not on hold already then you will have to wait until the it is put on hold. The Voice line status changes to [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EStatusHold.

  2. Dial the second call.

    This is the same as dialling a call in the Dial a Call Tutorial. [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::AnswerIncomingCall() will return a different call ID to the first call.

    Remember that to dial a call is an asynchronous operation.

  3. If the operation fails, remember to resume the first call, see Call Resume Tutorial.

As a result, the first call is on hold, and the phone user is connected to the second caller.