Paging from Pick?
By Nathan Rector
Natec Systems
nater@northcoast.com
http://www.northcoast.com/~nater/
"If I'm away from the office, then how can I get the computer to tell me when it's done with a save or notify me of a critical system error." This question was presented to me a few months ago.
I was having a hard time managing a few of my clients' computers. For the most part, their computers would monitor and correct any errors they found, but a few more critical errors still needed a human to solve and fix.
As we all know, critical errors only occur when there isn't anyone there who knows how to fix the problem. Such as the weekend or the night shift. Since I'm not at my office at these times (or very rarely), I needed some way I could be notified when I'm needed.
Most consultant have a pager to leash them to the office, and in turn, to their clients, and I'm not an exception. I decided to look into a way to get my client's computer to page me direct when it runs across an error it doesn't know what to do with.
Since I use the generic paging service that just has someone enter their phone# from a touch-tone phone, all that was needed was a modem and communications software to control the modem. (Pick's weakest point)
Advanced Pick includes the basic commands to control communication with a modem. The only problem was that not all my clients used Advanced Pick. A few of them still used R83.
In this article, I will focus on the using Advanced Pick's commands, but with slight modifications using Main-Link, InfoLink or some other communication software, you can get the same code to work on an R83 system.
Advanced Pick supplies the basic commands SEND and GET. These commands allowed the user to send and receive information directly from a port. This allowed me to send modem initialization commands, as well as the dialing commands needed to cause the modem to call the pager. All that was left to do was have the computer call the paging service and leave the message.
I started by call the paging terminal, and counted how many seconds after dialing it took before I could send a message (which was about 10 sec). From this information I constructed the following modem dialing string:
ATDT 441-9999 ,,,,, 000 ;
+++
ATH
Each comma represents 2 seconds, '000' was the test string that I used to send to the paging service, and the ';' is used to return to the command mode of after the dialing has completed. If you leave the ';', the modem will think that it's talking to another modem and try and connect.
Then I had the modem type '+++' and 'ATH' to hang up the phone.
These sets of commands worked great, except for one thing: the phone hung up before the paging service could complete it process. This required a 5 second sleep statement between the dialing command and the hang up command.
For several weeks this code worked. I was notified when there was a major problem that had to be dealt with before the customer ran into anything major. Then one morning, I got a call from a client saying that their system had crashed the night before and it would not now boot back up correctly. After fixing the problem, I looked into why the paging program didn't work.
I soon found out why. The paging service usually answers the phone on the first ring, and then after the message on what to do, you input the paging code. All this took about 10 seconds, but on that day, the paging service was answer the phone on the 2nd and 3rd ring. Since the program was setup assuming that there was only 1 ring, it prematurely hung up the phone before the message was sent correctly.
I went back to look at the dialing command again. By working with the paging company, I found a combination that finally worked no matter how many rings the phone was answered on.
By using a recorded message on the paging terminal with a 6 second pause in it and using the modem command string '@', the problem was solved. The '@' command causes the modem to pause and wait for 5 seconds worth of silence before continuing with the rest of the modem string.
By using the modem initial command of:
ATDT 441-9999 @ ,, 000 ;
+++
ATH
with the recorded message of: "You've reached Nathan Rector's Paging terminal. Please enter the phone# for a return call. There will be a 5 second pause before the beep... ", then a 6 second pause, "Thank you".
I used a 6 second pause to make sure the modem picked up on the long pause. By adding the two ',' after the '@', I took care of the "Thank You" in the recorded message. The paging company needed the "Thank You" in order for their system to play the message with the 5 second pause in it correctly.
This simple program has since been adapted by for my clients to you. Most every business runs large batch processes every night, and seems to always run into some kind of problem. My clients took this program and attached it to those program to let them know when they are done or have a problem.
Another use this program was put to was monitoring power outages and UPS systems for battery drainage.
If you use this program to keep track of simi-critical system errors, it will work with most, but it isn't full proof. The classic example is when the computer has crashed. There is nothing this program can do to warn of that since it relies on the computer to working in order for it to dial the phone.
(Note on program code: This code may not work correctly when tried. You will need to modify it to work with you implimation.)
PAGER1
001 * PAGER1
002 * Created By Nathan Rector, 04/26/96
003 * Natec Systems
004 * nater@northcoast.com - http://www.northcoast.com/~nater/
005 * Usage:
006 * PAGER1 {phone#} {pager code} {# times to send}
007 *
008 * PAGER1 441-5555 999 3
009 *
010 * Returns:
011 * PAGER0 - Page went Ok
012 * PAGER1 - Port currently in use
013 *
014 TCLREAD TCL
015 *
016 PHONE = FIELD(TCL," ",2)
017 CODE = FIELD(TCL," ",3)
018 MAXSEND = FIELD(TCL," ",4)
019 PORT.NO = 16
020 ERR = "PAGER0"
021 *
022 *** checks to see if the phone# exists
023 *
024 IF PHONE = "" THEN
025 CRT "NUMBER TO PAGE:"
026 INPUT PHONE
027 END
028 *
029 *** checks to see if the code exists
030 *
031 IF CODE = "" THEN
032 CRT "PAGER CODE:"
033 INPUT CODE
034 END
035 *
036 IF MAXSEND = "" THEN MAXSEND = 1
037 *
038 *** checks to see if the port is logged on. If so, then do not send page
039 *
040 EXECUTE \WHERE \: PORT.NO CAPTURING OUTPUT
041 IF OUTPUT<5> = "" THEN
042 *** no one logged on to port. Assume that it is clear to use
043 *
044 END ELSE
045 CRT
046 CRT "[PAGER1] Error! Port ": PORT.NO :" currently in use." ; ERR = "PAGER1"
047 END
048 *
049 *** Attatch to port and dial pager
050 *
051 TCL \DEV-ATT \: PORT.NO
052 *
053 FOR I = 1 TO MAXSEND
054 *
055 *** Dials pager phone and send page
056 *
057 CRT "Page #": I :": Dialing"
058 SEND \ATDT \: PHONE :\ @ ,, \: CODE :\;\ TO PORT.NO ELSE CRT "[PAGER1] Dial Error! Port ": PORT.NO ; ERR = "PAGER1" ; GOTO 800
059 *
060 SLEEP 25
061 *
062 *** Hanging up
063 *
064 CRT "Page #": I :": Hanging up"
065 SEND \+++\ TO PORT.NO ELSE CRT "[PAGER1] +++ hang up Error! Port ": PORT.NO ; ERR = "PAGER1" ; GOTO 800
066 SEND \ATH\ TO PORT.NO ELSE CRT "[PAGER1] ATH hang up Error! Port ": PORT.NO ; ERR = "PAGER1" ; GOTO 800
067 *
068 CRT "PAGE #": I :" sent"
069 IF NOT(I = MAXSEND) THEN SLEEP 30 ; CRT "Sleeping for 30 sec"
070 500*
071 NEXT I
072 *
073 *** detaches from port
074 *
075 800*
076 TCL \DEV-DET \: PORT.NO
077 *
078 900*
079 STOP ERR
080 END