# How do I dial in and out with my modem?

Get your modem to dial out correctly.

### Dial in and out modem configuration

For dial in and dial out use, you have to set up your modem a certain way (again, using the `AT` command on your modem):

> `

>     E1       command echo on
>     Q0       result codes are reported
>     S1=1     auto answer (on ring #1 - change this to whatever ring you
>              want to answer on)

> `

If you don't set these correctly, your `INIT` string in `/etc/default/uugetty.ttyS*` may fail, hosing the whole process.

> `

>     &C1 DCD is on after connect only

> `

If DCD is always on, `getty` will always think there is a connection, and may try to log people in.

Other things you should set:

> `

>     &S0 DSR is always on
>     &D3 DTR on/off resets modem
>     enable your data compression (setting depend on modem manufacturer,
>                                   consult your modem manual)
>     autobaud                     (same applies here)
>     enabling RTS/CTS             (here too)

> `

If your modem does not support a stored profile, you can set these through the `INIT` string in your `/etc/default/uugetty.ttyS*` config file. See below.

### Setting up `uugetty`

Replace the stock `getty` with `getty_ps` as described in HOWTO section 2. Update `/etc/gettydefs` to include entries for modems (note that the entries point to each other, these are not for fixed speed):

> `

>     # Modem entries
>     38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200

>     19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600

>     9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400

>     2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #1200

>     1200# B1200 CS8 # B1200 SANE -ISTRIP HUPCL #@S @L @B login: #300

>     300# B300 CS8 # B300 SANE -ISTRIP HUPCL #@S @L @B login: #38400

> `

If you have a 9600 bps or faster modem with flow control, you can lock your serial port speed and let the modem handle the translation to other bps rates. Then, instead of the step down series of lines listed below, `etc/gettydefs` only needs to contain one line for the modem:

> `

>     38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S login: #38400

> `

or

> `

>     19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S login: #19200

> `

If you have your modem set up to do RTS/CTS hardware flow control, you can add CRTSCTS to the entries.

Next, make sure that you have a dialin and dialout device for the port and your modem is on. If you have your modem on `/dev/cua1`, you will need a device called `/dev/ttyS1`. If you don't have the correct devices, see the section on how to create devices, and create the devices.

### Customizing `getty_ps`

There are lots of parameters you can tweak for each port you have. These are implemented in seperate config files for each port, if you want. The file `/etc/default/getty` will be used by all instances of `uugetty`, and `/etc/default/uugetty.tty*` will only be used by that one port. Sample default config files can be found with the `getty_ps` source files, which come with most Linux distributions. Due to space concerns, they are not listed here. My `/etc/default/uugetty.ttyS3` looks like this:

> `

>     # sample uugetty configuration file for a Hayes compatible modem to allow
>     # incoming modem connections
>     #
>     # this config file sets the modem to autoanswer.

>     # alternate lockfile to check... if this lockfile exists, then uugetty is
>     # restarted so that the modem is re-initialized
>     ALTLOCK=cua3
>     INITLINE=cua3

>     # timeout to disconnect if idle...
>     TIMEOUT=60

>     # modem initialization string...
>     #
>     # format: <expect> <send> ... (chat sequence)
>     INIT="" \d+++\dAT\r OK\r\n ATH0\r OK\r\n AT\sE1\sQ0\sATS0=1\r OK\r\n

>     # this line sets the time to delay before sending the login banner
>     DELAY=1

> `

Add the following line to your `/etc/inittab`, so that `uugetty` is run on your serial port:

> `

>     S1:456:respawn:/etc/uugetty ttyS1 38400
>     (^port without "tty"        ^port ^-- put your highest modem speed here)

> `

Restart `init`:

> `

>     linux# kill -HUP 1

> `

Now Linux will be watching your serial port for connections.

Dial in from another site and log in to you Linux system. Rejoice.