Call file or dial-out extension?

I’m trying to implement a system to periodically 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 (included the time elapsed from the answer to the hang-up).
I am now trying to use call files (to be put to “/var/spool/asterisk/outgoing” directory), building a call file and a voice message for each of my user to be called, and putting them in the voice dir and in the outgoing dir to place the call.
Unfortunately with this approach I have no full control on the exitus of the calls (${DIALSTATUS} is not set, ${REASON} is not available for not-answered calls…).
I was kindly told on this board (by Olaf Winkler) to use the “[cfout]” extension to dial out my users:

[cfout] exten => 0111234567,1,GotoIfTime(20:00-09:00|*|*|*?next) exten => 0111234567,n,Set(RetryDelay=3600) exten => 0111234567,n,Dial(ZAP/1/0111234567) exten => 0111234567,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?end) exten => 0111234567,n(next),Set(OpenAttempts=$[${OpenAttempts}-1]) exten => 0111234567,n,GotoIf($["${OpenAttempts}" = "0"]?end) exten => 0111234567,n,system(echo -e "Channel: Local/${EXTEN}@cfout/n\\nMaxRetries: 0\\nWaitTime: 45\\nContext: myContext\\nExtension: s\\nPriority: 1\\nSetvar: OpenAttempts=${OpenAttempts}\\nArchive:No" > /var/spool/asterisk/${EXTEN}); exten => 0111234567,n,GotoIf($["${RetryDelay}" = "3600"]?nretry) exten => 0111234567,n,Set(day=${STRFTIME(${EPOCH},GMT,%Y%m%d)}) ; get actual date (without time) exten => 0111234567,n,GotoIfTime(00:00-09:00|*|*|*?sameday) ; do we need to add one day ? exten => 0111234567,n,Set(day=$[${STRPTIME(${day},GMT,%Y%m%d)+86400]} ; add one day exten => 0111234567,n,system(touch -t ${STRFTIME($[${day}+32400],GMT,%Y%m%d%H%M.%S)} /var/spool/asterisk/${EXTEN}); add 9:00 hours exten => 0111234567,n,Goto moveit exten => 0111234567,n(sameday),Set(day=${STRPTIME(${day},GMT,%Y%m%d)} ; same day exten => 0111234567,n,system(touch -t ${STRFTIME($[${day}+32400],GMT,%Y%m%d%H%M.%S)} /var/spool/asterisk/${EXTEN}); add 9:00 hours exten => 0111234567,n,Goto moveit exten => 0111234567,n,system(touch -t ${STRFTIME($[${EPOCH}+${RetryDelay}],%Y%m%d%H%M.%S)} /var/spool/asterisk/${EXTEN}); exten => 0111234567,n(nretry),system(touch -t ${STRFTIME($[${EPOCH}+${RetryDelay}],%Y%m%d%H%M.%S)} /var/spool/asterisk/${EXTEN}); exten => 0111234567,n(moveit),system(mv /var/spool/asterisk/${EXTEN} /var/spool/asterisk/outgoing/); exten => 0111234567,n(end),HangupMy problem is I don’t understand how to use this extension: how do I pass the channel to be called? I see Olaf writes to a new call file to /var/spool/asterisk/${EXTEN}: but, how is set ${EXTEN}?
Can somebody help me here? Is there any documentation about this issue?
Thanks in advance!


${EXTEN} is always what matched the first field after the =>.

O.k. So, how do I write an extension indipendent by the channel I want to call (I want to call a bunch of different numbers…)?

Use the _ prefixed pattern matching notation, as described in extensions.conf.sample.

Where do I find extensions.conf.sample?
But - I suppose I did not correctly explain my question: I have a list of users, with their names, their numbers and some more data, and I want to place one call for each of them, using an extension in my dialplan: I miss the logic I should apply…

extensions.conf.sample is in the configs directory of the the source tree. It should be included, either separately, or as the initial contents of /etc/extensions.conf, in any sensibly prepared binary package, as it is an important part of the documentation.

Call files are documented in doc/callfiles.txt.

There is unofficial, and possibly unreliable documentation in … o-dial+out

“Issue” is a euphemism for a bug. There is no Asterisk bug here.