
dialer

        dialer <interface> [<dialer_file> [<seconds> [<pings> [<hostid>]]]]

        Set up an autodialer session for the interface.  Whenever the
        interface is idle for the interval in <seconds>, the autodialer
        will ping the <hostid> if specified, or send a link-layer echo
        request if possible and no ping target was given.  If there is no
        incoming data after <pings> attempts, the autodialer will execute
        the special commands contained in the <dialer_file>.

        If no <dialer_file> is specified, a previous dialer command
        process will be removed.  If the number of <pings> is omitted, the
        <dialer_file> will be executed without first pinging the <host>.

        The <dialer_file> may have any valid name, and is located in the NOS
        root directory unless a full pathname is provided.  The dialer
        commands in the file are described below.

        >> Examples:  dialer sl0 ns9tel.dia 30 10 ns9tel


DIALER FILE COMMANDS

        control down|up

        Control the 'asy' interface.  The 'down' option drops DTR (and
        RTS except in the Unix version).  The 'up' option asserts DTR
        (and RTS except in the Unix version).

        >>  Example:  control down

        Actually, other options beside down and up are allowed, provided
        they are supported by the param command for the dialer's interface.  
        >>  Example:  control dtr 1



        send "<string>" [<milliseconds>]

        This dialer command will write the specified string to the
        interface. The string quote marks are required, and the string
        may not contain embedded control characters.  However, the
        standard C string escape sequences are recognized (but \0 should
        not be used).  If <milliseconds> is specified, the <string>
        characters are sent with a <milliseconds> inter-character delay,
        useful for ancient Micom switches!

        >> Example:  send "atdt555-1212"



        speed [ 115200|57600|38400|19200|9600|4800|2400|1200|300 ]

        This command sets the speed of the interface to one of the
        available speeds.  If the speed argument is missing, the speed
        will be displayed in the dialer session window.

        >> Example:  speed 1200



        wait <milliseconds> [ "test_string"  [speed|ipaddress]]

        If only the time is specified, the dialer pauses for the desired
        number of milliseconds.  Otherwise, the dialer reads until the
        <test_string> is detected on the interface.

        If the string is not detected within the desired time, the
        autodialer will reset.  The string quote marks are required, and
        the string may not contain embedded control characters. However,
        the standard C string escape sequences are recognized (but \0
        may not be used).

        If the "speed" keyword is specified, the dialer will continue
        to read characters until a non-digit is detected.  The string
        read is converted to an integer, and used to set the interface
        speed.  If the trailing non-digit is not detected within the
        desired time, or the integer value is not a valid speed, the
        autodialer will reset.

        If the "ipaddress" keyword is specified, the dialer will continue
        to read characters until a dotted-quad IP address is detected.
        The numeric address is used to set the interface IP address.
        If a trailing non-digit is not detected within the specified
        time, or the address is invalid, the autodialer will reset.  This
        option is only available when SLIP was #define'd at compile time,
        since PPP protocol supports address negociation.

        >> Example:  wait 45000 "CONNECT " speed
        >> Example:  wait 5000 "Assigned IP address is" ipaddress


DIALER FILE EXTENDED COMMANDS


        failmode  [ on | OFF ]

        'failmode' establishes whether the dialer should continue after
        a failed dialer command.  <off> implies abort the dialing script,
        while <on> means continue the script, which in effect enables
        the 'ifok' and 'iffail' commands.


        begin

        'begin' starts a block of commands, and is typically used
        after an 'ifok' or 'iffail' command.


        end

        'end' terminates a block of commands, which extends to the
        previous unpaired 'begin'.


        exit [<return_code>]

        'exit' ends the dialer script, with the result code set to that
        of the previous dialer command unless <return_code> is specified.


        status  [ up | down ]

        'status' is similar to the 'control' command, except that the
        iostatus() routine is notified.


        ifok <cmd>

        'ifok' invokes the dialer command <cmd> if the previous command
        was successful.


        iffail <cmd>

        'iffail' invokes the dialer command <cmd> if the previous command
        was not successful.


        verbose  [ ON | off ]

        'verbose' sets the verbosity level of the dialer, that is, whether
        the dialer echoes the script commands as they are read and displays
        output received during the wait command.  The "off" setting is
        recommended for those well-debugged scripts used with the ping/redial
        option.  The verbose setting is retained across dialer invocations.


DIALER EXAMPLE FILE

The following dialer script will perform these steps:
. drop DTR & RTS to force a hangup
. wait 2 seconds and then raise DTR & CTS
. set the port speed to 9600 baud and initialize the modem
. dial a number
. turn on continue-after-error mode
. wait for the modem to return a CONNECT message
. abort if a BUSY was received instead of CONNECT, or dial-out failed
. try three times to send a CR and obtain a Login: prompt
. send my login name, password, wait 5 seconds and then exit

#verbose off             [enable when well-debugged, to eliminate most output]
control down
wait 2000
control up
speed 9600
send "atz\ratm0l0e0\r"
wait 1000
send "atdt555-1212\r"
# Let's assume a BUSY will always be detected within 10s, and a connect ALWAYS
# takes longer.  Also, if we invoked dialer with the ping options, this gives
# us an eventual busy redial.  -- n5knx
failmode on
wait 10000 "BUSY"
ifok exit 1
wait 60000 "CONNECT"
iffail exit
wait 2000
send "\r"
wait 5000 "ogin"
iffail begin
 send "\r"
 wait 5000 "ogin"
 iffail begin
  send "\r"
  wait 5000 "ogin"
  iffail begin
   control down
   exit 1
  end
 end
end
wait 1000
send "myname\r"
wait 5000 "assword"
  iffail begin
   control down
   exit 1
  end
wait 1000
send "mypassword\r"
wait 5000
exit
