How to hold a call
Article Metadata
To hold a call we can use CTelephony::Hold(). Pass the call ID to CTelephony::Hold(). The ID is the CTelephony::TCallId returned when you dialled or answered the call.
- Libraries Needed: Etel3rdParty.lib and euser.lib
- Asynchronous call
Since, this is done using an asynchronous call, one can cancel this using CTelephony::EHoldCancel.
#include <e32base.h>
#include <Etel3rdParty.h>
class CClientApp : public CActive
{
private:
CTelephony* iTelephony;
CTelephony::TCallId iCallId;
public:
CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId);
TInt HoldCall();
private:
void RunL();
void DoCancel();
};
CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId)
: CActive(EPriorityStandard),
iTelephony(aTelephony),
iCallId(aCallId)
{
//Constructor
}
TInt CClientApp::HoldCall()
{
//Check that the phone supports holding calls.
CTelephony::TCallCapsV1 callCapsV1;
CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
iTelephony->GetCallDynamicCaps(iCallId, callCapsV1Pckg);
if( callCapsV1.iControlCaps & CTelephony::KCapsHold )
{
//The call represented by 'iCallId' can be put on hold
iTelephony->Hold(iStatus, iCallId);
SetActive();
return KErrNone;
}
else
{
//The call cannot be put on hold;
//Return an error indicate this.
return KErrNotSupported;
}
}
void CClientApp::RunL()
{
if(iStatus==KErrNone)
{
//The call has been held successfully;
}
}
void CClientApp::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EHoldCancel);
}
Wiki Internal Links

