[Discuss] Another telephone question
DR
vlug at drsol.com
Tue Jan 29 18:57:19 PST 2008
Patrick wrote:
> Hi. :-)
>
> Does anyone know how to mess with pppconfig, or efax, or perhaps
> know of some other FAXmodem software that will use the modem to
> dial a number, but *won't* attempt to do any sort of handshaking
> when someone [or their answering machine] picks up?
>
> I want to write a script that will read from a database of
> telephone numbers, and call them on demand. So, for example,
> when I type;
> p0n dad
> at the terminal, it will call my Dad. :-)
>
> Any guesses? Has someone already done something like this?
>
>
>
> Thanks,
>
> Patrick.
>
Patrick,
This Perl script might work for you. I originally designed it to dial
my pager and send a numeric message hence the two arguments. If you
modify it to not send the second string and not hang up it should work.
Note you will probably need to change the modem device from ttyS3 to
whatever it is on your system.
The three syswrite commands are taking the phone off hook, sending the
phone number a bunch of commas for delay and the pager numeric message,
and last hanging up the phone.
The purpose of the lock routine is to prevent more than one process from
attempting to run the process at the same time. Again in your case
probably not required.
Cheers
Deid
#! /usr/bin/perl
# Usage:
# pager number message
#
# Serial device and file names.
$modem = "/dev/ttyS3";
$LOCK_FILE = "/tmp/pager_active.lock";
$number = $ARGV[0];
$message = $ARGV[1];
lockit();
open(COM, "+>$modem") || die $!;
system("stty -F $modem 2400 -echo raw clocal -crtscts") == 0 or die
"oops $?";
syswrite(COM, "ATZ\r\n", 50);
sleep(2);
syswrite(COM, "ATDT,$number,,,,,$message#\r\n", 50);
sleep 20;
syswrite(COM, "ATH0\r\n", 10);
close (COM);
sleep 1;
unlockit();
0;
# Subroutines
#
# Locking routines
#
sub lockit {
while ( -e $LOCK_FILE) {
sleep 1;
}
open (LOCKPW, ">$LOCK_FILE") || die ("Can not create LOCK File");
1;
}
sub unlockit {
if ( -e $LOCK_FILE) {
unlink ($LOCK_FILE);
}
1;
}
More information about the Discuss
mailing list