Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 1996 17:10:38 -0400 (EDT)
Subject:   Re: Pager Program?
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
In Email, Leonard Chung <> wrote:

> Does anybody know if there is a pager program available on FreeBSD?  A
> pager program is supposed to monitor a phone line for RINGs via a spare
> modem and then after a certain delay, dial a numeric pager to signal a
> possible message on the answering machine. 

I don't know if one exists or not, but...

> If there aren't any pager programs available on FBSD, can someone give me
> instructions on how to read and write to serial ports and where I can get
> more programming info for the FBSD APIs?  I do programming on the PC and
> Mac, but am new to FBSD so please bear with me if these questions sound too
> basic.

It shouldn't be hard to write a simple one.  Nothing more than a shell 
script would even be necessary.  

Have a look at the following...  I just hacked it up sorta at the moment, 
so it hasn't recieved any "real world" testing, but it should work, I 

NOTE, it's not 100% effective in that if someone were to call just after 
it dials the pager, and the person where to leave a very long message 
that didn't end until AFTER you had checked the messages, you wouldn't 
know about the very long message.  And, of course, even that depends on 
the specific message-machine implimentation you have...  It's not very 
likely to happen, and, if it does, it's probably because you recieve so 
many messages that the when a third one arrives, the long one won't have 
been missed for long.  IOW, it's not really worth reading this paragraph 
twice to figure-out what the heck this freak is trying to say... :(

If you're not very comfortable with shell scripts, return this and I'll 
add a ton of comments or so, to it.  Just, please, keeps in the Cc: line.  Thanks.

#! /bin/sh
LOGFILE=${LOGFILE:-/dev/null} # use /dev/null for logging, by default.
MYPID=$$ export MYPID
rm -f /tmp/DIALINGPAGER.$$
rm -f /tmp/CONNECTED.$$
printf 'ate0\r\n' # turn echoing off
printf 'atx3\r\n' # Make modem dial even if there is no dialtone (or, more
                  # specifically, even if the dial tone is the stagnated
                  # dialtone that might be used to show you have a message
while [ ! ]
	read l
	l=`echo ${l} | perl -pe 's/\r|\n//g'`
	if [ x"${l}" = xRING ]
		date '+%m/%d %H:%M Caught a `RING'\''!' >> ${LOGFILE}
		if [ ! -e /tmp/DIALINGPAGER.$$ ]
sh << "EOF" &
		redial () {
			date '+%m/%d %H:%M Dialing pager.' >> ${LOGFILE}
			# printf 'atdt 5557399\r\n'
			printf 'atdt 3368032\r\n'
		sleep 480 # Allow the person 8 minutes to leave their
 		          # message.
		while [ ! -e /tmp/CONNECTED.$MYPID ]
			sleep 35
# It may be necessary to get rid of the whole concept of a "Succesful"
# call to the pager.  You may have to simply call and then force the 
# modem to hangup after 10/20 sex.  If it is necessary to do this, then,
# if possible, you should get rid of the atx3, and do some sensing for
# various failure conditions that can occur when dialing (specifically,
# NO DIAL TONE).  I expect most modems will automatically hang-up after
# 35 secs when calling a voice line, though.
		date '+%m/%d %H:%M Successfully dialed pager.' >> ${LOGFILE}
		rm -f /tmp/CONNECTED.$MYPID
		touch /tmp/DIALINGPAGER.$$
	# My modem sends BUSY or NO CARRIER when connected to a voice
	# line.
	elif [ x"${l}" = xBUSY -o x"${l}" = x"NO CARRIER" ]
		touch /tmp/CONNECTED.$$
		date '+%m/%d %H:%M Connected!' >> ${LOGFILE}
		if [ ! x"${l}" = x ]
			date '+%m/%d %H:%M Caught a `'"${l}"\' >> ${LOGFILE}

Outnumbered?  Maybe.  Outspoken?  NEVER!

Want to link to this message? Use this URL: <>