SIM900 webserver problem

Hello everyone ,

I need your help in the below ...

Now I connected SIM900 with Arduino Uno, Iam trying to use SIM900 as a web server to control relay and everything working okay

here is my code

/*
============================================================================
Name        : Vertebra Solution
Author      : Rafek Gorgay
Version     : Final v1.0
Description : This is the final version v1.0.
We use Web Server through GSM Shield to be able to control the Arduino remotely.
We control 1 Relay.
============================================================================
*/


# include <SoftwareSerial.h>

#define led0 A0
#define led1 A1
#define led2 A2
#define led3 A3


SoftwareSerial GSM(7, 8); // Configure Serial Pins Rx,Tx
unsigned int timer_counter;  //timer counter
int IP_obtained_led = 13;  //IP_obtained_led on pin 13
String check_IP_status;  //to save the IP from SIM900
String check_connection_status; //to check connection status
char gsm_read;  //to get the one byte from SIM900
int count = 0;    //counter
String data;  //to read data from remote IP
String check_webServer_status;  //to check status of webServer

void ShowSerialData()        // To get feedback from GSM module
{
	while (GSM.available() != 0)
		Serial.write(char(GSM.read()));
}

void GSM_setup()       // GSM configuration setup
{
	check_IP_status.equals("");  //reset check_IP_status
	count = 0;  // reset count


	GSM.println("AT+CSQ"); // Signal quality check
	delay(100);
	ShowSerialData();

	GSM.println("AT+CGATT?"); // Check if GPRS attached or not
	delay(100);
	ShowSerialData();

	GSM.println("AT+CIPSHUT"); // Reset the IP session
	delay(100);
	ShowSerialData();

	GSM.println("AT+CIPSTATUS"); // Check if the IP stack is initialized
	delay(100);
	ShowSerialData();

	GSM.println("AT+CIPMUX=0"); // To keep things simple, I’m setting up a single connection mode
	delay(100);
	ShowSerialData();

	GSM.println("AT+CSTT= \"estatico.claro.com.co\""); // SIM APN Configuration
	delay(100);
	ShowSerialData();

	GSM.println("AT+CIICR"); // Now bring up the wireless. Please note, the response to this might take some time
	delay(10000);
	ShowSerialData();

	GSM.println("AT+CIFSR"); // Get Local IP
	delay(100);
	while (GSM.available() != 0)
	{
		// to save the IP in check_IP_status
		gsm_read = GSM.peek();
		if (count < 26)
		{
			check_IP_status += gsm_read;
		}
		Serial.write(char(GSM.read()));
		count++;
	}

}

void webServer_setup()  //WebServer Configuration
{
	check_webServer_status = "";  //reset check_webServer_status
	count = 0;  //reset counter


	GSM.println("AT+CIPSERVER=1,80"); // configure SIM900 as web server
	delay(100);
	ShowSerialData();

	GSM.println("AT+CIPSTATUS"); // check web server status
	delay(100);
	while (GSM.available() != 0)
	{
		// to save the status of webServer in check_webServer_status
		gsm_read = GSM.peek();
		if (count < 45)
		{
			check_webServer_status += gsm_read;
		}
		Serial.write(char(GSM.read()));
		count++;
	}

}

void timer_int()  //Timer Configuration
{
	// initialize timer1
	noInterrupts(); // disable all interrupts
	TCCR1A = 0;
	TCCR1B = 0;

	TCNT1 = 0;
	TCCR1B |= (1 << CS12) | (1 << CS10);  // Set CS10 and CS12 bits for 1024 prescaler
	TIMSK1 |= (1 << TOIE1);   // enable timer overflow interrupt
	interrupts(); // enable all interrupts
}

void connection_status()  // to check connection status if it was down re start configuration
{
	check_connection_status = ""; //reset check_connection_status
	timer_counter = 0;  //reset timer_counter
	count = 0;  //reset count


	GSM.println("AT+CGATT?"); // Check if GPRS attached or not
	delay(100);
	while (GSM.available() != 0)
	{
		gsm_read = GSM.peek();
		if (count < 23)
		{
			check_connection_status += gsm_read;
		}
		Serial.write(char(GSM.read()));
	}

	if (!(check_connection_status.startsWith("AT+CGATT?\r\n+CGATT: 1\r\n0"))) // check if the GPRS is up or not (if not enter the if condition to re configure)
	{

		check_IP_status = ""; //reset check_IP_status
		check_webServer_status = "";  //reset check_webServer_status
		count = 0;  // reset count

		digitalWrite(IP_obtained_led, LOW); // set the IP led off

		while (!(check_IP_status.endsWith("190.127.131.65"))) // to check if the SIM obtain IP or not(the program will not start till the SIM get the IP:190.127.131.65)
		{
			GSM_setup();
		}
		digitalWrite(IP_obtained_led, HIGH);  // set the IP led on

		while (!(check_webServer_status.endsWith("LISTENING"))) // to check if the webservice working or not
		{
			webServer_setup();
		}

	}

}

void setup()
{
	pinMode(IP_obtained_led, OUTPUT);     // set IP_obtained_led as output
	pinMode(led0, OUTPUT);
	pinMode(led1, OUTPUT);
	pinMode(led2, OUTPUT);
	pinMode(led3, OUTPUT);

	digitalWrite(led0, LOW);
	digitalWrite(led1, LOW);
	digitalWrite(led2, LOW);
	digitalWrite(led3, LOW);

	delay(100);
	GSM.begin(115200);
	Serial.begin(115200);
	delay(15000);
	Serial.print("Starting ......");


	while (!(check_IP_status.endsWith("190.127.131.65"))) // to check if the SIM obtain IP or not(the program will not start till the SIM get the IP:190.127.131.65)
	{
		GSM_setup();
	}
	digitalWrite(IP_obtained_led, HIGH);

	while (!(check_webServer_status.endsWith("LISTENING"))) // to check if the webservice working or not
	{
		webServer_setup();
	}

	timer_int();  // start timer

}

void loop() {
	data = "";
	// to get data from system
	while (GSM.available() != 0)
	{
		data += (char(GSM.peek()));
		Serial.write(char(GSM.read()));
	}

	// check the data from Remote IP and take actions
	if (data.startsWith("on1"))
	{
		digitalWrite(led0, LOW);
	}
	if (data.startsWith("off1"))
	{
		digitalWrite(led0, HIGH);
	}

	/*if (data.startsWith("on2"))
	{
	digitalWrite(led1, LOW);
	}
	if (data.startsWith("off2"))
	{
	digitalWrite(led1, HIGH);
	}
	if (data.startsWith("on3"))
	{
	digitalWrite(led2, LOW);
	}
	if (data.startsWith("off3"))
	{
	digitalWrite(led2, HIGH);
	}
	if (data.startsWith("on4"))
	{
	digitalWrite(led3, LOW);
	}
	if (data.startsWith("off4"))
	{
	digitalWrite(led3, HIGH);
	}*/

	// every about 11 min check the connection status
	if (timer_counter > 150)
	{
		connection_status();
	}

}

ISR(TIMER1_OVF_vect)  // timer counter
{
	timer_counter++;
}

I bought static IP so there is not problem in NAT

My problem is the device working fine for 4 hours then i cant connect the web server, I triend to ping the IP it reply.