Can i send control back to diaplan after user hangs up

Greetings Everybody

This is my diaplan…

exten => start,1,Set(TIMEOUT(absolute)=500)
same => n,Dial(SIP/401)
same => n,NoOp(${DIALSTATUS})
same => n,GotoIf($["${DIALSTATUS}" = “ANSWER”)]?callduration:hangup)
same => n(callduration),Set(duration = ${CDR(duration)})
same => n,NoOp(${duration})
same => n,(hangup),Hangup()

I want to set the call duration to duration varible but when the user hangs up the control does
not return to next line of the dialplan .The last statement that is seen on CLI is

Goto(“SIP/400-0000000b”, “set-duration,start,1”) in new stack
– Goto (set-duration,start,1)
– Executing [start@set-duration:1] Set(“SIP/400-0000000b”, “TIMEOUT(absolute)=500”) in new stack
– Channel will hangup at 2013-11-25 09:53:46.983 IST.
– Executing [start@set-duration:2] Dial(“SIP/400-0000000b”, “SIP/401”) in new stack

Some time it shows the NoOp(CHANUNAVAILBLE) ,but thats when user is no avialable,
but when uer is avialable and answers the call…
after that as soon as user hangs up the call next statements are not executed.
I need the duration value because i need to update it in database.

Thanks and Regards

Use the h extension for applications like this. For just the callee hanging up, look at the options on Dial.