Go Down

Topic: GSM Library: how can i retrive my SIM card number (MSISDN) ? (Read 1 time) previous topic - next topic

lita

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: [Select]
theGSM3ShieldV1ModemCore.println("AT+CNUM");
theGSM3ShieldV1ModemCore.println("AT+CNUM=?");
theGSM3ShieldV1ModemCore.println("AT+CNUM?");
theGSM3ShieldV1ModemCore.println("CNUM=?");

lita

with this:
Code: [Select]
#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 ?

davidgoth

Hi,

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy