How to monitor Call(connected/disconnect) codes in Asterisk

I want to monitor a number to check whether its connected or disconnected(due to any reason code).
How can I get reason code for any call in Asterisk

Usually with HANGUPCAUSE but may vary on the technology used.