That’s very old code, there are many ways to achieve this task. On of them is storing the alarm date on a DB and a cron job who run every 1 minute to check the alarm time and if match make the call with the originate command
Even if the code still works (expressing no opinion) a database, cron, and originate() will yield a more robust solution.
Call files work (they’re my ‘goto’ for hacking out cruft), but originate() will return a status that you can use to make decisions and handle conditions gracefully.
A database also makes it easy to answer questions like ‘how many wake-up calls do we process a day’ or ‘what percentage of wake-up calls were acknowledged by the occupant.’
You won’t find any ready-made examples that fit your requirements. Nobody knows (1) your preferred programming language (2) the Database, tables and the fields in which you store the wakeup call details.
The best way is to learn the concepts sedwards mentioned in his reply and implement them yourself in your project. You can start with Asterisk wiki and Asterisk: The Definitive Guide, a free book about Asterisk