Usually it stucks around this area. I don't know why. But if you press the 'RESET' button twice or thrice, it would work.
void setupGSM() {
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected) {
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else {
Serial.println("Not connected");
delay(1000);
}
}
//sendSMS();
}