×
Namespaces

Variants
Actions

Archived:Voice call recorder in Symbian C++

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}}.

Article Metadata
Code ExampleCompatibility
Platform(s):
S60 3rd Edition FP1
Article
Created: mahbub_s60 (01 Apr 2009)
Last edited: hamishwillee (19 Jun 2012)


Introduction

This article describes how we can record a voice call automatically by 3rd party application. When ever we receive a phone call then there are state change in CTelephony class. If we monitor the state and when the state is changed is detected to CTelephony::EStatusConnected then we can start recording (for example). When the state is changed to CTelephony::EStatusDisconnecting then we can stop recording. Following code example shows how to do this.

// We get a notification from telephony subsytem.
void CHelloWorldBasicAppUi::CallStatusChangedL(CTelephony::TCallStatus& aStatus, TInt aError)
{
if(aError != KErrNone) // Some thing wrong, we should handle though this example doesn't
{
return;
}
switch(aStatus)
{
case CTelephony::EStatusConnected:
{
//Recording start by HandleCommandL() method
HandleCommandL(EProgCmdRecord);
}
break;
case CTelephony::EStatusDisconnecting:
case CTelephony::EStatusHold:
{
//Recording stop by HandleCommandL() method
HandleCommandL(EProgCmdStop);
}
break;
default:
break;
}
}

Call status is updated to the previous class by the following code.

void CCallMonitor::RunL()
{
iCallBack.CallStatusChangedL(iCurrentStatus.iStatus, iStatus.Int());
StartListening();
}
 
void CCallMonitor::StartListening()
{
Cancel();
iCurrentStatus.iStatus = CTelephony::EStatusUnknown;
iTelephony->NotifyChange(iStatus,CTelephony::EVoiceLineStatusChange,iCurrentStatusPckg);
SetActive();
}

We need to create CMdaAudioRecorderUtility class with a priority and preferences as shown by the following code.

#define KAudioPriority 80
#define KAudioPreference 0x00060001
 
iRecorderUtility = CMdaAudioRecorderUtility::NewL(
*this,
NULL,
KAudioPriority,
(TMdaPriorityPreference)KAudioPreference);

Example Applications

When we receive a call the call is automatically recorded to a file. That file can be played with a player. The application is tested with N95 8GB, complete source code can be found here: File:CallAudioRecord 31.zip

This page was last modified on 19 June 2012, at 10:59.
88 page views in the last 30 days.