Classic Computer Magazine Archive COMPUTE! ISSUE 25 / JUNE 1982 / PAGE 135

Using The Telephone

Michael E. Day
Chief Engineer
Edge Technology
West Linn, OR

Did you ever wonder just how a computer can "pick up" a phone, call another computer, and then hang up? How you can "call" the operator without dialing zero? When you hear the ring, is it really the bell at the other phone making the sound? This month, Mike clears up these and other telephone mysteries.

An important part of the data communications link is the phone line itself. Since we don't have any direct control over the telephone system, it can present real problems when trying to use it with a computer.

There are three major operations that a computer must be able to perform in order to place a call. The first is the actual placement of the call. The second is the data transfer, the use of the line. Finally, the third operation is the hang-up procedure.

At first glance, these actions might seem rather simple things, but, for a computer, they can be a nightmare. Until recently, the phone company would not even allow you to attach your computer to the phone line. Several court cases, and a recent change in the attitude of the FCC has changed the situation. Now you are allowed to attach your computer (or any other device) to the phone line. The only restrictions are that the attaching device be certified by the FCC and that the phone company be notified.

How One Computer Dials Another

By looking at how a call is normally placed, we can see what a computer must do to place a call.

When nothing is going on, the phone line is in an idle condition. In this state, there is approximately 48 volts DC between the red and green wires of the line. (They are referred to as the tip and the ring of the phone line. Long ago, the red wire was attached to the tip and the green wire was attached to the first ring of the old switchboard plugs.) The 48 volts is provided by the telephone exchange.

To place a call, the first thing you do is remove the handset from the telephone and place it to your ear to wait for the dial tone. The tone indicates that the exchange has recognized that you want to place a call and that you may now begin dialing. From a computer's standpoint, this is a bit of a problem. Essentially, it must rely on a hardware device to do the actual dial tone detection for it: a dial tone detector.

There is a little trick we can pull, however. If you have ever observed people placing a call, you will notice that many do not place the handset to their ear and wait for the dial tone before they begin dialing. This is generally because they are unaware of the requirement or have simply developed a routine which bypasses the need to detect the dial tone. This is possible because over 90% of all call requests are answered within two seconds, and 99.9% within five seconds, on most phone exchanges.

So, by simply performing a routine that causes the dialing to begin sometime after two seconds have passed, you can be assured that most of your calls will get through without ever listening for the dial tone. This is easy to do with the computer; a computer is quite good at waiting. We just wait five seconds after simulating picking up the handset and assume that we have the dial tone. This is called blind dialing.

Once we have a dial tone (or think we do) the dialing process can begin. On a touch tone style phone, this is done by sending audio tones to the exchange that are coded to represent the numbers we wish to dial. Eight separate tones are used in pairs to represent the various numbers and codes available with the touch tone system. For a computer to dial this way it must have another piece of hardware, a touch tone dialer. However, there is another little trick that can be used to get around this problem, if you are unwilling to pay for the touch tone dialer or you do not have the touch tone system available to you. Use the rotory dial method.

The actual timing of the dialing is critical on a rotary dial style phone. The dialing is accomplished by momentarily "releasing" the phone line and then "retaking" it again (as if you were to quickly hang the phone up and pick it back up again).

For each number to be dialed, there is a corresponding number of pulses of this sort to be generated. If a one is to be dialed, only a single release sequence is performed. For a nine, there would be nine release sequences. A zero is represented by ten release sequences. This is why you can sometimes reach the operator by simply jiggling the handset button on the telephone since you are simulating dialing the zero for operator. With few exceptions, all touch tone systems can handle rotary dial operations.

This means that it is possible to forego the touch tone completely and use a relay that we also use to simulate raising the handset for the dial tone.

Timing is critical with rotary dialing: the time of the pulses, and the time between the pulses, must be carefully watched. The release time must be 61 milliseconds, plus or minus three milliseconds, and the time between pulses must be 39 milliseconds, plus or minus three milliseconds. Additionally, the time between digits dialed must be greater than 600 milliseconds, but less than ten seconds. That is, after you sent the pulses to dial a five, you must wait at least 600 milliseconds before starting the pulse sequence for a two. This waiting time is done with the phone "off hook."

