# Dial out automated calls

**URL:** <https://community.asterisk.org/t/dial-out-automated-calls/36777>\
**Category:** Asterisk Support\
**Created:** [September 22, 2011, 1:04pm UTC](https://community.asterisk.org/t/dial-out-automated-calls/36777 "2011-09-22T13:04:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [September 22, 2011, 1:04pm UTC](https://community.asterisk.org/t/dial-out-automated-calls/36777/1 "2011-09-22T13:04:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [September 22, 2011, 1:30pm UTC](https://community.asterisk.org/t/dial-out-automated-calls/36777/2 "2011-09-22T13:30:49Z")

</div>

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