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),Hangup
My 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!
Marco