#!/usr/bin/env perl ## Start user config # # multimon program - modified for this use $mm = "/usr/local/bin/multimon -q -a DTMF"; # PPP on DTMF string - 0-9 * # A B C D allowed $on_str = "666"; # PPP off DTMF string - must be same length as on string $off_str = "911"; # path to PPP on command $on_cmd = "/usr/sbin/ppp-on"; # path to PPP off command $off_cmd = "/usr/sbin/ppp-off"; # ## End user config # Setup # select STDOUT; $| = 1; $i = 0; sub System { if ((0xffff & system $args) != 0 ) { print STDERR "error: $!\n"; exit 1; } } open M, "$mm|" || die "Can't open $mm: $!\n"; while () { ($a, $b) = split ':'; $b =~ tr/0-9*#ABCD//csd; # Allow 0-9 * # A B C D $ans .= $b; $i++; if ($i == (length $on_str)) { if ($ans eq $on_str) { System($args = $on_cmd); undef $ans; $i = 0; } elsif ($ans eq $off_str) { System($args = $off_cmd); undef $ans; $i = 0; } else { undef $ans; $i = 0; } } } close M;