Capture hangup event

I have a conference bridge the participates log into for classes.
When they join the conference they are written to a database.
the problem is if they hang up I want to write an event back to the database to say they hung up at x time so they get credit for the time they were on.


......
same =>n(end),Set(Chem101_CP1234()=${CHANNEL},${EXTEN},${CALLERID(ani)},${CALLERID(name)},${utterance},${STRFTIME(${EPOCH},,%Y-%m-%d-%H:%M:%S)})
        same => n,ConfBridge(${EXTEN},chemBridge,chemUser,volume_ctrl_menu)
.....

this works but what I can not figure out is once the call is transferred to the ConfBridge how do i know if they have hung up

the h extensions and global variables could help you.