TCP/IP and Data Communications Administration Guide

Chat-Script Field

This field (also called the Login field) contains a string of characters called a chat script. The chat script contains the characters the local and remote machines must pass to each other in their initial conversation. Chat scripts have the format:

expect send [expect send] ....

expect represents the string that the local host expects to get from the remote host to initiate conversation. send is the string the local host sends after it receives the expect string from the remote host. A chat script can have more than one expect-send sequence.

A basic chat script might contain:

The expect field can be made up of subfields of the form:

expect[-send-expect]...

where -send is sent if the prior expect is not successfully read, and -expect following the send is the next expected string.

For example, with strings login--login, the UUCP on the local host expects login. If UUCP gets login from the remote machine, it goes to the next field. If it does not get login, it sends a carriage return, then looks for login again. If the local computer initially does not expect any characters, use the characters "" (NULL string) in the expect field. All send fields are sent followed by a carriage-return unless the send string is terminated with a \c.

Here is an example of a Systems file entry that uses an expect-send string:


sonora Any ACUEC 9600 2223333 "" \r \r ogin:-BREAK-ogin: Puucpx ssword: xyzzy

This example tells UUCP on the local host to send two carriage-returns and wait for ogin: (for Login:). If ogin: is not received, send a BREAK. When you do get ogin: send the login name Puucpx. When you get ssword: (for Password:), send the password xyzzy.

Table 12-2 lists some useful escape characters.

Table 12-2 Escape Characters Used in Systems File Chat Script

\b

Send or expect a backspace character. 

\c

If at the end of a string, suppress the carriage return that is normally sent. Ignored otherwise. 

\d

Delay 1-3 seconds before sending more characters. 

\E

Start echo checking. (From this point on, whenever a character is transmitted, it waits for the character to be received before doing anything else.) 

\e

Echo check-off.  

\H

Ignore one hangup. Use this option for dialback modems. 

\K

Send a BREAK character. 

\M

Turn on CLOCAL flag.

\m

Turn off CLOCAL flag.

\n

Send or expect a newline character. 

\N

Send a NULL character (ASCII NUL). 

\p

Pause for approximately 1/4 to 1/2 second. 

\r

Send or expect a carriage return. 

\s

Send or expect a space character. 

\t

Send or expect a tab character. 

EOT

Send an EOT followed by newline twice. 

BREAK

Send a break character. 

\ddd

Send or expect the character represented by the octal digits (ddd).

Enabling Dialback Through the Chat Script

Some companies set up dial-in servers to handle calls from remote computers. For example, your company might have a dial-in server with a dialback modem that employees can call from their home computers. After the dial-in server identifies the remote machine, it disconnects the link to the remote machine and then calls the remote machine back. The communications link is then reestablished.

You can facilitate dialback by using the \H option in the Systems file chat script at the place where dialback should occur. Include the \H as part of an expect string at the place where the dial-in server is expected to hang up.

For example, suppose the chat script that calls a dial-in server contains the following string:


INITIATED\Hogin:

The UUCP dialing facility on the local machine expects to get the characters INITIATED from the dial-in server. After the INITIATED characters have been matched, the dialing facility flushes any subsequent characters it receives until the dial-in server hangs up. The local dialing facility then waits until it receives the next part of the expect string, the characters ogin:, from the dial-in server. When it receives the ogin:, the dialing facility then continues through the chat script.

You need not have a string of characters directly preceding or following the \H, as shown in the sample string above.