Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:08, 20 June 2008.

Get Caller Number

From Forum Nokia Wiki

Below is the code illustarating how to get the remote party's telephone number. It is different for S60 3rd Edition and previous versions.

Pre S60 3rd Edition

#include <etelmm.h>
 
void GetRemotePartyPhoneNumberL(TDes& aPhoneNumber)
{
	RTelServer etel;
 
	// Connect to ETel server
	User::LeaveIfError(etel.Connect());
	CleanupClosePushL(etel);
 
	// Load phone module. This is just to be on the safe side
	// because it should have been loaded already
	_LIT(KTsyName, "phonetsy.tsy");
	User::LeaveIfError(etel.LoadPhoneModule(KTsyName));
 
	RTelServer::TPhoneInfo phoneInfo;
 
	// Get phone info. We need phone's name to open a phone
	const TInt KPhoneIndex = 0;
	User::LeaveIfError(etel.GetPhoneInfo(KPhoneIndex, phoneInfo));
 
	RPhone phone;
 
	// Open the phone
	User::LeaveIfError(phone.Open(etel, phoneInfo.iName));
	CleanupClosePushL(phone);
 
	RPhone::TLineInfo lineInfo;
 
	// Get line info. We need line's name to open it
	const TInt KLineIndex = 0;
	User::LeaveIfError(phone.GetLineInfo(KLineIndex, lineInfo));
 
	RLine line;
 
	// Open the line
	User::LeaveIfError(line.Open(phone, lineInfo.iName));
	CleanupClosePushL(line);
 
	RLine::TCallInfo callInfo;
 
	// Get call info. We need call's name to open it and get the info we need
	const TInt KCallIndex = 0;
	User::LeaveIfError(line.GetCallInfo(KCallIndex, callInfo));
 
	RMobileCall call;
 
	// Open the call
	User::LeaveIfError(call.OpenExistingCall(line, callInfo.iCallName));
	CleanupClosePushL(call);
 
	RMobileCall::TMobileCallInfoV1 mobCallInfo;
	RMobileCall::TMobileCallInfoV1Pckg mobCallInfoPckg(mobCallInfo);
 
	// Get the call's info
	User::LeaveIfError(call.GetMobileCallInfo(mobCallInfoPckg));
 
	// We successfully got the call's info.
	// Now copy the remote party's phone number to the target descriptor
	aPhoneNumber.Copy(mobCallInfoPckg().iRemoteParty.iRemoteNumber.iTelNumber);
 
	// Close all handles
	CleanupStack::PopAndDestroy(4); // call, line, phone, etel
}

For S60 3rd edition

S60 3rd Edition

void GetRemotePartyPhoneNumberL(TDes& aPhoneNumber)
{
	// Create a CTelephony object
	CTelephony* telephony = CTelephony::NewLC();
 
	CTelephony::TCallInfoV1 callInfoV1;
	CTelephony::TCallInfoV1Pckg callInfoV1Pckg(callInfoV1);
 
	CTelephony::TCallSelectionV1 callSelectionV1;
	CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg(callSelectionV1);
 
	CTelephony::TRemotePartyInfoV1 remotePartyInfoV1;
	CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg(remotePartyInfoV1);
 
	callSelectionV1.iLine = CTelephony::EVoiceLine;
	callSelectionV1.iSelect = CTelephony::EInProgressCall;
 
	// Get the call info
	User::LeaveIfError(telephony->GetCallInfo(callSelectionV1Pckg,
		callInfoV1Pckg, remotePartyInfoV1Pckg));
	// Copy the remote party's phone number to the target descriptor
	aPhoneNumber.Copy(remotePartyInfoV1Pckg().iRemoteNumber.iTelNumber);
 
	CleanupStack::PopAndDestroy(); // telephony
}
Related Discussions
Thread Thread Starter Forum Replies Last Post
Retrieve MSISDN binubabykurian Symbian Networking & Messaging 6 2006-01-12 18:24
How to get phone number from active incoming call? cars2003 General Symbian C++ 0 2004-04-17 03:01
Foreground when there is an incoming call Shaikuny Symbian User Interface 6 2005-09-01 12:36
Problem in trying to connect to Incoming Call Rajagopalan General Symbian C++ 10 2004-09-10 05:29
When do you declare a parameter type of HBufC*& ? Potassium General Symbian C++ 4 2006-07-17 19:15
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX