×
Namespaces

Variants
Actions

Disconnecting a voice call with CTelephony

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition
S60 5th Edition
Article
Keywords: CTelephony, TCallId
Created: tepaa (29 Apr 2009)
Last edited: lpvalente (25 May 2014)

Contents

Overview

This snippet demonstrates how to make a voice call with CTelephony::DialNewCall() and then disconnect the call using CTelephony::Hangup() from etel3rdparty.lib. Note that you can only disconnect calls that have been initiated by your application using the Telephony ISV API (CTelephony).


MMP file

The following libraries and capabilities are required:

CAPABILITY NetworkServices
LIBRARY etel3rdparty.lib // Telephony ISV API


Header

#include <Etel3rdParty.h> // Telephony ISV API
 
class CYourCall : public CActive
{
public:
CYourCall();
virtual ~CYourCall();
void ConstructL();
void HangUpL();
void Dial(const TDesC& aNumber);
 
protected:
void DoCancel();
void RunL();
 
private:
// Telephony ISV API
CTelephony* iTelephony;
CTelephony::TCallId iCallId;
TBool iHangedUp;
};


Source

CYourCall::CYourCall()
:CActive(CActive::EPriorityStandard)
{
}
 
CYourCall::~CYourCall()
{
Cancel();
 
delete iTelephony;
}
 
void CYourCall::ConstructL(void)
{
CActiveScheduler::Add(this);
iTelephony = CTelephony::NewL();
}
 
void CYourCall::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);
}
 
 
void CYourCall::RunL()
{
if (iStatus.Int()==KErrNone && !iHangedUp)
HangUpL();
}
 
void CYourCall::Dial(const TDesC& aNumber)
{
// Dial new call with given number
CTelephony::TTelNumber telNumber(aNumber);
 
CTelephony::TCallParamsV1 callParams;
callParams.iIdRestrict = CTelephony::ESendMyId;
CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);
 
iTelephony->DialNewCall(iStatus, callParamsPckg, telNumber, iCallId);
SetActive();
}
 
void CYourCall::HangUpL()
{
if (IsActive())
return;
 
// Hang up call right after CTelephony::DialNewCall() is completed
iHangedUp = ETrue;
iTelephony->Hangup(iStatus,iCallId);
SetActive();
}


How to use

iCallMonitor = new (ELeave) CYourCall();
CleanupStack::PushL(iCallMonitor);
iCallMonitor->ConstructL();
CleanupStack::Pop();
 
iCallMonitor->Dial(_L("05012345678"));


Postconditions

The call is connected and then disconnected.


See also

This page was last modified on 25 May 2014, at 17:22.
112 page views in the last 30 days.
×