Go Down

Topic: Always getting 'OK' AT Response  (Read 830 times) previous topic - next topic

petia_d

Feb 20, 2020, 08:05 pm Last Edit: Feb 20, 2020, 08:16 pm by petia_d
Hi there, I am using a GSM Shield with my Arduino Uno. I am making a call to a remote party and I am trying to figure out whether the remote party hung up, picked up, timed out or is busy. I have been reading about AT commands and responses and I get the impression that I should be getting different responses to these events, e.g. 7 / BUSY or 8 / NO ANSWER. (Maybe I am wrong to get that impression?)

The problem is whatever happens I always get 0 OK. And it's very unhelpful because I need to know what event occurred. I tried using the GSM library, I tried printing my AT commands directly to the serial, I have read the verbose responses... Always the same result - 0 OK:


36 42>%13%%10%OK%13%%10%

84 90>%13%%10%OK%13%%10%

...

This is my code
Code: [Select]


// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER ""
String CONTACT_NUM = "";

// initialize the library instance
GSM gsmAccess(true); // include a 'true' parameter for debug enabled
GSMVoiceCall vcs;
GSM_SMS sms;
GSM3VoiceCallService callService = new GSM3VoiceCallService(false);

String remoteNumber = "";  // the number you will call
char charbuffer[20] = "";

void setup() {

  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("Make Voice Call");

  // connection state
  boolean notConnected = true;

  while (notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }
}


void loop() {
  Serial.println("Waiting for emergency signal...\n");

  char alert[200];
  readSerial(alert);

  if (strcmp(alert, "s") == 0) {
    Serial.println("SENDING EMERGENCY ALERT\n");

    // Check if the receiving end has picked up the call
    callService.voiceCall(charbuffer);
    Serial.println("Call Established. Enter line to end");
    // Wait for some input from the line
    while (Serial.read() != '\n' );

    callService.hangCall();
    Serial.println("Call Finished");
\
  }
}



Is it at all possible to figure out if the remote party hung up or never answered? What am I doing wrong? Also any idea what the too numbers and '>' mean before the response? I can't find information, maybe they are somehow useful?

Any advice would be appreciated, I am quite stuck and this whole area is way out of my expertise so I don't know what to look for anymore.

Thanks!

Go Up