Search code examples
at-commandsim800sim800l

SIM800L check if call was answered


I need to disable the dialing tone on my SIM800L and for that I need to know if the receiving end has answered the call. AT+CPAS returns 4 which stands for 'in progress' both during conversation as well as during the tone before the call is answered so it's of no use.

Is there a way using AT commands? Or should I resort to doing some singal analisis of the output audio? Is there any other device that does have this capability?


Solution

  • The command you are looking for is +CLCC. It is a standard ETSII command, so you will find it in every cellular modem. For the present answer I will refer to the SIM800 AT command guide.

    Execution command AT+CLCC list the status of the current calls. For each call you will get a row such as

    +CLCC: <id1>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type>,<alphaID>
    

    where:

    Parameter Description Values
    <idx> Call identification number [1-7]
    <dir> Direction 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> Multiparty status 0 Call is not one of multiparty (conference) call parties
    1 Call is one of multiparty (conference) call parties
    <number> Remote peer phone number (String to be included in quotation marks; phone number in format specified by <type>)
    <type> Type of address
    <alphaId> Alphanumeric representation of <number> corresponding to the entry found in phone book (String type to be included in quotation marks)

    Usually there is only one call, but anyway you'll be able to determine the call of your interest by checking the number field of the answer.


    The <stat> field of the response provides what you need. In fact, it will contain the status of the current call showing a different value between when the modem is dialing (2, in case of Mobile Originated call) and when the call is active (0; also 1 if you want to include held calls).