For a long time there has been this issue about retrieving the dialed number in UIQ devices. There have been numerous posts about the same where developers have complained about getting empty values when they query the number being dialed in the current call.
So here is the code for getting the dialed number of the present call. This blocking version of the code is only for the article. I have provided both the blocking/non-blocking versions in the demo application.
Only the non-blocking version seems to run on the phone.
The code as such is self explanatory .
void CExampleAppUi::GetRemotePartyNumber()
{
TApaTaskList iTaskList(CEikonEnv::Static()->WsSession());
const TUid KUiduiqCall = { 0x101F6163 };
TApaTask iThisTask = iTaskList.FindApp(KUiduiqCall);
RAdvGsmPhone iPhone;
RTelServer iServer;
RTelServer::TPhoneInfo iPhoneInfo;
RPhone::TLineInfo iLineInfo;
RCall::TStatus iCallStatus;
RAdvGsmCall iCall;
RLine iLine;
TRequestStatus iStatus;
iServer.Connect();
iServer.LoadPhoneModule( KGsmModuleName );
TInt enumphone;
User::LeaveIfError(iServer.EnumeratePhones(enumphone));
if (enumphone < 1) {
User::Leave(KErrNotFound);
}
//Initialise the phone object
User::LeaveIfError(iServer.GetPhoneInfo(0, iPhoneInfo));
User::LeaveIfError(iPhone.Open(iServer, iPhoneInfo.iName));
User::LeaveIfError(iPhone.GetLineInfo(0,iLineInfo));
User::LeaveIfError(iLine.Open(iPhone,iLineInfo.iName));
iStatus = KRequestPending;
//first send the app to the background
iThisTask.SendToBackground();
iLine.NotifyStatusChange(iStatus, iCallStatus);
User::WaitForRequest(iStatus);
if(iStatus.Int()==KErrNone){
switch(iCallStatus){
case RCall::EStatusDialling :
{
//come to the foreground
iThisTask.BringToForeground();
//now get the number of the present call
RLine::TLineInfo lineInfo;
iLine.GetInfo(lineInfo);
iCall.OpenExistingCall(iLine, lineInfo.iNameOfLastCallAdded);
TBuf<20> myDialedNumber;
TBuf<20> myRemoteNumber;
RAdvGsmCall::TDialledNumberInfo myDialedNumberInfo;
RAdvGsmCall::TRemotePartyInfo myRemoteNumberInfo;
iCall.GetDialledNumberInfo(myDialedNumberInfo);
iCall.GetRemotePartyInfo(myRemoteNumberInfo);
myDialedNumber = myDialedNumberInfo.iNumber.iTelNumber;
myRemoteNumber = myRemoteNumberInfo.iNumber.iTelNumber;
iCall.HangUp();
CEikonEnv::InfoWinL(_L("Dialed number : "),myDialedNumber);
CEikonEnv::InfoWinL(_L("Remote party number : "),myRemoteNumber);
}
break;
}
}
//cleanup stuff ,close all sessions
iCall.Close();
iLine.Close();
iPhone.Close();
iServer.UnloadPhoneModule(KGsmModuleName);
iServer.Close();
}
Also please do READ the readme.txt provided with the demo application as it has directions about the files which you need to compile the demo application.
Lastly , I would like to thank Tomer Egozi for helping me.
Demo + Source
This zip contains a small demo with its source code.
Please post all the queries regarding this issue on the forum.
|