
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 there is no answer 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.  The 'up' option asserts DTR and RTS.

        >>  Example:  control down



        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 dynamic address negotiation.

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


        cwait <milliseconds> [ "success_string" ["fail_string"] [...] ]

        This is a conditional version of the wait command. If only the
        time is specified, then the dialer pauses for the indicated
        number of milliseconds. If the "success_string" is specified,
        then the dialer reads until the "success_string" is detected for
        the time specified. If there are "fail_string"(s), then the
        dialer will read until either the "success_string" is matched or
        any of the "fail_string"(s) is/are matched for the specified
        time. The string quote marks are required, and the string may
        not include imbedded control characters, although standard 'C'
        escape sequences are allowed with the exception of '\0'. Any
        number of failure strings can be specified. Matching of a
        failure string is treated the same way as if the routine had
        timed out without reading the success string. Note that the
        speed and ipaddress keywords are not implemented in the cwait
        command. (This command is only available if FTN is #defined in
        the compiled version.)

        >> Example:  cwait 65000 "CONNECT" "RING\n" "BUSY" "NO CARRIER"

        NOTE: Pressing <ESC> during a wait or cwait will cause the
        current dialer script to terminate and the dialer to abort.

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.

If FTN extensions are compiled in and 'ftnopt mode' is on:

        goto <label>

        'goto' causes a reparsing of the dialer file from the beginning
        and repositions the next dialer file read to the line
        immediately following the named target label. The target label
        must be preceeded by a ':' and start in the first column. The
        search is not case sensitive but must be unique, ie. a goto
        label of 'go' will match with both target labels of ':go' and
        ':gohere'.

FTN notes:

        The 'ftnopt failexit on' command from the autoexec.nos startup
        file or from the fnos> prompt will cause FNOS to exit back to
        DOS should the dialer fail to establish a carrier after the
        'ftnopt redialtry <count>' is reached.


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
cwait 60000 "CONNECT" "BUSY" "NO CARRIER"
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
