Next Previous Contents

11. Dial-In

11.1 Overview

Dial-in is where you set up your PC so that others may dial in to your phone number and use your PC. The "point of view" is your PC. When you dial out from your PC you are also dialing in to another computer (but not dialing in to your own computer)

Dial-in works like this. Someone with a modem dials your telephone number. Your modem answers the call and connects. Once the caller is connected, your PC (via the getty program) starts the login process for the caller. The original method was to send a login prompt to the caller's screen (manual login). But a more modern method (if you use mgetty) is to start PPP (pppd) and let PPP automatically login the caller (no need to manually type in a name or password). See the PPP-HOWTO (new revision expected soon) and docs for mgetty for more details.

After the caller has logged in, the caller uses your PC. Using your PC may mean that the caller has a shell account and can use your PC just as if they logged in at the console (or from a text-terminal). It could also mean that they get connected to the Internet thru your PC (via PPP). The program that you use at your PC to handle dialin is called getty or mgetty. See About mgetty.

If you expect that people will be able to dial-in to you at 56k, it can't be done unless:

  1. You have a digital connection to the telephone company such as a trunkside-T1 or ISDN line
  2. You use special digital modems (see Digital Modems)
  3. You have a "... concentrator", or the like to interface your digital-modems to the digital lines of the telephone company.
A "... concentrator" may be called a "modem concentrator" or a "remote access concentrator" or it could be included in a "remote access server" which includes the digital modems, etc. This type of setup is used by ISPs (Internet Service Providers).

11.2 Getty

getty is the program you run for dialin. You don't need it for dialout. In addition to presenting a login prompt, it also answers the telephone. Originally getty was used for logging in to a computer from a dumb terminal. It's currently used for logging in to a Linux console). There are a few different getty programs with slightly different names. Only certain ones work with modems for dialin. This getty program is usually started at boot-time. It must be called from the /etc/inittab file. You may find an example in this file of a call to getty which you will likely need to edit a bit. If you use a different getty program than the one shown in such an example, then you will need to edit it quite a bit since the options will have a different format.

There are four different getty programs to choose from that may be used with modems for dialin: mgetty, uugetty, getty_em, and agetty. A few details are given in the following subsections. agetty is the simplest (and weakest) of the four and some consider it mainly for use with directly connected text-terminals. mgetty has support for fax and voice mail but Uugetty doesn't. mgetty allegedly lacks a few of the features of uugetty. getty_em is a simplified version of uugetty. Thus mgetty is likely your best choice unless you are already familiar with uugetty (or find it difficult to get mgetty). The syntax for these getty programs differs, so be sure to check that you are using the correct syntax in /etc/inittab for whichever getty you use.

About mgetty

mgetty was written as a replacement for uugetty which was in existence long before mgetty. Both are for use with modems. Although mgetty may be also used for directly connected terminals the documentation for this is hard to pinpoint and mgetty will not (as of mid 1999) support software flow control (used on many terminals) without recompiling. This defect is listed as a bug. In addition to allowing dialup logins, mgetty also provides FAX support and auto PPP detection. There is a supplemental program called vgetty which handles voicemail for some modems. mgetty documentation is good (except for voice mail), and does not need supplementing . Please refer to it for installation instructions. You can find the latest information on mgetty at http://www.leo.org/~doering/mgetty/ and http://alpha.greenie.net/mgetty

About uugetty

getty_ps contains two programs: getty is used for console and terminal devices, and uugetty for modems. Greg Hankins (former author of Serial-HOWTO) used uugetty so his writings about it are included here. See Uugetty. The other gettys are well covered by the documentation that comes with them.

About getty_em

This is a simplified version of ``uugetty''. It was written by Vern Hoxie after he became fully confused with complex support files needed for getty_ps and uugetty.

It is part of the collection of serial port utilities and information by Vern Hoxie available via ftp from scicom.alphacdc.com/pub/linux. The name of the collection is ``serial_suite.tgz''. When logging into ``scicom'' as "anonymous", you must use your full e-mail address as the password. For example: greg.hankins@cc.gatech.edu

About agetty and mingetty

agetty is a simple, completely functional implementation of getty which is best suited for virtual consoles or terminals rather than modems. But it works fine with modems under favorable conditions (except you cannot dial out when agetty is running and waiting for a call). agetty in the Debian distribution is just named getty.

mingetty is a small getty that will work only for consoles (monitors) so you can't use it with modems for dialin.

11.3 What Happens when Someone Dials In ?

