Getting Incomming Caller Number
Hello guys, I'm new and I want to make a simple application which retrieve an Incomming Caller Number and vizualize it when I press an option in a app menu. I'm using Nokia C5_00 and Symbian S60 3.2. I found som codes, but I don't know where exactly to implement them in Carbide C++. My base application is Hello World. The one code is :
[CODE]
TBuf<100> CallerNumber; if(iCurrentStatus.iStatus == CTelephony::EStatusRinging|| iCurrentStatus.iStatus == CTelephony::EStatusDialling)
{ CTelephony::TRemotePartyInfoV1 RemInfoUse;
CTelephony::TCallInfoV1 CallInfoUse;
CTelephony::TCallSelectionV1 CallSelectionUse;
CallSelectionUse.iLine = CTelephony::EVoiceLine;
CallSelectionUse.iSelect = CTelephony::EInProgressCall;
CTelephony::TRemotePartyInfoV1Pckg RemParty(RemInfoUse);
CTelephony::TCallInfoV1Pckg CallInfo(CallInfoUse);
CTelephony::TCallSelectionV1Pckg CallSelection(CallSelectionUse);
iTelephony->GetCallInfo(CallSelection,CallInfo,RemParty);
if(iCurrentStatus.iStatus == CTelephony::EStatusRinging)
{
CallerNumber.Copy(RemInfoUse.iRemoteNumber.iTelNumber);
}
else if(iCurrentStatus.iStatus == CTelephony::EStatusDialling)
{
CallerNumber.Copy(CallInfoUse.iDialledParty.iTelNumber);
}
}
[/CODE]
The Other is :
[CODE]
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}
[/CODE]
I Want to vizualize the content of "CallerNumber" in the first code or on "aPhoneNumber" in the second code.
Thank you very much and excuse me for bad English.
Re: Getting Incomming Caller Number
The following wiki link contains a running project attached to it, so you can give it a try :
[url]http://www.developer.nokia.com/Community/Wiki/Getting_call_number_with_CTelephony[/url]
Re: Getting Incomming Caller Number
I try that today, it gives me a many errors. Some of them I removed. But there is one that I Can't.
On Every case in the function there is a red X in front of it and it says [COLOR="#FF0000"]"The message is tihs no matching function for call to `CRetrieveNumber::WriteToFile(TPtrC8)' "[/COLOR]
The code is this :
[CODE]
void CRetrieveNumber::RunL()
{
if(iStatus==KErrNone)
{
CTelephony::TCallStatus status = iCallStatus.iStatus;
switch ( status )
{
case CTelephony::EStatusRinging:
{
WriteToFile(_L8("EStatusRinging\n "));
iCallSelectionUse.iLine = CTelephony::EVoiceLine;
iCallSelectionUse.iSelect = CTelephony::EInProgressCall;
iTelephony->GetCallInfo(iCallSelection,iCallInfo,iRemParty);
TBuf8<100> CallerNumber;
CallerNumber.Copy(iRemInfoUse.iRemoteNumber.iTelNumber);
WriteToFile(CallerNumber);
}
break;
case CTelephony::EStatusConnected :
{
WriteToFile(_L8("EStatusConnected\n "));
}
break;
case CTelephony::EStatusAnswering :
{
WriteToFile(_L8("EStatusAnswering\n "));
}
break;
case CTelephony::EStatusDialling:
{
WriteToFile(_L8("EStatusDialling\n "));
}
break;
case CTelephony::EStatusDisconnecting:
{
WriteToFile(_L8("EStatusDisconnecting\n "));
}
break;
case CTelephony::EStatusConnecting:
{
WriteToFile(_L8("EStatusConnecting\n "));
}
break;
case CTelephony::EStatusUnknown:
{
WriteToFile(_L8("EStatusUnknown\n "));
}
break;
case CTelephony::EStatusIdle:
{
WriteToFile(_L8("EStatusIdle\n "));
}
break;
case CTelephony::EStatusReconnectPending:
{
WriteToFile(_L8("EStatusReconnectPending\n "));
}
break;
case CTelephony::EStatusHold:
{
WriteToFile(_L8("EStatusHold\n "));
}
break;
case CTelephony::EStatusTransferring:
{
WriteToFile(_L8("EStatusTransferring\n "));
}
break;
case CTelephony::EStatusTransferAlerting:
{
WriteToFile(_L8("EStatusTransferAlerting\n "));
}
break;
}
iTelephony->NotifyChange( iStatus,
CTelephony::EVoiceLineStatusChange,
iCallStatusPkg );
SetActive();
}
else
{
CEikonEnv::Static()->InfoWinL(_L("Error in:"), _L("status"));
}
}
TInt CRetrieveNumber::RunError( TInt aError )
{
return aError;
}
[/CODE]
[COLOR="#FF0000"]The Function is This[/COLOR]
[CODE]
void CRetrieveNumber::WriteToFile(TDesC8& aContent8)
{
_LIT(KFileSpec,"C:\\Nokia\\LogsTelephony.txt");
TInt iPos=0;
RFs iFs;
User::LeaveIfError(iFs.Connect());
RFile iFile;
TInt err = iFile.Open(iFs, KFileSpec, EFileShareExclusive|EFileStreamText|EFileWrite);
if(err!= KErrNone)
{
if (iFile.Create(iFs, KFileSpec, EFileShareExclusive|EFileStreamText|EFileWrite) != KErrNone)
{
err = iFile.Open(iFs, KFileSpec, EFileShareExclusive|EFileStreamText|EFileWrite);
}
}
err =iFile.Seek(ESeekEnd,iPos);
if (err != KErrNone)
{
TBuf<10> errBuf;
errBuf.AppendNum(err);
CEikonEnv::InfoWinL(_L("Seek Unsuccessful"), errBuf);
}
err = iFile.Write(aContent8);
iFile.Flush();
if (err != KErrNone)
{
TBuf<10> errBuf;
errBuf.AppendNum(err);
CEikonEnv::InfoWinL(_L("Write Unsuccessful"), errBuf);
}
iFile.Close();
iFs.Close();
}
[/CODE]
Re: Getting Incomming Caller Number
It may behave better if you take const references in the method:[CODE]void CRetrieveNumber::WriteToFile([COLOR="#FF0000"]const [/COLOR]TDesC8& aContent8)[/CODE]
Re: Getting Incomming Caller Number
Yes, that worked and no errors now, but nothing happend. I call from other phone and nothing. The program is open and it must write som file, but no file.
P.S. What is this file "aknappui.dso" And where can I find it?
Re: Getting Incomming Caller Number
[QUOTE=fukatoki;910852]Yes, that worked and no errors now, but nothing happend. I call from other phone and nothing. The program is open and it must write som file, but no file.[/QUOTE]How have you checked? Note that the built-in File Manager shows c:\Data as "Phone Memory". c:\Nokia applied to really old devices only.[QUOTE]P.S. What is this file "aknappui.dso" And where can I find it?[/QUOTE].dso files are the stub libraries for .dll-s (which are using the same concept as in other operating systems [url]http://en.wikipedia.org/wiki/Dynamic-link_library[/url])
Based on the name aknappui.dso could implement mostly the CAknAppUi class, however I do not think that there would be a separate .dll/dso for this class. CAknAppUi itself is certainly used by any GUI application, it is the class managing the lifecycle of your application, startup, close, handling menu commands, initializing the controls/views.
.dso files in general are located in epoc32\release\armv5\lib folder of your SDK.
Re: Getting Incomming Caller Number
Thank you, wizard! Tomorrow I'll try to rebuild my application with the corrections. Thank's again for the help.
Re: Getting Incomming Caller Number
Hello, I'm trying to build my application, but it found an error that says [COLOR="#FF0000"]"\S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\ARMV5\LIB\aknappui.dso: No such file: No such file or directory"[/COLOR]. How can I pass it?
The Console shows me this:
[COLOR="#FF0000"]***Invoking abld command
perl.exe -S ABLD.PL \Symbian\Carbide\workspace\helloworldbasic\group\ target gcce udeb
make -r -f "\S60\devices\S60_3rd_FP2_SDK_v1.1\EPOC32\BUILD\Symbian\Carbide\workspace\helloworldbasic\group\GCCE.make" TARGET CFG=UDEB VERBOSE=-s
arm-none-symbianelf-ld: \S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\ARMV5\LIB\aknappui.dso: No such file: No such file or directory
make[1]: *** [\S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\GCCE\udeb\helloworldbasic_0xEADABAD1.exe] Error 1
make: *** [TARGETHELLOWORLDBASIC] Error 2
make -j 4 -s -C \Symbian\Carbide\workspace\helloworldbasic\group -f "ICONS_SCALABLE_DC.MK" TO_ROOT=..\..\..\..\.. EPOCBLD=..\..\..\..\..\S60\devices\S60_3rd_FP2_SDK_v1.1\EPOC32\BUILD\Symbian\Carbide\workspace\helloworldbasic\group\ICONS_SCALABLE_DC\GCCE TO_BLDINF=..\..\..\..\..\Symbian\Carbide\workspace\helloworldbasic\group PLATFORM=GCCE CFG=UDEB BLD
make -j 4 -s -C \Symbian\Carbide\workspace\helloworldbasic\HELP -f "BUILD_HELP.MK" TO_ROOT=..\..\..\..\.. EPOCBLD=..\..\..\..\..\S60\devices\S60_3rd_FP2_SDK_v1.1\EPOC32\BUILD\Symbian\Carbide\workspace\helloworldbasic\group\BUILD_HELP\GCCE TO_BLDINF=..\..\..\..\..\Symbian\Carbide\workspace\helloworldbasic\group PLATFORM=GCCE CFG=UDEB BLD
make -j 4 -s -r -f "\S60\devices\S60_3rd_FP2_SDK_v1.1\EPOC32\BUILD\Symbian\Carbide\workspace\helloworldbasic\group\HELLOWORLDBASIC\GCCE\HELLOWORLDBASIC.GCCE" UDEB[/COLOR]
Re: Getting Incomming Caller Number
I really doubt that such file would exist, so from this point of view the message is correct.
The question is why it is trying to access this file?
Have you perhaps edited the .mmp file of this project? In its current form it may contain a reference to aknappui.lib in one of its LIBRARY lines. That reference should be removed.
You can refer to HelloWorldBasic example in the SDK, and its .mmp file.
If the issue stays, consider posting the problematic .mmp file here.
Re: Getting Incomming Caller Number
You are great. I remove this reference and now it work like a charm. Thank you for everyting.
Re: Getting Incomming Caller Number
Can i Compare a two telephone Numbers and if they are equal then passing the function?
e.g. I've this number +359886858585 and I want to execute the function only when this number calls?
Re: Getting Incomming Caller Number
[QUOTE=fukatoki;912492]Can i Compare a two telephone Numbers and if they are equal then passing the function?
e.g. I've this number +359886858585 and I want to execute the function only when this number calls?[/QUOTE]
you mean something like TDesC?
[url]http://www.symlab.org/main/documentation/reference/s3/pdk/GUID-440FF2B4-353B-3097-A2BA-5887D10B8B23.html[/url]
Re: Getting Incomming Caller Number
Thank's, pavarang I've made it like this:
[CODE]
iCallSelectionUse.iLine = CTelephony::EVoiceLine;
iCallSelectionUse.iSelect = CTelephony::EInProgressCall;
iTelephony->GetCallInfo(iCallSelection,iCallInfo,iRemParty);
TBuf8<100> CallerNumber;
CallerNumber.Copy(iRemInfoUse.iRemoteNumber.iTelNumber);
TBuf8<100> Number;
Number.Copy(_L("+359XXXXXXXXXX"));
if (CallerNumber==Number)
{
.... something
}
[/CODE]
Re: Getting Incomming Caller Number
Basically you should not compare full numbers, since you can not know whether the country code is there or not. So simply do the matching for example for 8 last digits.
Re: Getting Incomming Caller Number
May be something like this?
[CODE]
iCallSelectionUse.iLine = CTelephony::EVoiceLine;
iCallSelectionUse.iSelect = CTelephony::EInProgressCall;
iTelephony->GetCallInfo(iCallSelection,iCallInfo,iRemParty);
TBuf8<100> CallerNumber;
CallerNumber.Copy(iRemInfoUse.iRemoteNumber.iTelNumber);
TBuf8<100> Number;
Number.Copy(_L("93520000"));
if (!(CallerNumber.Right(8).Compare(Number)))
{
.... something
}.
[/CODE]