My original question:
> Does anyone have a nice pre-built script to dial a beeper from a
> serial-port connected modem under DU 4.0? Perl would be preferable but I
> can deal with anything. I'm sure I can come up with something, but if the
> wheel's been invented...
Thanks to those who replied:
Dick Joltes <joltes_at_fas.harvard.edu>
Christopher J. Tengi <tengi_at_CS.Princeton.EDU>
Santosh Krishnan <santosh_at_heplinux1.uta.edu>
Susan Rodriguez <SUSROD_at_HBSI.COM>
Dick Joltes suggested looking at /usr/examples/lat/dial.c for some code
that talks to the modem. I don't have the kit installed so I didn't try
that.
Chris Tengi pointed out that there is a mailing list devoted to driving
pagers from computers (who knew!). Their FAQ is at:
ftp://ftp.netcontech.com/pub/paging_info/ixo_faq.txt
That was my introduction to the world of IXO/TAP and PET (standard
protocols for talking to alphanumeric pagers). From the FAQ I got info on a
package called sendpage
(
ftp://ftp.net.ohio-state.edu/pub/pagers/sendpage7a.tar.gz).
Susan Rodriguez told me about a similar package called QuickPage
(ftp.it/mtu.edu:/pub/QuickPage).
Both sendpage and QuickPage are cool systems that have a lot of features.
Unfortunately, they were both a lot more than I needed--and I couldn't find
anyone at the pager company who could tell me if our beepers supported TAP.
So, I started prowling around the Perl archives and discovered a sample
perl script for talking to a modem
(
http://www.perl.org/CPAN/scripts/assorted/talk_to_modem.pl)
I whipped up a quick test script (shown below) which seems to work
adequately for now. I have to add some error checking, etc, but it's a
start. I'm keeping QuickPage and sendpage around, though, just in case.
Thanks to everyone. Sorry about the lack of comments in the below code--as
I said, it's basically just a proof-of-concept.
_______________________________________________________________________
Rick Beebe (203) 785-4566
Network Engineering Manager FAX: (203) 737-4037
ITS-Med Technology Operations Richard.Beebe_at_yale.edu
Yale University School of Medicine
P.O. Box 208089, New Haven, CT 06520-8089
_______________________________________________________________________
#!/usr/local/bin/perl
if ($#ARGV != 1) {
print "Usage: beep beeper_number code_to_display\n";
exit;
}
$phone = $ARGV[0];
$code = $ARGV[1];
print "Sending $code to $phone\n";
open (SERIAL, "+>/dev/tty00") or die "Can't open serial port";
system("stty -f /dev/tty00 -echo raw");
$out = "ATE1Q0M0X1\r";
syswrite(SERIAL, $out, length($out));
sleep(1);
sysread(SERIAL, $in, 1000);
if ($in =~ /OK/ ) {
print "OK recieved\n";
} else {
print "No OK from modem!\n";
exit;
}
$out = "ATDT9,,$phone,,,,,,$code#\r";
print "Dialing $out\n";
syswrite(SERIAL, $out, length($out));
sleep(30);
sysread(SERIAL, $in, 1000);
if ($in =~ /NO/ ) {
print "Problem dialing:\n";
print "$in\n";
close SERIAL;
exit;
} else {
print "Exiting\n";
exit;
}
$out = "+++,,ATH \r";
syswrite(SERIAL, $out, length($out));
sleep(5);
close SERIAL;
Received on Mon Dec 08 1997 - 15:53:23 NZDT