Unable to send sms to a called number

Work done before :

1 .I have Successfully tried to connect to the server, read a specific word in a text file and send sms to the given phone number in the serial monitor.

2 .I have also Successfully tried to call my phone number, where it automatically hangs up the call and sends the called number a sms.

Now I am trying to integrate 1 and 2.

Intension :

When somebody call's to my number, I need to read a text file located in my server and specifically take a word from the text file and send the word as a sms to the called number.

Tools :

  1. Arduino Uno R3
  2. Arduino GSM Shield

Code :

     // libraries
     #include <GSM.h>

     // PIN Number
     #define PINNUMBER ""

     // APN data
     #define GPRS_APN       "GPRS_APN" // replace your GPRS APN
     #define GPRS_LOGIN     "login"    // replace with your GPRS login
     #define GPRS_PASSWORD  "password" // replace with your GPRS password

     // initialize the library instance
     GSMClient client;
     GPRS gprs;
     GSM gsmAccess; 
     GSM_SMS sms;
     GSMVoiceCall vcs;
     
     // URL, path & port (for example: arduino.cc)
     char server[] = "yourdomain.com";
     char path[] = "/location.txt";
     int port = 80; // port 80 is the default for HTTP

     // Variables declaration
     char k[30]; 
     char z = '*';
     int s=0;
     String place;
     char remoteNum[20];  // telephone number to send sms


     void setup()
     {
       // initialize serial communications and wait for port to open:
       Serial.begin(9600);
       // connection state
       boolean notConnected = true;

       // After starting the modem with GSM.begin()
       // attach the shield to the GPRS network with the APN, login and password
       while(notConnected)
       {
         if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
           (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
           notConnected = false;
         else
         {
           Serial.println("Not connected");
           delay(1000);
         }
       }

      Serial.println("GPRS connected...");
      Serial.println("Waiting for call");

       }

     void loop()
     {
  
         switch (vcs.getvoiceCallStatus()) 
          {
            case RECEIVINGCALL: // Yes! Someone is calling us
            Serial.println("RECEIVING CALL");
            // Retrieve the calling number
            vcs.retrieveCallingNumber(remoteNum, 20);
      
            // Print the calling number
            Serial.print("Number:");
            Serial.println(remoteNum);
            vcs.hangCall();
            
            //***********************
            // connecting to server
               serverr();
            //***********************
       
       
            // Trying to read a specific data after it identifies the (* delimiter) of location.txt text file 
       
             if (client.available())
                   {
   
                     char c = client.read();
                     // Serial.print(c);
                     if (z==c)
                       {
                         s=1;
                        }
                     if(s == 1)
                       {
                         int i=0;
                         k[i] = c;
                         i=i+1;
                         Serial.print(k);
                       }

                     place +=k;
                     Serial.print(place);
                   }

             // if the server's disconnected, stop the client:
            if (!client.available() && !client.connected())
                   {
                    //Trying to send sms to the called number 
                    sms.beginSMS(remoteNum);
                    sms.print(place);
                    sms.endSMS(); 
                    Serial.println();
                    Serial.println("disconnecting.");
                    client.stop();

                    // do nothing forevermore:
                    for(;;)
                    ;
                  }

  
            }
      delay(1000);
     }

     void serverr()
     {
         if (client.connect(server, port))
          {
            client.print("GET /location.txt");
            Serial.print("GET /location.txt");
            client.println(" HTTP/1.1");
            Serial.println(" HTTP/1.1");
            client.println("Host: www.yourdomain.com");
            Serial.println("Host: www.yourdomain.com");
            client.println("User-Agent: Arduino");
            Serial.println("User-Agent: Arduino");
            client.println("Accept: text/html");
            Serial.println("Accept: text/html");
            client.println("Connection: close");
            Serial.println("Connection: close");
            client.println();
            Serial.println();
            Serial.println("\nCOMPLETE!\n");
           }

         else
           {
            Serial.println("connection failed");
            Serial.println("\n FAILED!\n"); 
            }
  
       }

Question :

The above code receives the calls then it automatically gets the details of the called number and hangs up. Then It connects to the server and then its stops. It is not proceeding to

     if (client.available())
       {

       }
       
      if (!client.available() && !client.connected())
       {


       }

Hence I am not able to receive sms. What is this problem ?

What is this problem ?

All those stupid smiley faces and italics in your code. There are stickies at the top of the forum that you were supposed to read before you posted the first time. Clearly, you haven't read them. Go read them now, and you'll know what to do to get a less hostile reaction.

I am really sorry for the post. Now I have read the good way to post a question and code . I have updated the code.