;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Example IPDial 2.1 dial script for terminating a connection
;   $VER: Hangup.IPDial 2.1 (16.04.96)
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   The line below *must* be present and *must* be the first command
;   line in the script if you don't use the command line option SANADEV.
;   It specifies the device, unit, baudrate and the protocol to use (7WIRE,
;   XONXOFF or NONE). You may omit the unit, baudrate and protocol, in which
;   case the defaults are used (see manual).
;
;   Be sure, that the parameters you are using in this script are the
;   same as used for initializing AmiTCP/IP (or use SANADEV)!

    DEVICE serial.device UNIT=0 BAUD=38400 7WIRE


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Check if modem is in command or online mode

    SEND "\r\n"
    DELAY 1
    SEND "ATZ\r"
    WAIT TIMEOUT=2 "OK"
    ON STATUS GOTO CmdMode Hangup


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Modem is in online mode. "+++" will enter command mode

CmdMode:
    SEND "+"
    DELAY 0 100
    SEND "+"
    DELAY 0 100
    SEND "+"
    WAIT TIMEOUT=3 "NO CARRIER" "OK"
    ON STATUS GOTO TIMEOUT


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Now tell the modem to disconnect

Hangup:
    DELAY 1
    SEND "ATH0\r"
    WAIT "NO CARRIER" "OK"
    ON STATUS GOTO TIMEOUT

    ECHO "Disconnected.\n"
    EXIT 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;   Error message: Timeout

TIMEOUT:
    ECHO "\nTimeout. Entering terminal mode.\n"
    TERMINAL NOECHO RAW
    EXIT 0

