Retry calls failing

My current dial plan uses the WaitExten application after I play a certain greeting. If the user doesn’t press anything, then I use the System application on the next line to copy the call file to a different directory, and another System applicaion on the next line in the dial plan to touch the call file using the -d option (to set the timestamp on the call file to 30 minutes in the future), then the next line in the dial plan I Hangup.

Up to this point everything works great. The problem occurs when 30 minutes comes and goes and the call isn’t placed.

So, any thoughts as to why? Maybe touch -d isn’t setting the time like I want it to? Although, an ls -la displays what appears to be the right time.


are you copying the file into the outgoing directory and then touching it ?

I haven’t experienced it but have read many warnings when googling about not copying the file directly into the outgoing directory. Since asterisk could see it and start to read it before the copy is done.

It is suggested to copy the file to a temporary directory. Touch it. Then move it from that directory into the outgoing directory.

The move is faster since it is just updating the directory information and the file isn’t actually copied.

I am touching the file before moving it. What seems to be the problem is a line in the .call file after it gets moved into the outgoing directory:

StartRetry: 11353 1 (1298052420)

It’s like as soon as I move it to the outgoing directory, it is read (I assume) and then this line is added. If I remove that StartRetry line, and save the file, the call comes immediately. So, I need to figure out what is causing this and try to fix that.

Goal: to be able to call a user back in 5 minutes (or any configurable amount of time) if he/she either 1) Answers the call but doesn’t press 1 to confirm he/she heard the message … or 2) User doesn’t answer call, and call goes to their voicemail … no digit 1 will be pressed in that case either to confirm that the message was listened to.

I got it to work … maybe a bit too much work but it did the trick …

Would you be so kind and share the solution?

Sure, sorry I didn’t before - I had to leave and I planned on coming back to this today.

So, if a user doesn’t input any digits when I expect them to, the next lines in my dial plan are as follow:

exten => mycaller,7,System(mv /var/spool/asterisk/outgoing/${PLAYFILE}.call /usr/local/tmp_asterisk/retry_calls/)
exten => mycaller,8,System(mv /usr/local/tmp_asterisk/retry_calls/${PLAYFILE}.call /usr/local/tmp_asterisk/retry_calls/${PLAYFILE})
exten => mycaller,9,System(/usr/local/ops/scripts/

First, I move the call file to a tmp directory, then I drop the .call off of the end of the filename (can’t remember why, but I think it has something to do with what I’m doing in the script) … then after I rename the file, I run a script that looks in the file, finds the line with StartRetry and removes it. Also in the script I touch the file for 5 minutes in the future, chown asterisk:asterisk on the file, and chmod 644 on the file.

Then I have a cron that runs every 1 minute and moves *.call from that dir to /var/spool/asterisk/outgoing/



# for every file in the retry directory
for i in $retry_dir/*


# remove the line starting with StartRetry
sed -i '/^StartRetry/d' $i

# remove any empty lines
sed -i '/^$/d' $i

# touch the file to 5 minutes in the future
touch -d "5 minutes" $i

# done with for loop

chown asterisk:asterisk $retry_dir/*

chmod 644 $retry_dir/*