The caller runs some sort of communication program that dials your telephone number and your telephone rings. There are two different ways that your PC can answer the phone. One way is for the modem to automatically answer the call. The other way is for getty to sense the ringing and send a command to the modem to answer the call. Once the call is answered, your modem sends tones to the other modem (and conversely). The two modems negotiate how they will communicate and when this is done your modem sends a "CONNECTed" message (or the like) to getty. When getty gets this message, it sends a login prompt out the serial port. Sometimes getty just calls on a program named login to handle the logging in. getty usually starts running at boot-time but it must wait until a connection is made before sending out a "login" prompt.

Now for more details on the two methods of answering the call. By setting the S0 register of the modem to 3, the modem will automatically answer on the 3rd ring. If it's set to 0 then the modem will only answer the call if getty sends it an "A" (= Answer) command while the phone is ringing. Actually an "ATA" is sent since all modem commands are prefixed by "AT". You might think it best to utilize the ability of the modem to automatically answer the call, but it's actually better if getty answers it. If the modem doesn't automatically answer, it's called manual answer (even though getty automatically handles it).

For the "manual" answer case, getty opens the port at boot-time and listens. When the phone rings, a "RING" message is sent to the listening getty. Then if getty wants to answer this ring, it sends the modem an "ATA" command. The modem then makes a connection and sends a "CONNECT ..." message to getty which then sends a login prompt to the caller.

The automatic answer case uses the CD (Carrier Detect) wire from the modem to the serial port to detect when a connection is made. It works like this. At boot-time getty tries to open the serial port but the attempt fails since there is normally no CD signal from the modem. Then the getty program waits at the open statement in the program until a CD signal appears. When a CD signal arrives (perhaps hours later) then the port is opened and getty sends the login prompt. While getty is waiting (sleeping) at the open statement, other processes can run since Linux is a multiprocessing operating system. What actually wakes getty up is an interrupt which is issued when the CD line from the modem changes state to on.

You may wonder how getty is able to open the serial port in the manual-answer case since there is no CD signal. Well, there's a way to write a program to force the port to open even if there is no CD signal present.

11.4 Why Manual Answer is Best

The difference between the two ways of answering will show itself when the computer happens to be down but the modem is still working. For the manual case, the "RING" message is sent to getty but since the computer is down, getty isn't there and the phone never gets answered. There are no telephone charges when there is no answer. For the automatic answer case, the phone is answered but no login message is ever sent since the computer is down. The phone bill runs up as the waiting continues. If the phone call is toll-free, it doesn't make much difference, although it may be frustrating waiting for a login prompt that never arrives. mgetty uses manual answer. Uugetty can do this too using a configuration script.

11.5 Callback

Callback is where someone first dials in to your modem. Then, you get a little info from the caller and then call it right back. Why would you want to do this? One reason is to save on telephone bills if you can call the caller cheaper than the caller can call you. Another is to make sure that the caller really is who it claims to be. If a caller calls you and claims to be calling from its usual phone number, then one way to verify this is to actually place a new call to that number.

There's a program for Linux called "callback" that works with mgetty. It's at ftp://ftp.icce.rug.nl/pub/unix/. Step-by-step instructions on how someone installed it (and PPP) is at http://www.stokely.com/unix.serial.port.resources/callback.html

11.6 Voice Mail

Voice mail is like an answering machine run by a computer. To do this you must have a modem that supports "voice" and supporting software. Instead of storing the messages on tape, they are stored in digital format on a disk. When a person phones you, they hear a "greeting" message and can then leave a message for you. More advanced systems would have caller-selectable mail boxes and caller-selectable messages to listen to. Free software is available in Linux for simple answering, but doesn't seem to be available yet for the more advanced stuff.

I know of two different voicemail packages for Linux. One is a very minimal package (see Voicemail Software). The other, more advanced, but currently poorly documented, is vgetty. It's an optional addition to the well documented and widely distributed mgetty program. It supports ZyXEL-like voice modem commands. In the Debian distribution, you must get the mgetty-voice package in addition to the mgetty package and mgetty-doc package. Obsolete documentation has been removed from mgetty but replacement documentation is lacking (except if you use the -h (help) option when running certain programs, etc.). But one sees postings about using it on the mgetty newsgroup. See About mgetty. It seems that vgetty is currently not very stable but it's successfully being used and development of it continues. If this is the latest version of this HOWTO can someone who is familiar with vgetty please let me know its current status.


Next Previous Contents