Detecting disconnected numbers etc

Is there a way that Asterisk can detect a disconnected number? Or maybe I should ask if there is special DTMF digits or tones that Telcos send?

For example you will hear the message " The number you have dialed have been disconnected" or “If you would like to make a call, please hangup and dial again”.

All those calls are being logged as “ANSWERED”. It is no problem when there is a human making the call but when my applciation is making the call I need to be able to distinguish between those scenarios programmatically.

Any ideas or advice would be appreciated.

This depends on the kind of trunks(outside lines) you are using. Most VOIP providers and PRI circuits will send a hangupcause of 28 and a dial status of UNAVAILABLE for a Disconnected number, but this can vary depending on the carrier of the person you are calling as well as the kind of unavailable number(privacy, no inbound calls, number changed, number disconnected, etc…)

Thanks mate!