Use Asterisk's temporary directory instead of /tmp

Also stop if the time can't be set for some reason; Asterisk will re-execute the script immediately in that case, starting a loop