I am using call files (to be put to /var/spool/asterisk/outgoing/) to automate a reminders system. So I do not use a “Dial()” command in my extension.
This is the extension I currently use:
[callout]
exten => s,1,Set(LANGUAGE()=it)
exten => s,n,Set(starttime="${STRFTIME(${EPOCH},GMT,%s)}")
exten => s,n,Set(answered="no")
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n(play),Background(ks)
exten => s,n,Wait(15)
exten => 1,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%s)}" "${ID}" "Y")
exten => 1,n,Playback(my-thanks_yes-\${GENDER})
exten => 1,n,Playback(my-goodbye-\${GENDER})
exten => 1,n,Set(answered="yes")
exten => 1,n,Hangup()
exten => 2,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%s)}" "${ID}" "N")
exten => 2,n,Playback(my-thanks_no-\${GENDER})
exten => 2,n,Playback(my-goodbye-\${GENDER})
exten => 2,n,Set(answered="yes")
exten => 2,n,Hangup()
exten => 3,1,Goto(callout,s,play)
exten => i,1,Playback(my-invalid-\${GENDER})
exten => i,n,Goto(callout,s,play)
exten => t,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%s)}" "${ID}" "T" "${REASON}" "${answered}")
exten => t,n,Playback(my-goodbye-\${GENDER})
exten => h,1,System(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%s)}" "${ID}" "H" "${REASON}" "${answered}")
exten => failed,1,system(log "${starttime}" "${STRFTIME(${EPOCH},GMT,%s)}" "${ID}" "F" "${REASON}" "${answered}")
Would it be possible for my extension to detect the elapsed time (for not-answered calls) from the first ring to the hang-up?