home *** CD-ROM | disk | FTP | other *** search
-
-
-
- CHAT(8) CHAT(8)
-
-
- NNAAMMEE
- chat - Automated conversational script with a modem
-
- SSYYNNOOPPSSIISS
- cchhaatt [ _o_p_t_i_o_n_s ] _s_c_r_i_p_t
-
- DDEESSCCRRIIPPTTIIOONN
- The _c_h_a_t program defines a conversational exchange between
- the computer and the modem. Its primary purpose is to
- establish the connection between the Point-to-Point Proto¡
- col Daemon (_p_p_p_d) and the remote's _p_p_p_d process.
-
- OOPPTTIIOONNSS
- --ff _<_c_h_a_t _f_i_l_e_>
- Read the chat script from the chat _f_i_l_e. The use of
- this option is mutually exclusive with the chat
- script parameters. The user must have read access
- to the file. Multiple lines are permitted in the
- file. Space or horizontal tab characters should be
- used to separate the strings.
-
- --tt _<_t_i_m_e_o_u_t_>
- Set the timeout for the expected string to be
- received. If the string is not received within the
- time limit then the reply string is not sent. An
- alternate reply may be sent or the script will fail
- if there is no alternate reply string. A failed
- script will cause the _c_h_a_t program to terminate
- with a non-zero error code.
-
- --rr _<_r_e_p_o_r_t _f_i_l_e_>
- Set the file for output of the report strings. If
- you use the keyword _R_E_P_O_R_T, the resulting strings
- are written to this file. If this option is not
- used and you still use _R_E_P_O_R_T keywords, the _s_t_d_e_r_r
- file is used for the report strings.
-
- --vv Request that the _c_h_a_t script be executed in a ver¡
- bose mode. The _c_h_a_t program will then log all text
- received from the modem and the output strings
- which it sends to the SYSLOG.
-
- --VV Request that the _c_h_a_t script be executed in a
- stderr verbose mode. The _c_h_a_t program will then log
- all text received from the modem and the output
- strings which it sends to the stderr device. This
- device is usually the local console at the station
- running the chat or pppd program. This option will
- not work properly if the stderr is redirected to
- the /dev/null locaiton as is the case should pppd
- be run in the 'detached' mode. In that case, use
- the '-v' option to record the session on the SYSLOG
- device.
-
-
-
-
- Chat Version 1.9 5 May 1995 1
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- ssccrriipptt If the script is not specified in a file with the
- _-_f option then the script is included as parameters
- to the _c_h_a_t program.
-
- CCHHAATT SSCCRRIIPPTT
- The _c_h_a_t script defines the communications.
-
- A script consists of one or more "expect-send" pairs of
- strings, separated by spaces, with an optional "subexpect-
- subsend" string pair, separated by a dash as in the fol¡
- lowing example:
-
- ogin:-BREAK-ogin: ppp ssword: hello2u2
-
- This line indicates that the _c_h_a_t program should expect
- the string "ogin:". If it fails to receive a login prompt
- within the time interval allotted, it is to send a break
- sequence to the remote and then expect the string "ogin:".
- If the first "ogin:" is received then the break sequence
- is not generated.
-
- Once it received the login prompt the _c_h_a_t program will
- send the string ppp and then expect the prompt "ssword:".
- When it receives the prompt for the password, it will send
- the password hello2u2.
-
- A carriage return is normally sent following the reply
- string. It is not expected in the "expect" string unless
- it is specifically requested by using the \r character
- sequence.
-
- The expect sequence should contain only what is needed to
- identify the string. Since it is normally stored on a disk
- file, it should not contain variable information. It is
- generally not acceptable to look for time strings, network
- identification strings, or other variable pieces of data
- as an expect string.
-
- To help correct for characters which may be corrupted dur¡
- ing the initial sequence, look for the string "ogin:"
- rather than "login:". It is possible that the leading "l"
- character may be received in error and you may never find
- the string even though it was sent by the system. For this
- reason, scripts look for "ogin:" rather than "login:" and
- "ssword:" rather than "password:".
-
- A very simple script might look like this:
-
- ogin: ppp ssword: hello2u2
-
- In other words, expect ....ogin:, send ppp, expect
- ...ssword:, send hello2u2.
-
- In actual practice, simple scripts are rare. At the vary
-
-
-
- Chat Version 1.9 5 May 1995 2
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- least, you should include sub-expect sequences should the
- original string not be received. For example, consider the
- following script:
-
- ogin:--ogin: ppp ssowrd: hello2u2
-
- This would be a better script than the simple one used
- earlier. This would look for the same login: prompt, how¡
- ever, if one was not received, a single return sequence is
- sent and then it will look for login: again. Should line
- noise obscure the first login prompt then sending the
- empty line will usually generate a login prompt again.
-
- AABBOORRTT SSTTRRIINNGGSS
- Many modems will report the status of the call as a
- string. These strings may be CCOONNNNEECCTTEEDD or NNOO CCAARRRRIIEERR or
- BBUUSSYY. It is often desirable to terminate the script should
- the modem fail to connect to the remote. The difficulty is
- that a script would not know exactly which modem string it
- may receive. On one attempt, it may receive BBUUSSYY while the
- next time it may receive NNOO CCAARRRRIIEERR.
-
- These "abort" strings may be specified in the script using
- the _A_B_O_R_T sequence. It is written in the script as in the
- following example:
-
- ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ATDT5551212
- CONNECT
-
- This sequence will expect nothing; and then send the
- string ATZ. The expected response to this is the string
- _O_K. When it receives _O_K, the string ATDT5551212 to dial
- the telephone. The expected string is _C_O_N_N_E_C_T. If the
- string _C_O_N_N_E_C_T is received the remainder of the script is
- executed. However, should the modem find a busy telephone,
- it will send the string _B_U_S_Y. This will cause the string
- to match the abort character sequence. The script will
- then fail because it found a match to the abort string. If
- it received the string _N_O _C_A_R_R_I_E_R, it will abort for the
- same reason. Either string may be received. Either string
- will terminate the _c_h_a_t script.
-
-
- RREEPPOORRTT SSTTRRIINNGGSS
- A rreeppoorrtt string is similar to the ABORT string. The dif¡
- ference is that the strings, and all characters to the
- next control character such as a carriage return, are
- written to the report file.
-
- The report strings may be used to isolate the transmission
- rate of the modem's connect string and return the value to
- the chat user. The analysis of the report string logic
- occurs in conjunction with the other string processing
- such as looking for the expect string. The use of the same
-
-
-
- Chat Version 1.9 5 May 1995 3
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- string for a report and abort sequence is probably not
- very useful, however, it is possible.
-
- The report strings to no change the completion code of the
- program.
-
- These "report" strings may be specified in the script
- using the _R_E_P_O_R_T sequence. It is written in the script as
- in the following example:
-
- REPORT CONNECT ABORT BUSY '' ATDT5551212 CONNECT ''
- ogin: account
-
- This sequence will expect nothing; and then send the
- string ATDT5551212 to dial the telephone. The expected
- string is _C_O_N_N_E_C_T. If the string _C_O_N_N_E_C_T is received the
- remainder of the script is executed. In addition the pro¡
- gram will write to the expect-file the string "CONNECT"
- plus any characters which follow it such as the connection
- rate.
-
- TTIIMMEEOOUUTT
- The initial timeout value is 45 seconds. This may be
- changed using the --tt parameter.
-
- To change the timeout value for the next expect string,
- the following example may be used:
-
- ATZ OK ATDT5551212 CONNECT TIMEOUT 10 ogin:--ogin:
- TIMEOUT 5 assowrd: hello2u2
-
- This will change the timeout to 10 seconds when it expects
- the login: prompt. The timeout is then changed to 5 sec¡
- onds when it looks for the password prompt.
-
- The timeout, once changed, remains in effect until it is
- changed again.
-
- SSEENNDDIINNGG EEOOTT
- The special reply string of _E_O_T indicates that the chat
- program should send an EOT character to the remote. This
- is normally the End-of-file character sequence. A return
- character is not sent following the EOT. The EOT sequence
- may be embedded into the send string using the sequence
- _^_D.
-
- GGEENNEERRAATTIINNGG BBRREEAAKK
- The special reply string of _B_R_E_A_K will cause a break con¡
- dition to be sent. The break is a special signal on the
- transmitter. The normal processing on the receiver is to
- change the transmission rate. It may be used to cycle
- through the available transmission rates on the remote
- until you are able to receive a valid login prompt. The
- break sequence may be embedded into the send string using
-
-
-
- Chat Version 1.9 5 May 1995 4
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- the _\_K sequence.
-
- EESSCCAAPPEE SSEEQQUUEENNCCEESS
- The expect and reply strings may contain escape sequences.
- All of the sequences are legal in the reply string. Many
- are legal in the expect. Those which are not valid in the
- expect sequence are so indicated.
-
- '''' Expects or sends a null string. If you send a null
- string then it will still send the return charac¡
- ter. This sequence may either be a pair of apostro¡
- phe or quote characters.
-
- \\bb represents a backspace character.
-
- \\cc Suppresses the newline at the end of the reply
- string. This is the only method to send a string
- without a trailing return character. It must be at
- the end of the send string. For example, the
- sequence hello\c will simply send the characters h,
- e, l, l, o. _(_n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\dd Delay for one second. The program uses sleep(1)
- which will delay to a maximum of one second. _(_n_o_t
- _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\KK Insert a BREAK _(_n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\nn Send a newline or linefeed character.
-
- \\NN Send a null character. The same sequence may be
- represented by \0. _(_n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\pp Pause for a fraction of a second. The delay is
- 1/10th of a second. _(_n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\qq Suppress writing the string to the SYSLOG file. The
- string ?????? is written to the log in its place.
- _(_n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- \\rr Send or expect a carriage return.
-
- \\ss Represents a space character in the string. This
- may be used when it is not desirable to quote the
- strings which contains spaces. The sequence 'HI
- TIM' and HI\sTIM are the same.
-
- \\tt Send or expect a tab character.
-
- \\\\ Send or expect a backslash character.
-
- \\dddddd Collapse the octal digits (ddd) into a single ASCII
- character and send that character. _(_s_o_m_e _c_h_a_r_a_c_¡
- _t_e_r_s _a_r_e _n_o_t _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
-
-
- Chat Version 1.9 5 May 1995 5
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- ^^CC Substitute the sequence with the control character
- represented by C. For example, the character DC1
- (17) is shown as ^Q. _(_s_o_m_e _c_h_a_r_a_c_t_e_r_s _a_r_e _n_o_t
- _v_a_l_i_d _i_n _e_x_p_e_c_t_._)
-
- TTEERRMMIINNAATTIIOONN CCOODDEESS
- The _c_h_a_t program will terminate with the following comple¡
- tion codes.
-
- 00 The normal termination of the program. This indi¡
- cates that the script was executed without error to
- the normal conclusion.
-
- 11 One or more of the parameters are invalid or an
- expect string was too large for the internal
- buffers. This indicates that the program as not
- properly executed.
-
- 22 An error occurred during the execution of the pro¡
- gram. This may be due to a read or write operation
- failing for some reason or chat receiving a signal
- such as SIGINT.
-
- 33 A timeout event occurred when there was an _e_x_p_e_c_t
- string without having a "-subsend" string. This may
- mean that you did not program the script correctly
- for the condition or that some unexpected event has
- occurred and the expected string could not be
- found.
-
- 44 The first string marked as an _A_B_O_R_T condition
- occurred.
-
- 55 The second string marked as an _A_B_O_R_T condition
- occurred.
-
- 66 The third string marked as an _A_B_O_R_T condition
- occurred.
-
- 77 The fourth string marked as an _A_B_O_R_T condition
- occurred.
-
- ...... The other termination codes are also strings marked
- as an _A_B_O_R_T condition.
-
- Using the termination code, it is possible to determine
- which event terminated the script. It is possible to
- decide if the string "BUSY" was received from the modem as
- opposed to "NO DIAL TONE". While the first event may be
- retried, the second will probably have little chance of
- succeeding during a retry.
-
- SSEEEE AALLSSOO
- Additional information about _c_h_a_t scripts may be found
-
-
-
- Chat Version 1.9 5 May 1995 6
-
-
-
-
-
- CHAT(8) CHAT(8)
-
-
- with UUCP documentation. The _c_h_a_t script was taken from
- the ideas proposed by the scripts used by the _u_u_c_i_c_o pro¡
- gram.
-
- uucico(1), uucp(1)
-
- CCOOPPYYRRIIGGHHTT
- The _c_h_a_t program is in public domain. This is not the GNU
- public license. If it breaks then you get to keep both
- pieces.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Chat Version 1.9 5 May 1995 7
-
-
-