Interfacing arduino with a sim900a shield

Hello! i am facing certain issues with at commands for sim900a module. This is what i am stuck at:

The AT command Serial.write("AT+CPAS); is not returning the status of the call. This is what i want my project to achieve. The led on pin 13 must be on while the call is ringing and as soon as the call is answer, led on pin 13 must stop and led on pin 12 must glow. The problem is the serial is monitor is printing "AT+CPAS" and not returning a value.

This is my code(to call i have also used buttons):

const int tocall = 2; // the number of the pushbutton pin
const int toend = 3;
const int toreceive =4;
int led1 = 13;
int led2 = 12;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int y=0;

void setup()
{
Serial.begin(9600);
delay(1000);
pinMode(led1, OUTPUT);
PINmode(led2, OUTPUT);

}
void loop()
{
buttonState1 = digitalRead(tocall);
buttonState2 = digitalRead(toend);
buttonState3= digitalRead(toreceive);
if (buttonState1 == HIGH) {
Serial.println("ATD8970220880;"); //where xxxxxxxxxx is a 10 digit mobile

number
delay(1000);// wait 1 seconds.
}
else if(buttonState2 == HIGH){
Serial.println("ATH"); // end call
delay(100);
}
else if(buttonState3 == HIGH){
Serial.println("ATA"); // end call
delay(100);
}
Serial.write("AT+CPAS");
delay(3);
while(Serial.available()){
delay(3);
y=Serial.read();
if(y==3) //if call is ringing/not received
{
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
}
else if(y==4) //if call is received/answered
{
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
}
}

}

uploaded.txt (1.17 KB)

Are you using the hardware serial port to talk to the SIM900A or to the PC? Yes is the wrong answer. So is both.

If you are using the hardware serial port to talk to the SIM900A, how are you debugging your program? How do you know what the SIM900A is sending back?

Is it really sending back 3 or 4? Rather than, for instance, '3' or '4'.

It is not sending back anything. It just sends back - " AT+CPAS" in the serial monitor instead of any value

It is not sending back anything. It just sends back - " AT+CPAS" in the serial monitor instead of any value

I like chocolate ice cream.

My response to your statement makes as much sense as your statement does in trying to answer my questions.