Retrieve Call Charge Tutorial

This tutorial describes how to retrieve a call charge information from the network using the GSM Advice of Charge supplementary service.

Call cost retrieval example

The following code declares a class that has functions to get the charging information, and to return the value in real monetary units of the current call, accumulated charge, and maximum charge.

class TCostCalculator
    // Initialise cost info
    void InitialiseL(RMobilePhone& aMobilePhone);

    // Gets current call cost
    TReal CurrentCallCost() {
        return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iCCM; }

    // Gets accumulated call cost
    TReal AccumulatedCallCost() {
        return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iACM; }

    // Gets maximum current call cost
    TReal MaximumCurrentCallCost() {
        return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iACMmax; }

    RMobilePhone::TMobilePhoneCostInfoV1 iCostInfo;

// Initialise cost info
void TCostCalculator::InitialiseL(RMobilePhone& aMobilePhone)
    RMobilePhone::TMobilePhoneCostInfoV1Pckg costInfoPckg(iCostInfo);
    TRequestStatus status;