Real-time Call Status

Hi,
I am new to asterisk and want to know how can get real-time call status e.g. (Ringing, Hang-up, Voicemail) using AGI or PHP API…

Thanks in advance.

Voicemail is something that is implemented by the dialplan, not part of the basic call flow, so you need to detect it by reference to details of your dialplan.

For actual call flow states, you should, I believe, be able to IMPORT ${CHANNEL(state)} for the channel representing the call leg of interest, although I haven’t don it myself. I think you will get the internal enumeration number, so will have to check it against the relevant header file.

Generally when you run the AGI application you know the state of the channel already. PHP API is not mutually exclusive with respect to AGI, although you are more likely to want to use AMI.

Typically, with AMI, you would let it push the state changes to you, rather than polling for them.