! Xyplex CCL   $RCSfile: Microcom_TravelPorte_FAST,v $
!             $Revision: 1.1 $
!                 $Date: 1994/01/09 07:52:40 $
!
!==============================================================================
!
!  MODEM SCRIPT FOR THE MICROCOM TravelPorte FAST MODEMS - NORMAL MODE
!
!                   **********
!
!  Version 1.0  (with out EC and DC)  January 6, 1994
!
!  Author:  Ed Sale
!           Xyplex, Inc.
!
!  Adapted from the MICROCOM 4232BIS SERIES scripts from Microcom Inc.
!
!  NOTE: Support for connections at speeds less than 4800 bps in ORIGINATE
!        and less than 7200 bps in answer mode has been eliminated because
!        ARA 1.0 CCL execution only supports up to 16 match strings.  ARA 2.0
!        supports up to 32 match strings so in two places below the commented
!        lines may be uncommented as directed to support the slower speeds.
!
!  Please direct questions to Martin S-Carter (617) 551-1313
!     
!==============================================================================
!
!******************************************************************************
! ENTRY POINT - Originate
! ENTRY POINT - Answer
!
@ORIGINATE
@ANSWER
!
! Configure the serial port.
!     - 19200 bps (max speed feasible for MAC, the modem can go faster...)
!     - no parity, 8 data bits, 1 stop bit (ARAP requires this char format)
!     - set port speed to 38400 (so the modem will try to connect at 28800)
!
serreset 19200, 0, 8, 1
setspeed 38400
!
! Set the modem configuration to a known state by recalling the factory
! configuration (&F).  Also:
!     - turn off command echo (E0)
!     - disable auto-answering (S0=0) 
!     - CD follows the state of carrier from the remote modem (&C1)
!     - DTE On-to-Off causes hangup (&D2)
!     - *FC RTS/CTS Enabled (\Q3)
!       (was *FC Disabled (\Q0))
!     - *Normal Connection \N0.
!     - *auto-bps adjust diabled \J0. 
!     - set disconnect buffer delay, to be sure that ARAP disconnect message
!       gets through on hangup (%D2)
! 
matchclr
matchstr 1 1 "OK\13\10"
write "AT&FE0S0=0&C1&D2\\Q3\\N0\\V0\\J0%C0%D2-J0-K0\13"
matchread 30
jump 59
!
! Configure the modem speaker.  If the 'speaker on' flag is true, do nothing
! as the speaker is on-til-carrier in the default configuration.  Else turn
! off the speaker.
!
@LABEL 1
ifstr 2 2 "1"
matchstr 1 2 "OK\13\10"
write "ATM0\13"
matchread 30
jump 59
!
! Continue configuration based on originate/answer role.
!
@LABEL 2
ifANSWER 4
!
! Configure modem for call originating:
!
matchstr 1 8 "OK\13\10"
write "AT\\V0\13"
matchread 30
jump 59
!
! Configure modem for call answering.
!     - enable auto-answer on the first ring (S0=1)
!     - set response string type (\V0)
!
@LABEL 4
matchstr 1 30 "OK\13\10"
write "ATS0=1\\V0\13"
matchread 30
jump 59
!
! Originate a call.  Tone dial the number passed in string ^1.
!
@LABEL 8
note "Dialing ^1" 3
write "ATDT^1\13"
!
@LABEL 9
!
! If you are using ARA 2.0 which allows up to 32 match strings, you may
! uncomment the following "matchstr" commands to support the slower speeds.
!
!matchstr 17  10 "CONNECT 1200\13\10"
!matchstr 18  11 "CONNECT 2400\13\10"
matchstr 1  12 "CONNECT 4800\13\10"
matchstr 2  13 "CONNECT 7200\13\10"
matchstr 3  14 "CONNECT 9600\13\10"
matchstr 4  15 "CONNECT 12000\13\10"
matchstr 5  16 "CONNECT 14400\13\10"
matchstr 6  17 "CONNECT 16800\13\10"
matchstr 7  18 "CONNECT 19200\13\10"
matchstr 8  19 "CONNECT 21600\13\10"
matchstr 9  20 "CONNECT 24000\13\10"
matchstr 10 21 "CONNECT 26400\13\10"
matchstr 11 22 "CONNECT 28800\13\10"
matchstr 12 50 "NO CARRIER\13\10"
matchstr 13 50 "ERROR\13\10"
matchstr 14 52 "NO DIALTONE\13\10"
matchstr 15 53 "BUSY\13\10"
matchstr 16 54 "NO ANSWER\13\10"
matchread 1200
jump 59
!
! A connection has been established.  Enable outputCTS flow control
! in the serial driver.  If we were the call originator, wait 6 seconds
! before exiting the script.
!
@LABEL 10
note "Communicating at 1200" 2
CommunicatingAt 1200
jump 23
!
@LABEL 11
note "Communicating at 2400" 2
CommunicatingAt 2400
jump 23
!
@LABEL 12
note "Communicating at 4800" 2
CommunicatingAt 4800
jump 23
!
@LABEL 13
note "Communicating at 7200" 2
CommunicatingAt 7200
jump 23
!
@LABEL 14
note "Communicating at 9600" 2
CommunicatingAt 9600
jump 23
!
@LABEL 15
note "Communicating at 12000" 2
CommunicatingAt 12000
jump 23
!
@LABEL 16
note "Communicating at 14400" 2
CommunicatingAt 14400
jump 23
!
@LABEL 17
note "Communicating at 16800" 2
CommunicatingAt 16800
jump 23
!
@LABEL 18
note "Communicating at 19200" 2
CommunicatingAt 19200
jump 23
!
@LABEL 19
note "Communicating at 21600" 2
CommunicatingAt 24000
jump 23
!
@LABEL 20
note "Communicating at 24000" 2
CommunicatingAt 24000
jump 23
!
@LABEL 21
note "Communicating at 26400" 2
CommunicatingAt 28800
jump 23
!
@LABEL 22
note "Communicating at 28800" 2
CommunicatingAt 28800
!
@LABEL 23
HSReset 0 1 0 0 0 0 
ifANSWER 24
pause 30
@LABEL 24
exit 0
!
! Answer a call.
! 
@LABEL 30
matchstr 1  32 "RING\13\10"
!
! If you are using ARA 2.0 which allows up to 32 match strings, you may
! uncomment the following "matchstr" commands to support the slower speeds.
!
!matchstr 17 10 "CONNECT 1200\13\10"
!matchstr 18 11 "CONNECT 2400\13\10"
!matchstr 19 12 "CONNECT 4800\13\10"
matchstr 2  13 "CONNECT 7200\13\10"
matchstr 3  14 "CONNECT 9600\13\10"
matchstr 4  15 "CONNECT 12000\13\10"
matchstr 5  16 "CONNECT 14400\13\10"
matchstr 6  17 "CONNECT 16800\13\10"
matchstr 7  18 "CONNECT 19200\13\10"
matchstr 8  19 "CONNECT 21600\13\10"
matchstr 9  20 "CONNECT 24000\13\10"
matchstr 10 21 "CONNECT 26400\13\10"
matchstr 11 22 "CONNECT 28800\13\10"
matchstr 12 50 "NO CARRIER\13\10"
matchstr 13 50 "ERROR\13\10"
matchstr 14 52 "NO DIALTONE\13\10"
matchstr 15 53 "BUSY\13\10"
matchstr 16 54 "NO ANSWER\13\10"
matchread 1200
jump 30
!
@LABEL 32
userhook 1
note "Answering phone." 2
jump 30
!
! @LABEL 50-59: Exit with an error message.
!
! No carrier
@LABEL 50
exit -6021
!
! No dialtone
@LABEL 52
exit -6020
!
! Line busy
@LABEL 53
exit -6022
!
! No answer
@LABEL 54
exit -6023
!
! Modem not responding.
@LABEL 59
exit -6019
!
!*******************************************************************************
! ENTRY POINT - Hang up
!
@HANGUP
@LABEL 60
HSReset 0 0 0 0 0 0 
!
! Drop DTR
!
DTRClear
pause 5
DTRSet
pause 10
!
! Reconfigure modem to factory default settings and be sure that
! auto-answer is disabled.
!
write "AT&FS0=0\13"
matchclr
matchstr 1 63 "OK\13\10"
matchread 30
!
@LABEL 63
exit 0

