Dial plan for if sip user is not registered

I am looking for an example that will allow me to do the following:

call comes in
call attempts to ring sip channel
if sip peer is not reg’d then ring for x seconds, then goto voicemail.

Thanks in advance!

voip-info.org/wiki/view/Aste … DIALSTATUS

${DIALSTATUS} can be used along with a Gotoif().