#!/usr/bin/perl # vim:set ts=4 sw=4 ai: # $Id: sipscreen-decider.sample 2 2007-06-10 02:47:53Z mct $ # A sample sipscreen-decider script, to be executed by sipscreen-ipqueue # when it sees a SIP packet describing an incoming call. sipscreen-ipqueue # will pass as arguments the caller's phone number, and name, if any # caller ID information was contained in the SIP packet. If this script # exits with an exit code of 0, the packet will be allowed. If it exits # with any other value, the packet will be dropped on the floor. use strict; use warnings; my $number = shift or die "Usage: $0 \n"; my $name = shift or die "Usage: $0 \n"; my ($sec, $min, $hour) = localtime; # Reject calls from toll free numbers, which are almost always either # telemarketers, or calls that play an automated message. Don't let it # ring my phone, but instead send it straight to voicemail. exit 1 if $name =~ /TOLL FREE CALL/i or $number =~ /^(800|877)-/; # Block anonymous calls between the hours of 3am and 9am. exit 1 if $number eq "000-000-0000" and $hour >= 3 and $hour <= 9; # Allow anyone else. exit 0;