Hangup with h

I have an extension for a class and would like to monitor when students hang up.
I have no problem with writing to the database when they connect but can not get the hangup event to work. I am using the special extension h

same =>n(end),Set(CLASS_Chem104()=${CHANNEL},${EXTEN},${CALLERID(ani)},${CALLERID(name)},${utterance},${STRFTIME(${EPOCH},,%Y-%m-%d-%H:%M:%S)})
        same => h,n,Set(CLASS_Chem104()=${CHANNEL})
        same => n,ConfBridge(${EXTEN},chem1Bridge,chem1User)

In my log files i see all the events except the same => h,n,Set(CLASS_Chem104()=SIP/provider-00000000) so that tells me it not getting executed


    -- Executing [6300@ConferenceRooms:8] Goto("SIP/provider-00000000", "end") in new stack
    -- Goto (ConferenceRooms,6300,12)
    -- Executing [6300@ConferenceRooms:12] Set("SIP/provider-00000000", "CLASS_Chem104()=SIP/provider-00000000,6300,+1xxxxxxx,Student One,-1,2014-05-10-11:06:57") in new stack
    -- Executing [6300@ConferenceRooms:13] ConfBridge("SIP/provider-00000000", "6300,chem1Bridge,chem1User") in new stack

After I hang up the phone I would expect to see

-- Executing [6300@ConferenceRooms:12] Set(CLASS_Chem104()=SIP/provider-00000000)

Ok I figured it out.
First you can only have one

exten => h,1,Set(CLASS_Chem104()=${CHANNEL})
per context

Second you have to have a priority of 1 not n
You also have to specify exten => instead of same =>

I placed the code at the top of my [conference] context and it works great!