1
votes

After sending an outgoing call using SIM900 GSM module using AT commands, is there a way to know if the person receiving the call has answered it?

(directly communicating with GSM module using serial)

1

1 Answers

2
votes

The command +CLCC is the standard way to perform what you are asking. It means that this command will be available in any device supporting ETSI specification whatever is the model or the vendor.

From SIM900 AT command guide:

Execution command AT+CLCC returns a list of current calls of ME.

Note: if Command succeeds but no calls are available, no information response is sent to TE.

The following response is sent by the device

[+CLCC: <id1>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type >,<alphaID>]
[<CR><LF>+CLCC: <id2>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type>,<alphaID>]
[...]]]

OK

where

<idx> - (Range 1..7) - Call identification number
This number can be used in +CHLD command operations
<dir>
0 - Mobile originated (MO) call
1 - Mobile terminated (MT) call
<stat> - State of the call:
0 - Active
1 - Held
2 - Dialing (MO call)
3 - Alerting (MO call)
4 - Incoming (MT call)
5 - Waiting (MT call)
6 - Disconnect
<mode> - Bearer/tele service:
0 - Voice
1 - Data
2 - Fax
<mpty>
0 - Call is not one of multiparty (conference) call parties
1 - Call is one of multiparty (conference) call parties
<number> - String type (string should be included in quotation marks) phone number in format specified by <type>.
<type> - Type of address
<alphaId> - String type (string should be included in quotation marks) alphanumeric representation of <number> corresponding to the entry found in phone book.

So, basically, what you need to do is to provide the command (in polling), search for the row of the answer containing the remote number you are dialing to, contained in <number> parameter, and wait until the value of parameter <stat> changes from 2 (Dialing) to 0 (Active).


An alternative way for obtaining the info, not involving polling, is to enable URCs (unsolicited result codes). By setting

AT+CLCC=1

an URC will be asynchronously sent to the serial port whenever the call status changes (with the same format of the execution command respose explained above).


An easier SIM900 specific solution

It involves AT+MORING command. From AT command guide:

AT+MORING=<mode> Show State of Mobile Originated Call.

<mode>
0 - Not show call state of mobile originated call
1 - Show call state of mobile originated call. After the call number is dialed, the URC strings of MO RING will be sent if another call is alerted and the URC strings of MO CONNECTED will be sent if the call is established.

So, providing

AT+MORING=1

will enable a family of URCs in case of Mobile Originated call, in the form

MO RING - the call is alerted.
MO CONNECTED - the call is established