How to know when callee answered

from dialplan’s DIAL command, if I am calling an extension…how to know when its answered… because we know If the call is answered before the timeout, the channels are bridged and the dialplan is
done. If the destination simply does not answer, is busy, or is otherwise unavailable, Asterisk will set a variable called DIALSTATUS and then continue on with the next priority in the extension. BUT how to set status to answered in our DB rather than wait til the call is done

thanks

AMI events, or look at the various options in Dial for running things when the callee answers.

I see G option in Dial command where you could send to an extension when call is answered BUT as soon as it hits that extension, it disconnects call which is undesired…

well… I think I could look at M option…