Once the dialing has been completed, we then wait for the ring-back signal. This is a signal the exchange sends back to you that indicates that it is ringing the phone that you have called. This signal is not the actual ringing of the other phone. It is generated at the exchange for you to hear at your end. The two "rings" are not synchronized and you should not assume that when you hear a ring signal it is occurring at the same time at the other end.

If, after waiting, the phone is not answered, or you get a busy signal, you hang up your own phone which terminates the call. If the ringing sound does not occur, you hang up and try placing the call again — assuming that you did something wrong.

For a computer, all this could be a bit tricky. It must be able to recognize the ringing signal, the various busy signals, dialing errors, or wrong numbers. However, if we concentrate on the ends, not the means, it all comes down to a single, simple action.

A Greatly Simplified Method

If the phone at the other end is busy, doesn't answer, was incorrectly dialed, or the wrong party is reached, we can simply hang up the phone and try again. So all we really need to know is if the computer at the other end has answered. This is one of the functions of a modem. [The box that attaches to a computer and handles telephone calls for it.] If the called computer's modem is in the auto-answer mode, then that modem will answer the phone and send a signal back to your modem saying that it has answered. All we have to do after we have dialed the number is sit and wait for the answer signal. If we don't receive an answer after a specified period of time, for any reason, we hang up the phone.

To make things even easier, the answer signal that is sent is the same kind of signal that the modem uses to transmit data. All we have to do is wait for our modem to tell us that it is ready to communicate with the distant computer. This bypasses many kinds of error indicators. We don't care why we were unable to complete the call, only that we weren't. Once a signal has been received, the computers can communicate until they are ready to hang up.

Normally, when you are finished with a call you tell the party you are talking with that you are done and hang up. Alternatively, they may tell you that they are going to hang up. Sometimes, for various reasons, either of you may hang up without telling the other. And, of course the phone company may hang up for either or both of you due to a malfunction. This, too, could get to be rather complicated for a computer unless we recognize that the end result of any such hang-ups is that the communications link has simply been broken. This means that we are no longer receiving the carrier from the other modem. Therefore, we just observe the carrier detection signal from the modem and, if it goes out, we know we've lost the connection and that we should hang up the phone.

A Computer Picks Up The Phone

Normally, when someone calls we hear the bell. This signal is created by the exchange by rapidly reversing the 48 volt signal that is present on the phone line when it is in the idle state. This reversal occurs about 20 times a second for several seconds, pauses, and then repeats.

The rate of the reversal can vary from exchange to exchange and may be anywhere between 16 times a second to 60 times a second. A modem can detect this signal, (assuming you have an auto-answer modem) and can generate its own signal called the ring indicator. Depending on the modem, the ring indicator signal may either echo the line reversals of the phone line, or just be on for the duration of the ringing signal.

Once there is a ring indicator signal, it is up to your computer to recognize that the signal is there and to send a DTR signal to your modem to tell it to go ahead and answer the call. (The DTR signal could also be left always on, indicating to the modem that the computer will answer any call immediately.)

The modem answers a call by turning on the "off-hook relay" which simulates taking the handset off of the phone hook or cradle. This causes a low impedence load to be placed on the phone line (approximately 600 ohms) and it remains as long as the phone is off-hook. This tells the exchange that you have accepted the call and are ready to answer it. The exchange then begins a supervisory process to stabilize the link and begin any necessary billing.

During all this, the answering modem cannot yet transmit any data; it may disrupt the supervisory process. Most of the new exchanges simply prevent any signals from being transferred during this time, but some of the older exchanges don't have this protection and signals could get disrupted. This could cause anything from the exchange hanging up on you to its billing you for a call you didn't make. This time period of disallowed transmission lasts a maximum of two seconds. Once this time period has passed, the computers can communicate normally. If you later lose the carrier signal, you should assume that the other end has hung up their phone and hang up yours.