I want to research AMI events, how to add event?

I want to research about DTMF and the its event. after that, I want to control with AMI. Can you advise me some information in code, file, functions … in Asterisk. How to begin to understand them.
How to add event?
Thanks a lot!