Caller Identification Status Tutorial

This tutorial describes how to get the caller identification status information with the telephony API for applications.

Context

The caller identification service is available only on GSM and WCDMA networks.

The steps to get the caller identification status information are:

Steps

  1. create a new instance of CTelephony
  2. call CTelephony::GetIdentityServiceStatus() to get the caller identification service status information Pass a TIdentityService object with EIdServiceCallerPresentation
  3. pass a TIdentityService object with EIdServiceCallerRestriction to with hold the number
  4. pass the enumerationEGetIdentityServiceStatusCancel to the to cancel the asynchronous request.

Caller identification status example

Example code to get the caller identification status.

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

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TIdentityServiceV1 iTIdentityServiceV1;
    CTelephony::TIdentityServiceV1Pckg iTIdentityServiceV1Pckg;

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),
      iTIdentityServiceV1Pckg(iTIdentityServiceV1)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    CTelephony::TIdentityService condition = CTelephony::EIdServiceCallerPresentation;
    iTelephony->GetIdentityServiceStatus(iStatus, condition, iTIdentityServiceV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       if( iTIdentityServiceV1.iIdentityStatus == CTelephony::EIdServiceActivePermanent )
          {} // CLIP is permanently active; 
             // Your phone will display the callers number whenever this is allowed by the caller
       }
    }

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