31.07.2015 Views

Download

Download

Download

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Asterisk Hardware Ninjutsu • Chapter 11 353my $waittime="30";# To keep outgoing calls unique, we build call files based on their PID.my $alarmfile="alarm.$$";my $alarmdir="/var/spool/asterisk/outgoing";# .$$ == PID# where to drop the call# file.my $tmpfile;my $setinfo;my $camera;######################################################################### This is where the actual call file is built. Remember, with Asterisk,# any call files that show up in the outgoing queue (usually /var/spool/# asterisk/outgoing) are used automatically.######################################################################### Open the outgoing queue file and feed it the commands.if (!open (ALARM, "> $alarmdir/$alarmfile")){die "Can't write $alarmdir/$alarmfile!\n";}print ALARM "Channel: $channel\n";print ALARM "Callerid: Security Camera \n";print ALARM "MaxRetries: $maxretries\n";print ALARM "RetryTime: $retrytime\n";print ALARM "WaitTime: $waittime\n";print ALARM "Application: AGI\n";print ALARM "Data: alarm.agi\n";print ALARM "Set: camera=$ARGV[0]\n";close(ALARM);######################################################################### AGI section: If no command-line arguments get passed, we can# assume it's not Motion calling the routine (because Motion passes# the camera on the command line). Asterisk calls alarm.agi without# any command-line arguments, so we act as an AGI.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!