Pages: [1]   Go Down
Author Topic: GSM Library: how can i retrive my SIM card number (MSISDN) ?  (Read 1297 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,
i have already post the question there http://forum.arduino.cc/index.php?topic=188434.0
May i have more chance in this section.
I have alredy tried the above code but none of them are responding :


Code:
theGSM3ShieldV1ModemCore.println("AT+CNUM");
theGSM3ShieldV1ModemCore.println("AT+CNUM=?");
theGSM3ShieldV1ModemCore.println("AT+CNUM?");
theGSM3ShieldV1ModemCore.println("CNUM=?");
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

with this:
Code:
#include <GSM.h>
GSM gsmAccess(true);
char myNumber[20];
int timeout = 5000; // 5 seconds

void setup()
{
  Serial.begin(9600); 
  boolean notConnected = true;
  Serial.println("Connecting to the GSM network");
  while(notConnected){
    if(gsmAccess.begin() == GSM_READY) // Note: I do not require PIN #
      notConnected = false;
    else {
      Serial.println("Not connected, trying again");
      delay(1000);
    }
  }
  Serial.println("Connected");

  theGSM3ShieldV1ModemCore.println("AT+CNUM");
 
 int start = millis();   
  while((millis() - start) < timeout && !theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("+CNUM: \"\",\"", "\"", myNumber, 20)){
  }
  Serial.print("My Telephone number: ");
  Serial.println(myNumber);
 
}

void loop()
{
}
I have this:

Quote
Connecting to the GSM network
AT%13%
0 25>AT%13%%13%%10%OK%13%%10%%13%%10%+CPIN: READY%13%%10%
AT+CGREG?%13%
25 56>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
56 87>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
87 118>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
118 21>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
21 52>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
AT+IFC=1,1%13%
52 69>AT+IFC=1,1%13%%13%%10%OK%13%%10%
AT+CMGF=1%13%
69 85>AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
85 101>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
101 112>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
112 118>%13%%10%OK%13%%10%
Connected
AT+CNUM%13%%10%My Telephone number:

Any help please ?
Logged

Madrid (Spain)
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

It's possible that CNUM returns only OK. Some SIMs haven't got MSISDN saved in memory.
Logged

Pages: [1]   Go Up
Jump to: