Dial out automated calls

I’m trying to implement a system to place automated calls to users to remind them about their bookings. I need to log the failed calls (busy line, wrong number, …) and the hang-up calls. This is the extension my call file refers to:

[dialout] exten => s,1,SetGlobalVar(starttime=${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}) exten => s,2,Set(CHANNEL(language)=it) exten => s,3,Answer exten => s,4,Wait(2) exten => s,5,Background(mymessage) exten => s,6,Wait(15) exten => 1,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}, "Y") exten => 1,2,Playback(mymessage-thanks_yes-\${GENDER}) exten => 1,3,Playback(mymessageks-goodbye-\${GENDER}) exten => 1,3,Hangup() exten => 2,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}, "N") exten => 2,2,Playback(mymessage-thanks_no-\${GENDER}) exten => 2,3,Playback(mymessage-goodbye-\${GENDER}) exten => 2,3,Hangup() exten => 3,1,Goto(dialout,s,5) exten => i,1,Playback(mymessage-invalid-\${GENDER}) exten => i,2,Goto(dialout,s,5) exten => t,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}, "T") exten => t,2,Playback(mymessage-goodbye-\${GENDER}) exten => h,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}, "F ${REASON}") exten => failed,1,system(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%Y.%m.%d-%T)}, "F ${REASON}")

My problem is that I don’t know how to catch (log) calls which are answered and then hung-up before timeout expires (without an answer): they are not “failed” calls… I could use the “h” command, but it is executed on each hung-up…

Do I miss something?
Any hint?

Set a channel variable to tell the h extension the call has succeeded.