[wellylug] Perl script help :)

Chris Hodgetts chris at hodgetts.geek.nz
Sat Dec 31 21:57:47 NZDT 2005


Hello - happy new year...

I have just put in a Wakeup Call feature to my Asterisk config at home..
Having trouble with one of the perl scripts, and I was wondering if
anyone here could help with this :)

# creates wake file using argument for the number of minutes into the
#future

sub createwake
{
my $date = &UnixDate(DateCalc("today","+ ".$_[0]."minutes"), "%H%M");
my $filename = sprintf("%s%04s.%s.call", $pending_dir, $date, $caller);
        open(FILE, ">$filename");

        printf FILE q{#

-------------

This is the script that is run when it calls for the wake up call, it
allows you to snooze the wake up call or acknowledge the call and answer
a maths question.

There is two parts to the wake up process, a php script and a perl
script, the PHP script creates a file in the future (Date and Time of
the wake up) in the /var/spool/asterisk/outgoing directory.. when you ls
-la on the file, you see that the time and date, depending on the wake
up, is in the future.

The Perl script does not seem to do this, it creates the file with the
current date and time thus calls you immediately back just before the
call hangs up.

Could any one suggest a way to make perl create that file in the future,
so that it can sit in /var/spool/asterisk/outgoing, and not use the
current method which is a cron job to copy the files at the time it
needs to be sent over..

Thanks... 




More information about the wellylug mailing list