Read SIM/Phone number...

Login to reply to this topic.
Tue, 2005-02-01 13:32
Joined: 2003-06-12
Forum posts: 104
Hello!!

Is anyone here able to Read the cellphone number of a Symbian phone?

"its all right, the gun isn't loaded."


Tue, 2005-02-01 15:33
Joined: 2005-02-01
Forum posts: 36
Read SIM/Phone number...
GSM phones generally do not know their own phone number.

They only need to know ther IMSI and IMEI number.
Tue, 2005-02-01 18:11
Joined: 2003-06-12
Forum posts: 104
Read SIM/Phone number...
jkekoni,

hello...

so ure saying that there is no way that i can access the GSM number?

I'm trying to make a network application, doesn't involved phone calls or SMS.. I just need to send the GSM number through the network..

I can prompt the user to enter his number but he might enter a different number or hemight enter someone's cellphone number.. so i was thinking that maybe i could get the number programatically..

"its all right, the gun isn't loaded."

Wed, 2005-02-02 22:30
Forum Nokia Champion
Joined: 2003-06-10
Forum posts: 727
Read SIM/Phone number...
You can't. The phone doesn't really know its own number (the MSISDN). It could be stored on the SIM, but generally it isn't, because it isn't used for anything, really.

As the phone doesn't really know/have the number, the phone never sends the number when making a call or sending a message or browsing, or any other thing that accesses the network.

The operator's network looks the number up based on the SIM serial number (IMSI), and either sends it or doesn't send it (depending on whether sending it has been blocked - except for SMS/MMS with which it is always sent).

And even in those rare cases where an operator chooses to put the number on the SIM card, you need privileged access to the SIM application toolkit APIs (SATK). But because it isn't done, even if you could make the SATK calls, there's no guarantee that any numbers are there.

So, if you need the user's phone number, ask it from the user (or figure out a way to solve your problem without the number).
Tue, 2005-08-16 10:47
Joined: 2004-10-27
Forum posts: 18
Re: Read SIM/Phone number...
Hi
You can use the  API "RMobilePhone::GetSubscriberId()" to get the subscriber ID, which contains the phone number (last 10 digits).
Can refer SDK help for getting it

phalder
Fri, 2005-09-16 17:45
Joined: 2005-02-24
Forum posts: 278
Re: Read SIM/Phone number...
The HelloWorld example has a menu item for this. It does not work for me (UIQ phone), maybe it's ok for you?

MOBINFO.DLL :
http://www.symbian.com/developer/development/syslibs.html#mobinfo

MOBINFOTEST: (I can't compile it...)
http://developer.sonyericsson.com/getDocument.do?docId=68337




-- JumpJack --

Fri, 2006-01-27 02:19
Joined: 2004-11-02
Forum posts: 52
Re: Read SIM/Phone number...
I'd try to explain the question from a TSY developer's view.

Basically, the SIM/Phone number (or officially International Mobile Subscriber Identifier, IMSI) is stored in the EF_IMSI file located in the SIM/USIM card. The ability to retrieve it with a client API is decided by respective vendors. For the project in which I'm participating now, the TSY does not support Symbian'S API RMobilePhone::GetSubscriberId(), but it provides its own HMI API to read EF_IMSI file. That API is for system's usage and will not be published to App developer.

I guess that you'd follow Symbian's API doc suggestion, as:

Quote
This function member returns the subscriber's identity as described by its IMSI.

The TSY may not support client retrieval of the IMSI and a client can discover whether it is available using the GetIdentityCaps() request.

Best regards.

NewLC #2150

Thu, 2006-08-24 12:24
Joined: 2006-08-23
Forum posts: 17
Re: Read SIM/Phone number...
hello
i read the discussion and now finaly want to know we can get the any unique identification of any sim card to differentiate from other.
one of frnd suggest RMobilePhone::GetSubsriberIf(). but it's not available in SDK 2nd Edition is it in 3 rd edition.
Tue, 2007-05-22 19:56
Joined: 2004-05-29
Forum posts: 149
Re: Read SIM/Phone number...
If you want a reliable way to retrieve a unique identifier for a given phone, the following gets the IMEI number, which is easier to get than the MSISDN. 

Symbian OS 9.x (3rd Edition):
Code:
#include <e32base.h>
#include <Etel3rdParty.h> // CTelephony

class CGetIMEI : public CActive
{
public:
static CGetIMEI* NewL();

~CGetIMEI();

public:
// Function for making the initial request
void StartL();

const TPtrC GetIMEI();

private:
CGetIMEI();
void ConstructL();

// From CActive
void RunL(); // Handle completion
void DoCancel();

private:
enum TGetIMEIState
{
EStart = 1,
EGetPhoneInfo,
EDone
};

private:
TInt iState; // State of the active object
CTelephony* iTelephony;
CTelephony::TPhoneIdV1 iPhoneId;
CActiveSchedulerWait iActiveSchedulerWait;
TBuf<CTelephony::KPhoneSerialNumberSize> iIMEI;
};



CGetIMEI* CGetIMEI::NewL()
{
ALLOCD(CGetIMEI*, self, CGetIMEI());
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);

return self;
}

