Sending SMS message vis GPRS SIM900A with Arduino UNO is not reliable

Here's the code for printSerial():


bool printSerial(char* response)
{
  char buffer[120];
  int i = 0;
  while(altSerial.available()>0 && i<118){
    char c = altSerial.read();
    buffer[i++] = c;
    Serial.print(c); //DEBUG
  }
   buffer[i++] = '\0';
   
   if(response != NULL){
      char* p = NULL;
      p = strstr(buffer, response);        
      if( p!= NULL) return true;
   }
  return false;
}