Call File in 45 minutes

Asterisk/FreePBX 14


I am attempting to generate a call file that will call the party back in 45 from the time of the original call. I found the call file example in The Asterisk Book and thought I could modify it.

I am almost there, the part I am stuck on is how do I add 45 minutes to the call time?

Here is what I have:
exten => s,n,Set(YEAR = ${STRFTIME(${EPOCH},%Y)})
exten => s,n,Set(MONTH = ${STRFTIME(${EPOCH},%m)})
exten => s,n,Set(DAY = ${STRFTIME(${EPOCH},%d)})
exten => s,n,Set(HOURS = ${STRFTIME(${EPOCH},%H)})
exten => s,n,Set(MINUTES = ${STRFTIME(${EPOCH},%M)})

I want to make a new variable that is essentially ${year}${month}${day}${hours}${minutes} + 45 minutes to leverage the following code:

exten => _s,n,System(touch -t ${year}${month}${day}${hours}${minutes} /tmp/${UNIQUEID}.call)
exten => _s,n,System(mv /tmp/${UNIQUEID}.call /var/spool/asterisk/outgoing/)

to call out 45 minutes after someone calls in. Any ideas on how to accomplish this or if there is a better command than EPOCH? I am not married to the approach at all, this is just what I’ve found that looks like it will do what I need it to do (call someone back in 45 minutes).

Thanks for any help or insights you may be able to provide.

same => n,Set(THE_FUTURE=${MATH(${EPOCH}+$[45 * 60],int)})
same => n,system(touch -d @${THE_FUTURE} /tmp/${UNIQUEID}.call)

1 Like

That’s it! Thanks for the assist!

My bad, I posted the non optimized version.

You can do it in a single line.
same => n,system(touch -d @$[${EPOCH}+$[45 * 60]] /tmp/${UNIQUEID}.call

1 Like

Thanks for this. Worked perfectly!