CGetIMEI::CGetIMEI() : CActive(EPriorityHigh) // HIGH priority
{
iIMEI.Zero();
iState = EStart;
}

void CGetIMEI::ConstructL()
{
iTelephony = CTelephony::NewL();
CActiveScheduler::Add(this);
}

CGetIMEI::~CGetIMEI()
{
Cancel();
delete iTelephony;
}

void CGetIMEI::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
}

void CGetIMEI::StartL()
{
Cancel(); // Cancel any request, just to be sure
iState = EGetPhoneInfo;
CTelephony::TPhoneIdV1Pckg phoneIdPckg( iPhoneId );
iTelephony->GetPhoneId(iStatus, phoneIdPckg);
SetActive(); // Tell scheduler a request is active
iActiveSchedulerWait.Start();
}

void CGetIMEI::RunL()
{
iState = EDone;
if ( iActiveSchedulerWait.IsStarted() )
{
iActiveSchedulerWait.AsyncStop();
if(iStatus == KErrNone)
{
iIMEI.Append(iPhoneId.iSerialNumber);
}
else
{
ERROR(PRINT("[IMEI_3rd.RunL] ERROR: returned " + CString::FromInt(iStatus.Int())));
}
}
}

const TPtrC CGetIMEI::GetIMEI()
{
StartL();
TPtrC ptr(iIMEI.Ptr());
return ptr;
}

CString GetImei()
{
#ifdef __WINS__
CString toRet = "8034049425440";
#else
CGetIMEI* getIMEI = CGetIMEI::NewL();
CString toRet(getIMEI->GetIMEI().Ptr(), getIMEI->GetIMEI().Length());
INFO(PRINT("[IMEI_3rd.GetIMEI] IMEI=[" + toRet + "]"));
DELETE(getIMEI);
#endif
return toRet;
}

For Symbian OS 6.x: http://www3.symbian.com/faq.nsf/0/ba491eaeb25c5c7d80256bf3003e75fc?OpenDocument&Highlight=2,IMEI

For Symbian OS 7/8:
(The top method has worked on all of the devices I have tested)

Code:
// This only works on target machine
TPlpVariantMachineId imei;
PlpVariant::GetMachineIdL(imei);
CString toRet(imei.Ptr(), imei.Length() > 32 ? 32 : imei.Length());
DBG(PRINT("GetImei: Method 1 is %s", toRet.Get()));
return toRet;

// For use with Symbian OS v8.0 (Series 60 2nd Edition, FP2 and higher)
// Apparently will not work on Nokia 6630
// Link against Etel3rdParty.lib
//

/*
CTelephony::TPhoneIdV1 iPhoneId;
CTelephony* telephony = CTelephony::NewL();
CTelephony::TPhoneIdV1Pckg phoneInfo(iPhoneId);
TRequestStatus iStatus;
telephony->GetPhoneId(iStatus, phoneInfo);
User::WaitForRequest(iStatus);
TPtrC theIMEI(iPhoneId.iSerialNumber);
CString toRet(theIMEI.Ptr(), theIMEI.Length());
PRINT("GetImei: Method 2 is %s", toRet.Get());
return toRet;
*/
Thu, 2007-09-06 12:46
Joined: 2007-09-06
Forum posts: 1
Re: Read SIM/Phone number...

As mentioned previously, you can ask the user to enter the phone number, but then how do you know it's true?
What can be done, is send an SMS to the phone number that the user entered, then check the messages and see if your message is in the inbox.
If it is, you know it's the right number.

Good luck,
Ofer

Mon, 2008-04-21 18:57
Joined: 2003-09-22
Forum posts: 27
Re: Read SIM/Phone number...

Hi all,
Im assuming that this is a problem whereby the TSY does not support the given functionality.

I am using the following code: (http://wiki.forum.nokia.com/index.php/How_to_get_my_own_phone_number) to try to retrieve my MIDDN. I have the necessary access to the Binary access kit. However when I get to the section:

if(status.Int() == KErrNone)
{
CheckCapabilities(ownStoreInfo.iCaps);

if(ownStoreInfo.iUsedEntries < 1)
{
console->Printf(_L("No entry found.\n"));
User::Leave(KErrNotFound);
}
}
else
{
User::Leave(status.Int());
}

the application leaves with a KErrPermissionDenied.

Originally I had thought that this was a Permissions issue but after looking up the documentation I see that the APi requires ReadUserData permission which I have.

I am now thinking that it is the TSY that is retruning this error as it does not support the functionality. I am working on an N73 device.

Has anybody else seen this problem or managed to resolve it? I am particularly interested in the S60 third edition paltform.

Also I am wondering that even if the TSY returned the MISDN, would this work on most networks or can you be guarnteed that this API will retrieve it for all networks? Perhaps it is dependant on the operator?

~b

  • Login to reply to this topic.