vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.96k stars 726 forks source link

SIM800L CALL STATUS? #168

Open rbghongade opened 6 years ago

rbghongade commented 6 years ago

Thank you for a really wonderful library! However I am stuck with a problem as to how do we know the status of the call being originated by SIM800L. If the call is successfully initiated we get response as "true" and if not we get "false" for modem.callNumber(.). But if the called number does not answer the call or rejects the call or is busy, we do not get any response. Is there a way to achieve this?

evgen2910 commented 6 years ago
SoftwareSerial::print (F("AT+CPAS\r\n"));
buffer=_readSerial();
return buffer.substring(_buffer.indexOf("+CPAS: ")+7,_buffer.indexOf("+CPAS: ")+9).toInt();

/*
  values of return:
 0 Ready (MT allows commands from TA/TE)
 2 Unknown (MT is not guaranteed to respond to tructions)
 3 Ringing (MT is ready for commands from TA/TE, but the ringer is active)
 4 Call in progress
*/