×
Namespaces

Variants
Actions

How to detect remote party terminating a call

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: polaka_sr (30 Dec 2007)
Last edited: hamishwillee (26 Jul 2012)

CTelephony::NotifyChange() is used to detect changes in the voice line's status.This starts an asynchronous operation that completes when the calls's status changes. The call's new status is written into the CTelephony::TCallStatusV1Pckg.

CTelephony represents the status of your calls with a CTelephony::TCallStatus. Possible status values include Idle, Ringing, On-Hold etc:

  • When a call's status changes from CTelephony::EStatusConnected to CTelephony::EStatusIdle then the call has terminated.
  • When a call's status changes from CTelephony::EStatusHold to CTelephony::EStatusIdle then the call has terminated.
  • Asynchronous call


Libraries Needed:

LIBRARY Etel3rdParty.lib and euser.lib


#include <e32base.h>
#include <Etel3rdParty.h>
 
class CClientApp : public CActive
{
 
private:
CTelephony* iTelephony;
CTelephony::TCallId iCallId;
CTelephony::TCallStatusV1 iCallStatusV1;
CTelephony::TCallStatusV1Pckg iCallStatusV1Pckg;
CTelephony::TNotificationEvent iEvent;
 
public:
CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId);
TInt DetectRemoteTerminate();
 
private:
void RunL();
void DoCancel();
};
 
CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId)
: CActive(EPriorityStandard),
iTelephony(aTelephony),
iCallId(aCallId),
iCallStatusV1Pckg(iCallStatusV1)
{
//Constructor
}
 
TInt CClientApp::DetectRemoteTerminate()
{
switch(iCallId)
{
case CTelephony::EISVCall1:
iEvent = CTelephony::EOwnedCall1StatusChange;
break;
 
case CTelephony::EISVCall2:
iEvent = CTelephony::EOwnedCall2StatusChange;
break;
 
default:
//We haven't given a valid call ID here, so return an error
return KErrArgument;
}
 
iTelephony->NotifyChange(iStatus, iEvent, iCallStatusV1Pckg);
SetActive();
return KErrNone;
}
 
void CClientApp::RunL()
{
if(iStatus==KErrNone)
{
//The status of the call has changed.
if(iCallStatusV1.iStatus == CTelephony::EStatusIdle)
{
//The call has been terminated.
}
else
{
//The call has not yet been terminated, so request notification again
iTelephony->NotifyChange(iStatus, iEvent, iCallStatusV1Pckg);
SetActive();
}
}
}
 
void CClientApp::DoCancel()
{
CTelephony::TCancellationRequest cancelRequest;
if(iCallId == CTelephony::EISVCall1)
{
cancelRequest = CTelephony::EOwnedCall1StatusChangeCancel;
}
else //iCallId == CTelephony::EISVCall2
{
cancelRequest = CTelephony::EOwnedCall2StatusChangeCancel;
}
iTelephony->CancelAsync(cancelRequest);
}





Wiki Internal Links


This page was last modified on 26 July 2012, at 06:09.
37 page views in the last 30 days.
×