Next: , Previous: Command Line Interface, Up: Usage


3.3 Chat Scripts

Often there is something which needs to be done to prepare the link before the PPP protocol can be started; chat script is used for this purpose. Usually chat script is required to initialize the modem and dial the appropriate phone number, but sometimes it also required for authentication purpose.

3.3.1 Predefined Scripts

The program have few predefined chat scripts:

predef-noterm is simple script, that don't uses terminal authentication. It is suitable only for PAP (Password Authentication Protocol) and CHAP (Challenge Handshake Authentication Protocol) authentication.

predef-term is simple script, that uses terminal authentication. It is suitable only for terminal authentication.

predef-auto is more complex, and can automatically determine authentication type. It is suitable for PAP, CHAP, and terminal authentication.

predef-dialin is used to wait for and answer to incomming calls.

You can select predefined script in field Use Script which is in tab Authentication in the account editing window. Or, if you use command line interface, by assigning appropriate value to the use_script account attribute.

3.3.2 Custom Script

You can specify your own chat script for connecting. Go to tab Authentication in the account editing window, then in Use Script field select Custom, then write your script in tab Custom Script. The syntax of the chat script is the same as the syntax of program chat, see chat(8) man page. Chat scripts can use predefined macros. The syntax for calling a macro is: ‘%(macro_name)s’. There are predefined macros that contain account attributes. Names of these macros are same as names of the account attributes they contain, see Account Attributes. Additionally, you can use following macros:

Macro Name Description
phone_number Current ISP phone number.
vol_cmd Modem command that sets speaker volume.

Example of a simple chat script with macros:

     ABORT 'BUSY'
     ABORT 'ERROR'
     ABORT 'NO CARRIER'
     ABORT 'NO DIALTONE'
     ABORT 'Invalid Login'
     ABORT 'Login incorrect'
     '' ATZ
     OK 'ATDT%(phone_number)s'
     CONNECT ''
     'ogin:' '%(user)s'
     'ord:' '%(passwd)s'
     TIMEOUT 5
     '~--' ''