Call Barring Status

This tutorial describes how to get the call barring status information with the telephony API for applications

Context

The call barring is a supplementary service. The client applications can determine the status of the service with the CTelephony functions.

Steps

  1. create a new instance of CTelephony
  2. use CTelephony::GetCallBarringStatus() to get the supplementary services status information. pass a TCallBarringCondition object.
  3. cancel the request with CTelephony::EGetCallBarringStatusCancel enumeration.

Call barring example

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

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TCallBarringSupplServicesV1 iCallBarringSupplServicesV1;
    CTelephony::TCallBarringSupplServicesV1Pckg iCallBarringSupplServicesV1Pckg;

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

void CClientApp::SomeFunction()
    {
    CTelephony::TCallBarringCondition condition = CTelephony::EBarAllOutgoing;
    iTelephony->GetCallBarringStatus(iStatus, condition, iCallBarringSupplServicesV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       if( iCallBarringSupplServicesV1.iCallBarring == CTelephony::EStatusActive )
          {} // The call barring condition is active; 
             // all outgoing calls are barred.
       }
    }

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