Date: Mon, 19 Aug 1996 22:39:08 -0700 From: Leonard Chung <Leonard@pacbell.net> To: hoek@freenet.hamilton.on.ca Cc: questions@freebsd.org Subject: Re: Pager Program? Message-ID: <1.5.4.32.19960820053908.00675fdc@pacbell.net>
next in thread | raw e-mail | index | archive | help
At 05:10 PM 8/19/96 -0400, hoek@freenet.hamilton.on.ca wrote:
If you could add some comments, that'd be great. Also, I tried to run the
script after running chmod +x on it, but FBSD refused to run the script
saying that it isn't a valid command. Am I doing something wrong here?
Thanks,
Leonard
>In Email, Leonard Chung <Leonard@pacbell.net> 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
>expect...
>
>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
>questions@freebsd.org 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 [ ! ]
>do
> read l
> l=`echo ${l} | perl -pe 's/\r|\n//g'`
> if [ x"${l}" = xRING ]
> then
> date '+%m/%d %H:%M Caught a `RING'\''!' >> ${LOGFILE}
> if [ ! -e /tmp/DIALINGPAGER.$$ ]
> then
>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 ]
> do
> redial
> sleep 35
> done
># 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/DIALINGPAGER.$MYPID
> rm -f /tmp/CONNECTED.$MYPID
>EOF
> touch /tmp/DIALINGPAGER.$$
> fi
> # My modem sends BUSY or NO CARRIER when connected to a voice
> # line.
> elif [ x"${l}" = xBUSY -o x"${l}" = x"NO CARRIER" ]
> then
> touch /tmp/CONNECTED.$$
> date '+%m/%d %H:%M Connected!' >> ${LOGFILE}
> else
> if [ ! x"${l}" = x ]
> then
> date '+%m/%d %H:%M Caught a `'"${l}"\' >> ${LOGFILE}
> fi
> fi
>done
>
>
>--
>--
>tIM...HOEk
>Outnumbered? Maybe. Outspoken? NEVER!
>
>
--
Leonard Chung <Leonard@eff.org>
Support the Blue Ribbon Campaign for free speech online ()
http://www.eff.org/blueribbon.html /\
"Those who will not reason perish in the act.
Those who will not act, perish for that reason." - W. H. Auden
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1.5.4.32.19960820053908.00675fdc>
