How to detect dead channel in AGI

Hi,
on asterisk 1.6 AGI how we could detect dead channel ?
I used “channel status” but when channel is already dead it return an error .

Thanks