TITLE: Pager

ISSUE: Multi-value Solutions Oct'98

AUTHOR: Nathan Rector

COMPANY: Natec Systems

EMAIL: nater@northcoast.com

HTTP:www.northcoast.com/~nater/

"When I'm away from the office, 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 was a challenge of mine some time ago. I was having difficulty managing a few of my clients' hardware. For the most part their computers would monitor and correct any errors they found, but a few 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 - mostly weekends and at night. Since I'm not at my office during those times (or very rarely), I needed a way I could be notified when I'm needed.

Most consultants have a pager to leash them to the office, and in turn, to their clients. I'm not an exception. I decided to look into a way to get my clients' computers to page me directly when it runs across an error it correct on its own.

Since I use a generic paging service that just requires someone to enter their phone number from a touch tone phone, all I 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 focus on using Advanced Pick's commands. However, with slight modifications, using Main-Link, InfoLink, or other communication software, the same code can work on R83.

Advanced Pick supplies the basic commands SEND and GET. These commands allow the user to send and receive information directly from a port. This allows 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 to have the computer call the paging service and leave a message.

To start, I called the paging terminal and counted how many seconds after the dialing took place before I could send a meassge. (For me this was about 10 seconds.) From this information I constructed the following modem dialing string:

ATDT 441-9999,,,,,000 ;

+++

ATH

Each comma represents two seconds. '000' was the test string that I used to send to the paging service. The ';' is used to return to the command mode after dialing has completed. If you leave the ';' out the modem thinks that it is talking to another modem and tries to connect. The '+++' and 'ATH' hangs up the phone.

These sets of commands worked greate, except for one thing: The phone hung up before the paging service could complete its 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 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 wouldn't boot back up correctly. After fixing the problem, I looked into why the paging program didn't work.

Soon I discovered why. The paging service usually answers on the first ring, then after the message on what to do you put in the paging code. All this takes about 10 seconds. But on that particular day, the paging service was answering the phone on the second and third rings. Since the program was setup assuming for one ring, it prematurely hung up before the message was sent correctly.

I re-looked at the dialing command. By working with the paging company, I found a combination that finally worked no matter how many rings the phone is answered on.

By using a recorded message on the paging terminal with a six second pause in it and using the modem command string '@', the problem was solved. The '@' command causes the modem to pause and wait for five seconds worth of silence before continuing with the rest of the string.

By using the modem initial command of:

ATDT 441-9999 @,, 000 ;

+++

ATH

With a recorded message of "You've reached Nathan Rector's paging terminal. Please enter the phone number for a return call. There will be a five second pause before the beep...", then a six second pause, "Thank you".

I used a six second pause to make sure the modem picked up on the long pause. By adding the two commas (,) after the '@', I took care of the "Thank you" in the recorded message. The paging company needed the "Thank You" for their system to play the message with the five second pause correctly.

This simple program has since been adapted for you. Most businesses run large batch processes every night, and seem to always run into some kind of problem. My clients took this program and attached it those programs to let them know when they are done or have a problem.

Another use this program has is to monitor power outages and UPS systems for battery drainage.

If you use this program with semi-critical errors, beware that it works with most but isn't completely fool proof. If the system crashes, it cannot alert you. The program does rely on the computer to be working in order to dail the phone.

Note on program code: You may need to modify the code for your implementation in order for it to work correctly.

 

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

TITLE: Pager

TITLE: Pager

ISSUE: Multi-value Solutions Oct'98

AUTHOR: Nathan Rector

COMPANY: Natec Systems

EMAIL: nater@northcoast.com

HTTP:www.northcoast.com/~nater/

"When I'm away from the office, 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 was a challenge of mine some time ago. I was having difficulty managing a few of my clients' hardware. For the most part their computers would monitor and correct any errors they found, but a few 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 - mostly weekends and at night. Since I'm not at my office during those times (or very rarely), I needed a way I could be notified when I'm needed.

Most consultants have a pager to leash them to the office, and in turn, to their clients. I'm not an exception. I decided to look into a way to get my clients' computers to page me directly when it runs across an error it correct on its own.

Since I use a generic paging service that just requires someone to enter their phone number from a touch tone phone, all I 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 focus on using Advanced Pick's commands. However, with slight modifications, using Main-Link, InfoLink, or other communication software, the same code can work on R83.

Advanced Pick supplies the basic commands SEND and GET. These commands allow the user to send and receive information directly from a port. This allows 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 to have the computer call the paging service and leave a message.

To start, I called the paging terminal and counted how many seconds after the dialing took place before I could send a meassge. (For me this was about 10 seconds.) From this information I constructed the following modem dialing string:

ATDT 441-9999,,,,,000 ;

+++

ATH

Each comma represents two seconds. '000' was the test string that I used to send to the paging service. The ';' is used to return to the command mode after dialing has completed. If you leave the ';' out the modem thinks that it is talking to another modem and tries to connect. The '+++' and 'ATH' hangs up the phone.

These sets of commands worked greate, except for one thing: The phone hung up before the paging service could complete its 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 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 wouldn't boot back up correctly. After fixing the problem, I looked into why the paging program didn't work.

Soon I discovered why. The paging service usually answers on the first ring, then after the message on what to do you put in the paging code. All this takes about 10 seconds. But on that particular day, the paging service was answering the phone on the second and third rings. Since the program was setup assuming for one ring, it prematurely hung up before the message was sent correctly.

I re-looked at the dialing command. By working with the paging company, I found a combination that finally worked no matter how many rings the phone is answered on.

By using a recorded message on the paging terminal with a six second pause in it and using the modem command string '@', the problem was solved. The '@' command causes the modem to pause and wait for five seconds worth of silence before continuing with the rest of the string.

By using the modem initial command of:

ATDT 441-9999 @,, 000 ;

+++

ATH

With a recorded message of "You've reached Nathan Rector's paging terminal. Please enter the phone number for a return call. There will be a five second pause before the beep...", then a six second pause, "Thank you".

I used a six second pause to make sure the modem picked up on the long pause. By adding the two commas (,) after the '@', I took care of the "Thank you" in the recorded message. The paging company needed the "Thank You" for their system to play the message with the five second pause correctly.

This simple program has since been adapted for you. Most businesses run large batch processes every night, and seem to always run into some kind of problem. My clients took this program and attached it those programs to let them know when they are done or have a problem.

Another use this program has is to monitor power outages and UPS systems for battery drainage.

If you use this program with semi-critical errors, beware that it works with most but isn't completely fool proof. If the system crashes, it cannot alert you. The program does rely on the computer to be working in order to dail the phone.

Note on program code: You may need to modify the code for your implementation in order for it to work correctly.

 

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