Here is a non-blocking AT response check I coded recently:
boolean foundOK()
{
const char targetString[] = {'O', 'K', '\r', '\n'};
static byte index = 0;
boolean found = false;
while (Serial3.available() > 0)
{
c = Serial3.read();
Serial.write(c);
if (c == targetString[index])
{
index++;
if (index >= sizeof(targetString))
{
index = 0;
Serial.println("found \"OK<cr><lf>\" termination string");
found = true;
}
}
}
return found;
}