Forward with Dial Command Not Hanging Up

I use the following in a my dialplan to forward calls from a particular DID to a hard coded number. Almost works great.

exten => 12125551212,1, Set(CDR(accountcode)=12125551212)
exten => 12125551212,n, Dial(IAX2/voipjet/12125551111,300)
exten => 12125551212,n, Hangup()

It rings through and if the new number answers, everything is fine. If the caller hangs up before the answer, it seems asterisk keeps the dial command open. It just keeps ringing on the other end, into voicemail even though there is nothing on the incoming connection anymore.

Is there anyway to detect that the incoming call has hung up and stop the dial command from executing?

Thanks