[LUAU] Linux to pager

Ronald Fox rfox at dls.queens.org
Sat Jun 19 17:03:21 PDT 1999


On Sat, 19 Jun 1999, Zachary P. Taylor wrote:

> Does anyone have an idea how to send a numeric (not alpha-numeric) number to a
> pager, when an e-mail comes into an account? I have been working on some
> stuff, but chat just hangs up, before sending anything. Chat is not even
> working for PPP connection, for me. Please don't send me to a howto, I have
> already read them as well as the various pager programs. Can I send it
> directly to the serial port. kind of like sending directly to the printer?

Zach,

I've had good luck with expect controlling minicom to dial GTE wireless
pagers here.  I've attached an expect script named "npagerbg" that can be
called as  "npagerbg zach 1234 ron 4567 5222222 7890 &" for example to
send the message "411--1234" to Zach's pager, "411--4567" to Ron's pager
and "411--7890" to pager 522-2222 (there's a built-in pager directory).
You'll have to make sure that minicom is configured to use Ctrl-A as
the command escape character, and you may have to play with the dialcmd
string for other paging services and modems.  On my modem, the "@" char
in the dial-string causes the modem to stop dialing further digits and
wait for "quiet answer".  This is important for reliable transmission
of the following digits.  On our GTE wireless pagers, the paging
terminal answers with "Welcome to GTE paging, please leave a numeric
message after the beep" followed by 4 beeps within about a second.  The
"@" causes the modem to wait until the paging terminal answers, speaks
and beeps before sending the remaining digits.  The "#" character tells
the paging terminal that the message string is finished, and ";" tells
my modem to hang up the phone (or it would wait for carrier).  Some
paging services will accept a "*" character in the message string,
replacing it with a "-" as displayed on the pager.  I use this as
punctuation.  Your mileage may vary.

Hope this helps,
Ron
-------------- next part --------------
#!/usr/bin/expect --
# npagerbg - send informational page(s) to a numeric pager - run in background
# run as npagerbg user msg [user2 msg2]... &

# Modification history:
# 24-dec-98 rlf Written
# 27-apr-99 rlf Allow multiple pages in the same Minicom session

set argc [llength $argv]

if {$argc%2==1} {
   puts "usage: npagerbg {phoneno|name} msgstr [{phoneno2|name2} msgstr2]..."
   exit 1
   }

# Set phonepfx to prefix required to get outside line. If none, set to the
# null string
set phonepfx "9"

# Set a message prefix to distinguish these pages from other, human
# generated pages
set msgpfx "411"

# Set a message infix to separate the prefix from the info code.  Each
# paging service will differ in how it treats the "*" character when
# dialed, mine displays them as "-" on my pager.
set msgifx "**"

# Set to path for logfile
set mylogfn "/home/zach/npagerbg/dial.log"

# Set up a list of pagers that can be dialed by username

set pnum(ron) 5551212
set pnum(zach) 5551212

set timeout 60

# make sure there is a setting for this environment variable
set env(TERM) vt100

# stop output of spawned process from appearing in the standard output of Expect
log_user 0

# debug - log dialcmd to a file opened for append
set mylog [open $mylogfn "a"]

# You may have to supply a full path if running from cron
spawn minicom
expect "OK"

# turn on modem speaker for testing
send "atm1\r"
expect "OK"

for  {set i 0} {$i<$argc} {incr i} {
    set phoneno [lindex $argv $i]
    incr i
    set msgstr  [lindex $argv $i]

    if [info exists pnum($phoneno)] {
       set phoneno $pnum($phoneno)
       }

    set dialcmd ""
    append dialcmd "atdt" $phonepfx $phoneno "@" $msgpfx $msgifx $msgstr "#;\r"

    send $dialcmd
    expect "OK"

    set time [timestamp -format %c]
    puts $mylog "$time - dialing $dialcmd"

    send "ath\r"
    expect "OK"
    }

close $mylog

# Send Ctrl-A to minicom which is the command escape char for my config
send "\x01"
sleep 0.2

# Send the eXit command
send "X"
expect "Leave Minicom?"
sleep 0.2
# The default is "yes"
send "\r"

# wait for eof to be detected from the spawned process (minicom) closing
expect



More information about the LUAU mailing list