Download   Online Shop   Red Hat Network
Home  |  Products & Services  |  Support  |  Training  |  Partners  |  Documentation   
Red Hat Documentation

Overview | HOWTOs | mini-HOWTOs | FAQs | Linux Man-Pages

Modem-HOWTO : Dial-In 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 PC (at your phone number) and use your PC. The "point of view" here 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 the getty program is notified and starts the login process for the caller. The original method was to send a login prompt to the caller's screen (manual login). It's still used but if you let callers use the PPP protocol then the login can take place automatically after a PPP connection is started from both sides. See the PPP-HOWTO for more details.

After the caller has logged in, the caller then may use 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 Getty

56k doesn't work

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

  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" (RAS) 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 helps answers the telephone. Originally getty was used for logging in to a computer from a dumb terminal. A major use of it today is 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. The getty program is usually started at boot-time. It must be called from the /etc/inittab file. In this file you may find some examples which you will likely need to edit a bit. Hopefully these examples will be for the flavor of getty installed on your PC.

There are four different getty programs to choose from that may be used with modems for dial-in: mgetty, uugetty, getty_em, and agetty. A brief overview is 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.

In order to see what documentation exists about the various gettys on your computer, use the "locate" command. Type: locate "*getty*" (including the quotes may help). Note that many distributions just call the program getty even though it may actually be agetty, uugetty, etc. But if you read the man page (type: man getty), it might disclose which getty it is. This should be the getty program with path /sbin/getty.

About mgetty

mgetty was written as a replacement for uugetty which was in existence long before mgetty. Both are for use with modems. mgetty may be also used for directly connected terminals. Mgetty doesn't (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, mingetty, and fbgetty

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. agetty in the Debian distribution is just named getty.

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

fbgetty is also only for monitors and supports framebuffers.

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 completed your modem sends a "CONNECT" 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 aka DCD) 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 the modem has negated CD (the modem is idle). Then the getty program waits at the open statement in the program until a CD signal is asserted. 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 CD is negated. Well, there's a way to write a program to force the port to open even if there is no CD signal asserted.

11.4 Why Manual Answer is Best

The difference between the two ways of answering is exhibited 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 Ending a Dial-in Call

Caller logs out

When the call is over the normal way to end the connection is for the user to log out. This will kill the user's shell. As a result, getty will respawn and a hangup signal (negates DTR) will be sent from the host's serial port to the modem. This will only happen if stty -a shows hupcl (hang up on close) but this should be the default. The modem getting the negated DTR signal will then hang up the phone line (provided the modem has been configured to do this --see below). The modem should then be ready to answer any new incoming calls. Killing the user's shell causes getty to respawn and wait for the next call.

As an alternative to using DTR to tell the modem to hang up the phone line, a script used when getty respawns may send the unique escape code sequence +++ to the modem to put it into AT command mode. The +++ must have both an initial and final time delay. Once in AT command mode, a hangup command (H0) may be sent to the modem as well as other AT commands. If the PC fails to successfully signal the modem when a logout happens (or to use the +++ escape when restarting getty), then the modem is apt to remain in on-line mode and no more incoming calls can be received.

When DTR drops (is negated)

When DTR (the "hang-up" signal) is negated, what the modem does depends on the value of the &D option in the modem's profile. If it's &D0 nothing at all happens (the modem ignores the negation of DTR).

&D2: The modem will hang up and go into AT command mode (off-line) to wait for the next call. Except that it will not automatically answer the phone (if it should) until DTR is asserted again. But since getty is set to respawn (in /etc/inittab) then getty will immediately restart after a logout and this will assert DTR. So what happens when someone logs out is that DTR only is negated for a fraction of a second (winks) before it gets asserted again. The DTR must be negated for at least the time specified by register S25.

&D3: In this case the modem does a hard reset: It hangs up and restores the saved profile . It should be now in the same state it was in when first powered on and it's ready for incoming calls. The S25 limit may have no effect so even a very short "wink" is detected. Another brand of modem says the S25 limit is still valid. Thus &D3 this is a stronger "reset" than &D2 which doesn't restore the saved profile and may require a longer wink to work.

If you don't know which of the above two to use try using &D3 first. Under favorable conditions, either one should work OK.

Caller hangs up

Instead of logging out the normal way, a caller may simply hang up. This results in a lost connection and of course a loss of carrier. Other problems could also cause a loss of carrier. The "NO CARRIER" result code is displayed. The modem hangs up and waits for the next call. Except that there is no getty running yet to start the login process.

Here's how getty gets started again: The loss of carrier should negate the DCD signal sent by the modem to the serial port (provided &C1 has been set). When the the PC's serial port gets the negated DCD signal it should kill the shell and then getty should respawn.

This paragraph is about other things that happen but do nothing. Only the curious need read it. When the shell is killed a DTR wink is sent to the modem but since the modem is not on-line anymore and has already hung up, the modem ignores the negation of DTR (hang up). The loss of carrier also negates the DSR signal sent by the modem to the serial port (provided &S1 or &S2 is set) but this signal is ignored (by Linux).

11.6 Dial-in Modem Configuration

The getty programs have a provision for sending an init string to the modem to configure it. But you may need to edit it. Another method is to save a suitable init string inside the modem (see Init Strings: Saving and Recalling for how to save it in the modem).

The configuration for dial-in depends both on the getty you use and possibly on your modem. If you can't find suggested configurations in other documentation here are some hints using Hayes AT commands:

  • &C1 Make the DCD line to the serial port track the actual state of the carrier (DCD asserted only when there's carrier). Getty_em requires &C0 (DCD always asserted)
  • &D3 Do a hard reset of the modem when someone logs out (or hangs up). For some modems it's reported that &D2 is required since they can't tolerate a hard reset ??
  • &K3 Use hardware flow control
  • V1 Display results (such as CONNECT) in words (and not in code)
  • Q0 Echo results words (such as CONNECT). Most gettys use them. But it's reported an AT&T version of uugetty requires Q2 (no result words for dial-in)
  • S0=? mgetty suggests S0=0 (manual answer). If you set S0=3 the modem will auto-answer on the 3rd ring, etc. Agetty uses auto-answer. So does uugetty (usually).
  • E0 Don't echo AT commands back to the serial port. Some suggest E1 (echo AT commands). It should work either way. For dial-out you want E1 so you can see what was sent.
  • X4 Check for dialtone and busy signal
  • M0 Modem speaker always off. M1 is only off when connected.

11.7 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.8 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

 

 
 
Search for:  on    Powered by Google
Products & Services   :   Download   :   Support   :   Training   :   Partners & Programs
© 2001 Red Hat, Inc. All right reserved.       About Red Hat   :   Legal statement   :   Privacy statement   :   Y2K statement   :   Contact Red Hat