home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / modem31.zip / ANSWER.HP next >
Text File  |  1993-08-30  |  72KB  |  2,013 lines

  1. ; answer.hp -- HyperACCESS/5 answering script
  2. ;
  3. ;       $Revision:   2.20  $
  4. ;       $Date:   13 Aug 1993 16:29:26  $
  5. ;
  6. ;                         DEFINITION OF VARIABLES
  7. ;
  8.     declare integer BaudRate           ; contains the baud rate
  9.     declare integer BaudIndex          ; user to index into baud rate array
  10.     declare integer AnswerCall         ; indicates if the modem has been told to answer calls
  11.     declare integer MiscInt1           ; miscellaneous variable number 1
  12.     declare integer VoiceDataCable     ; contains the Answer menu selection
  13.     declare integer PasswordRetry      ; is the loop counter for password tries
  14.     declare integer RingsToAnswer      ; contains the number of rings on which to answer
  15.     declare integer MiscInt2           ; serves miscellaneous temporary functions
  16.     declare integer ModemNumber        ; contains the modem type
  17.     declare integer CallsReceived      ; contains the received call count
  18.     declare integer EscBranch          ; tells where to branch after an ESC
  19.     declare integer Row                ; current cursor row
  20.     declare integer Col                ; current cursor column
  21.     declare integer PasswordDetail     ; detail number for password() function
  22.     declare integer DisplayRate        ; DCE baud rate, displayed on banner
  23.     declare integer ScrogType          ; 0=Script, 1=Local Pgm, 2=Remote Pgm
  24.     declare integer DirectStartTime    ; Logon time for Direct connect
  25.     declare integer DirectEndTime      ; Logoff time for Direct connect
  26.     declare integer LoopCount          ; loop counting variable
  27.     declare integer OSVersion          ; version of operating system
  28.     declare integer TempBaud           ; a temporary baud rate value
  29.  
  30.     declare flag Logging               ; true if logging is specified
  31.     declare flag DirectConnect         ; true if an auto-answer direct-connect modem
  32.     declare flag PopupOS2              ; true if OS/2 and notification of calls is specified
  33.     declare flag DirectCable           ; true if direct cabled
  34.     declare flag FromVoiceCall         ; true if a switching from a voice call
  35.     declare flag HHS                   ; true if a high-speed modem at high-speed
  36.     declare flag ModemResponded        ; true if an non-auto-answer direct-connect modem or if a modem has responded
  37.     declare flag ManualHangup          ; true if hangup by hand
  38.     declare flag CallerIsLoggedOn      ; true if caller logged on
  39.     declare flag ConstantDteRate       ; true if baud rate synchronization is not required
  40.     declare flag UserDefinedModem      ; modem name is User-Defined modem
  41.     declare flag OS2                   ; true if OS/2 is the operating system
  42.     declare flag ISDN_Support          ; true if device is ISDN
  43.     declare flag LeasedLine            ; true if leased line support selected
  44.     declare flag SlowOS2               ; true if OS/2 version < 2.00
  45.  
  46.     declare string CallersName         ; contains the caller's name
  47.     declare string Password            ; contains the password
  48.     declare string ExtraMdmCmds        ; contains the extra modem commands
  49.     declare string DateTime            ; contains the date
  50.     declare string PortName            ; contains the port name
  51.     declare string ModemName           ; contains the modem name
  52.     declare string MiscString1         ; serves miscellaneous temporary functions
  53.     declare string MiscString2         ; contains the modem name then the system time
  54.     declare string MiscString3         ; serves miscellaneous temporary functions
  55.     declare string LastCallerName      ; name of last caller
  56.     declare string LastCallTime        ; time of last call
  57.     declare string ScrogName           ; Name of script or program to run
  58.     declare string InitString2         ; 2nd line of initialization strings
  59.     declare string LogFileName         ; answer log file name
  60.  
  61.     declare string UserDefCall         ; user defined modem values read from
  62.     declare string UserDefAnswer       ; modemdef.dat.  modemderf.dat is 
  63.     declare string UserDefDial         ; created by running the utility script
  64.     declare string UserDefHangup       ; named modemdef.
  65.     declare string UserDefCD
  66.     declare string UserDefToggleDTR
  67.     declare string UserDefHHS
  68.  
  69.     option("BOTTOM LINE", no)
  70.     option("ignore case", yes)
  71.     get position(Row,Col)
  72.     option("mouse", on)
  73.  
  74. ClearScreen:
  75.     prompt("/n")
  76.     if decrement(Row) goto ClearScreen
  77.     escape key("<ESC>")
  78.     option("temporary settings",yes)
  79.     option("use menu colors",no)
  80.     emulate("TTY")
  81.     option("blank",yes)
  82.     wipe screen()
  83.     position(1,1)
  84.     option("receive line feeds", no)
  85.     report("operating system", MiscInt1)
  86.     if equal(MiscInt1, 2)
  87.         set flag(OS2, True)
  88.     else
  89.         set flag(OS2, False)
  90.     endif
  91.     report("operating system version", OSVersion)
  92.     
  93. GetInfoFromProgram:
  94.     key integer(BaudRate,"")
  95.  
  96.     ; This added for fix to version 3.  Remove for 3.x versions
  97.     ;
  98.     if equal(BaudRate, 0) set integer(BaudRate, 115200)
  99.  
  100.     key string(PortName,"")
  101.     key string(ModemName,"")
  102.     key integer(ModemNumber,"")
  103.     key string(ExtraMdmCmds,"")
  104.     key integer(RingsToAnswer,"")
  105.     key integer(VoiceDataCable,"")
  106.     key flag(Logging,"")
  107.     key flag(PopupOS2,"")
  108.     key string(LogFileName,"")
  109.     set string(LastCallerName, "<none>")
  110.     set string(LastCallTime, "<none>")
  111.     option("blank",no)
  112.     wipe screen()
  113.     position(1,1)
  114.  
  115.     set flag(ISDN_Support, False)
  116.     set flag(LeasedLine, false)
  117.     if get environment(MiscString1, "HA5LEASED")
  118.         if string match(MiscString1, "TRUE")
  119.             set flag(LeasedLine, true)
  120.         endif
  121.     endif 
  122.     ifnot length(LogFileName, MiscInt1) set flag(Logging, false)
  123.  
  124.     ; The following line is commented out for compatibility with
  125.     ; the version 3.0 product.
  126.     ;get porttype(MiscString1)
  127.     if string match(MiscString1, "PBX") set flag(ISDN_Support, True)
  128.     if string match(MiscString1, "ISDN") set flag(ISDN_Support, True)
  129.     ;if equal(ModemNumber, 102) set flag(ISDN_Support, True)
  130.     ;if equal(ModemNumber, 103) set flag(ISDN_Support, True)
  131.  
  132.     if equal(VoiceDataCable,2) set flag(FromVoiceCall,true)
  133.     ifnot equal(VoiceDataCable,3) goto SetupCommon
  134.  
  135.     set flag(DirectCable,true)
  136.     set integer(ModemNumber,40)
  137.     set integer(VoiceDataCable,0)
  138.  
  139. SetupCommon:
  140.     if equal(ModemNumber,42) gosub SetFastlinkSub
  141.     if equal(ModemNumber,80) goto UserDefined
  142.     ifnot flag(DirectCable) goto CarrierDetectCheck
  143.  
  144. DirectCableHost:
  145.     wipe screen()
  146.     position(1,1)
  147.     option("echo",false)
  148.     set integer(EscBranch ,980)
  149.     option("use menu colors",yes)
  150.     option("bold",yes)
  151.     draw box(3,80)
  152.     position(3,32)
  153.     prompt(" ESC to cancel ")
  154.     position(2,12)
  155.     option("bold",no)
  156.     prompt("HyperACCESS//5 is waiting for a direct-cabled terminal")
  157.     option("use menu colors",no)
  158.     position(5,1)
  159. WaitForEnterKey:
  160.     gosub CheckAbort
  161.     ifnot wait characters("/x0D",1)
  162.         ifnot get key(MiscString1) goto WaitForEnterKey
  163.     endif
  164.     gosub SetFlowControl
  165.     goto GetPassword1
  166.  
  167. CarrierDetectCheck:
  168.     option("use menu colors",yes)
  169.     if equal(ModemNumber,1) goto CheckModem 
  170.     if equal(ModemNumber,2) goto CheckModem 
  171.     if equal(ModemNumber,3) goto CheckModem 
  172.     if equal(ModemNumber,4) goto CheckModem 
  173.     if equal(ModemNumber,6) goto CheckModem 
  174.     if equal(ModemNumber,7) goto CheckModem 
  175.     if equal(ModemNumber,13) goto CheckModem
  176.     if equal(ModemNumber,14) goto CheckModem
  177.     if equal(ModemNumber,15) goto CheckModem
  178.     if equal(ModemNumber,16) goto CheckModem
  179.     if equal(ModemNumber,17) goto CheckModem
  180.     if equal(ModemNumber,19) goto CheckModem
  181.     if equal(ModemNumber,21) goto CheckModem
  182.     if equal(ModemNumber,22) goto CheckModem
  183.     if equal(ModemNumber,23) goto CheckModem
  184.     if equal(ModemNumber,24) goto CheckModem
  185.     if equal(ModemNumber,27) goto CheckModem
  186.     if equal(ModemNumber,31) goto CheckModem
  187.     if equal(ModemNumber,32) goto CheckModem
  188.     if equal(ModemNumber,33) goto CheckModem
  189.     if equal(ModemNumber,34) goto CheckModem
  190.     if equal(ModemNumber,35) goto CheckModem
  191.     if equal(ModemNumber,37) goto CheckModem
  192.     if equal(ModemNumber,38) goto CheckModem
  193.     if equal(ModemNumber,39) goto CheckModem
  194.     if equal(ModemNumber,41) goto CheckModem
  195.     if equal(ModemNumber,42) goto CheckModem
  196.     if equal(ModemNumber,43) goto CheckModem
  197.     if equal(ModemNumber,44) goto CheckModem
  198.     if equal(ModemNumber,46) goto CheckModem
  199.     if equal(ModemNumber,48) goto CheckModem
  200.     if equal(ModemNumber,50) goto CheckModem
  201.     if equal(ModemNumber,51) goto CheckModem
  202.     if equal(ModemNumber,53) goto CheckModem
  203.     if equal(ModemNumber,54) goto CheckModem
  204.     if equal(ModemNumber,55) goto CheckModem
  205.     if equal(ModemNumber,56) goto CheckModem
  206.     if equal(ModemNumber,57) goto CheckModem
  207.     if equal(ModemNumber,58) goto CheckModem
  208.     if equal(ModemNumber,59) goto CheckModem
  209.     if equal(ModemNumber,61) goto CheckModem
  210.     if equal(ModemNumber,62) goto CheckModem
  211.     if equal(ModemNumber,70) goto CheckModem
  212.     if equal(ModemNumber,74) goto CheckModem
  213.     if equal(ModemNumber,75) goto CheckModem
  214.     if equal(ModemNumber,77) goto CheckModem
  215.     if equal(ModemNumber,79) goto CheckModem
  216.     if equal(ModemNumber,81) goto CheckModem
  217.     if equal(ModemNumber,88) goto CheckModem 
  218.     if equal(ModemNumber,89) goto CheckModem 
  219.     if equal(ModemNumber,104) goto CheckModem 
  220.     if equal(ModemNumber,105) goto CheckModem 
  221.     if equal(ModemNumber,106) goto CheckModem 
  222.     if equal(ModemNumber,107) goto CheckModem 
  223.     ifnot less(ModemNumber,100) goto CheckModem
  224.  
  225. CarrierDetectError:
  226.     ifnot wait carrier(0,0) goto CheckModem
  227.     set string(MiscString3,"Your modems CD signal is set incorrectly. (See Appendix C for remedies.)")
  228.     gosub DisplayBanner
  229.     goto _Error
  230.  
  231. CheckModem:
  232.     option("use menu colors",no)
  233.     wipe screen()
  234.     position(1,1)
  235.     if equal(ModemNumber,97) goto UncommandedModems
  236.     if equal(ModemNumber,98) goto UncommandedModems
  237.     if equal(ModemNumber,99) goto UncommandedModems
  238.     character delay(50)
  239.     option("use menu colors",yes)
  240.     option("bold",yes)
  241.     if equal(ModemNumber,49) draw box(4,80)
  242.     ifnot equal(ModemNumber,49) draw box(3,80)
  243.     position(3,32)
  244.     if equal(ModemNumber,49) position(4,32)
  245.     prompt(" ESC to cancel ")
  246.     option("bold",no)
  247.     if equal(ModemNumber,49) goto Avatex
  248. CheckModem1:
  249.     position(2,3)
  250.     if equal(ModemNumber,49) position(3,5)
  251.     option("bold",no)
  252. ;       prompt("Preparing the /(MiscString2) to answer calls./n/n/n")
  253.     prompt("Preparing the /(ModemName) to answer calls./n/n/n")
  254.     option("use menu colors",no)
  255.  
  256. SpecialModemSupportRoutines:
  257.     if flag(ISDN_Support) goto ISDNDevices
  258.     if equal(ModemNumber,21) goto MultiTech
  259.     if equal(ModemNumber,124) goto MultiTech
  260.     if equal(ModemNumber,36) goto USR2400E
  261.     if equal(ModemNumber,44) goto Microcom
  262.     if equal(ModemNumber,123) goto Microcom
  263.     if equal(ModemNumber,50) goto NEC_Modem
  264.     if equal(ModemNumber,61) goto ATT
  265.     if equal(ModemNumber,62) goto Telrad
  266.     if equal(ModemNumber,63) goto Fujitsu
  267.     if equal(ModemNumber,64) goto NEC_ISDterm
  268.     if equal(ModemNumber,80) goto InitializeModem
  269.     if equal(ModemNumber, 138) goto WorldBlazer
  270.  
  271. SetModemInitString:
  272.     set string(MiscString3,"ATE1V1Q0S0=/(RingsToAnswer)")
  273.     set string(InitString2,"")
  274.     if greater(ModemNumber,39) goto UniqueModemInitStrings
  275.     if less(ModemNumber,10) goto UniqueModemInitStrings
  276.     if less(ModemNumber,20) set string(MiscString3,"/(MiscString3)X1")
  277.     if less(ModemNumber,20) goto UniqueModemInitStrings
  278.     if less(ModemNumber,30) set string(MiscString3,"/(MiscString3)X2")
  279.     if greater(ModemNumber,29) set string(MiscString3,"/(MiscString3)X3")
  280.  
  281. UniqueModemInitStrings:
  282.     if equal(ModemNumber,1)
  283.         set string(MiscString3,"AT&F1&C1&D2&R0\G1\J0\N3\Q3\V1\X1S0=/(RingsToAnswer)")
  284.         set flag(HHS,true)
  285.         goto AddExtraCmds
  286.     endif
  287.     if equal(ModemNumber,2) set string(MiscString3,"AT&FX4&C1&D2&R0\J0\N3\Q3\V1\X1%C1S0=/(RingsToAnswer)")
  288.     if equal(ModemNumber,2) set flag(HHS,true)
  289.     if equal(ModemNumber,3) set string(MiscString3,"AT&FE1Q0X4&C1&D2\N3\Q3\J0\V1%C1S0=/(RingsToAnswer)")
  290.     if equal(ModemNumber,3) set flag(HHS,true)
  291.     if equal(ModemNumber,4) set string(MiscString3,"AT&FE1Q0X4&C1&D2&K1S0=/(RingsToAnswer)")
  292.     if equal(ModemNumber,4) set flag(HHS,true)
  293.     if equal(ModemNumber,5) set string(MiscString3,"ATX4%J3S17=1S19=1S30=192S0=/(RingsToAnswer)")
  294.     if equal(ModemNumber,5) set flag(HHS,true)
  295.     if equal(ModemNumber,6) set string(MiscString3,"AT&F&C1&D2&R0&K3\N3%C1S0=/(RingsToAnswer)")
  296.     if equal(ModemNumber,6) set flag(HHS,true)
  297.     if equal(ModemNumber,7) set string(MiscString3,"AT&FE1V1Q0&C1&D2&R0$E1$F4$S8S0=/(RingsToAnswer)")
  298.     if equal(ModemNumber,7) set flag(HHS,true)
  299.     if equal(ModemNumber,8) set string(MiscString3,"AT&FE1V1Q0X1&C1&D2S0=/(RingsToAnswer)")
  300.     if equal(ModemNumber,9) set string(MiscString3,"/(MiscString3)S61=1")
  301.     if equal(ModemNumber,9) set flag(HHS,true)
  302.     if equal(ModemNumber,9) hangup()
  303.     if equal(ModemNumber,11) set string(MiscString3,"/(MiscString3)S18=0")
  304.     if equal(ModemNumber,12) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\N3\J0\Q3\V1S0=/(RingsToAnswer)")
  305.     if equal(ModemNumber,12) set flag(HHS,true)
  306.     if equal(ModemNumber,13) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&K3&R0\A3%C1S95=3S0=/(RingsToAnswer)")
  307.     if equal(ModemNumber,13) set flag(HHS,true)
  308.     if equal(ModemNumber,14) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\J0\N3\V1\X1\Q3%C1S0=/(RingsToAnswer)")
  309.     if equal(ModemNumber,14) set flag(HHS,true)
  310.     if equal(ModemNumber,15) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\D1\J0\N3\V1\X1\Q3S0=/(RingsToAnswer)")
  311.     if equal(ModemNumber,15) set flag(HHS,true)
  312.     if equal(ModemNumber,16) set string(MiscString3,"AT&FE1V1Q0&A1&C1&I1&K2&E1S0=/(RingsToAnswer)")
  313.     if equal(ModemNumber,16) set flag(HHS,true)
  314.     if equal(ModemNumber,17) goto Fastcomm
  315.     if equal(ModemNumber,18) goto Concord
  316.     if equal(ModemNumber,19) set string(MiscString3,"AT&FE1X1&C1&D1*C1*F2*L1S0=/(RingsToAnswer)")
  317.     if equal(ModemNumber,19) set flag(HHS,true)
  318.     if equal(ModemNumber,22) set string(MiscString3,"AT&FL0&C1&D2S36=7S0=/(RingsToAnswer)")
  319.     if equal(ModemNumber,22) set flag(HHS,true)
  320.     if equal(ModemNumber,23) set string(MiscString3,"AT&FL0&C1&D2S37=9S0=/(RingsToAnswer)")
  321.     if equal(ModemNumber,23) set flag(HHS,true)
  322.     if equal(ModemNumber,24) set string(MiscString3,"AT&FX4&C1&D2&K3\N3S0=/(RingsToAnswer)")
  323.     if equal(ModemNumber,24) set flag(HHS,true)
  324.     if equal(ModemNumber,25) set string(MiscString3,"AT&FE1V1Q0X5&B1&C1&D2&H3&N0&R0S0=/(RingsToAnswer)")
  325.     if equal(ModemNumber,25) set flag(HHS,true)
  326.     if equal(ModemNumber,26) set string(MiscString3,"/(MiscString3)\N3\Q2")
  327.     if equal(ModemNumber,26) set flag(HHS,true)
  328.     if equal(ModemNumber,27) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\J0\N3\Q3\X1S0=/(RingsToAnswer)")
  329.     if equal(ModemNumber,27) set flag(HHS,true)
  330.     if equal(ModemNumber,28) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&K3&R0\N3%C1S0=/(RingsToAnswer)")
  331.     if equal(ModemNumber,28) set flag(HHS,true)
  332.     if equal(ModemNumber,30) goto USR2400
  333.     if equal(ModemNumber,31) set string(MiscString3,"AT&F&C1&D2\J0\N6\Q3\V1\X1%C1S0=/(RingsToAnswer)")
  334.     if equal(ModemNumber,31) set flag(HHS,true)
  335.     if equal(ModemNumber,32) set string(MiscString3,"AT&F&C1&D2&K3&Q5\A3\N3S36=7S11=55S0=/(RingsToAnswer)")
  336.     if equal(ModemNumber,32) set flag(HHS,true)
  337.     if equal(ModemNumber,33) set string(MiscString3,"AT&FE1V1Q0X4&B1&C1&D2S0=/(RingsToAnswer)")
  338.     if equal(ModemNumber,33) set flag(HHS,true)
  339.     if equal(ModemNumber,34) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&K3&R0S38=0S95=3S0=/(RingsToAnswer)")
  340.     if equal(ModemNumber,34) set flag(HHS,true)
  341.     if equal(ModemNumber,35) set string(MiscString3,"/(MiscString3)&C1&D2")
  342.     if equal(ModemNumber,37) goto Telebit
  343.     if equal(ModemNumber,38) set string(MiscString3,"AT&F\V1X4&C1&D2\G0\J0\N3\Q3\X1S0=/(RingsToAnswer)")
  344.     if equal(ModemNumber,38) set flag(HHS,true)
  345.     if equal(ModemNumber,39) set string(MiscString3,"AT&F2&C1&D2\J0\N3\X1\V1\Q3%C1S0=/(RingsToAnswer)")
  346.     if equal(ModemNumber,39) set flag(HHS,true)
  347.     if equal(ModemNumber,41) goto Telebit
  348.     if equal(ModemNumber,42) goto Telebit
  349.     if equal(ModemNumber,43) set string(MiscString3,"AT&F1Q0V1X4W2&B1&C1&D2&K3&R0S0=/(RingsToAnswer)")
  350.     if equal(ModemNumber,43) set flag(HHS,true)
  351.     if equal(ModemNumber,45) goto Convertible
  352.     if equal(ModemNumber,46) set string(MiscString3,"AT&FE1\V1X4\D1\G\J\N3\Q3&C1&D2S0=/(RingsToAnswer)")
  353.     if equal(ModemNumber,46) set flag(HHS,true)
  354.     if equal(ModemNumber,47) set string(MiscString3,"AT Q0 B11001100")
  355.     if equal(ModemNumber,48) set string(MiscString3,"AT&F1E1Q0X4&C1&D2\J0\N3\Q3\V1\X1%C1S0=/(RingsToAnswer)")
  356.     if equal(ModemNumber,48) set flag(HHS,true)
  357.     if equal(ModemNumber,49) goto Avatex2
  358.     if equal(ModemNumber,51) goto Telebit
  359.     if equal(ModemNumber,52) set string(MiscString3,"ATE1X4N1&C1&D2&R0\G0\J0\Q3\X1\V1\N3%E1S0=/(RingsToAnswer)")
  360.     if equal(ModemNumber,52) set flag(HHS,true)
  361.     if equal(ModemNumber,53) set string(MiscString3,"ATE1V1Q0X6&C1&D2&E4&K3&R0&U2S0=/(RingsToAnswer)")
  362.     if equal(ModemNumber,53) set flag(HHS,true)
  363.     if equal(ModemNumber,54) set string(MiscString3,"AT&F0E1V1Q0X6&C1&D2&R1&I2\N3\Q3%C1S0=/(RingsToAnswer)")
  364.     if equal(ModemNumber,54) set flag(HHS,true)
  365.     if equal(ModemNumber,55) gosub SetDowtySub
  366.     if equal(ModemNumber,55) set string(MiscString3,"AT&F0E1V1Q0X6&C1&I2%C1%R0%K3%U3-E3//S0//U0U/(MiscInt2)S0=/(RingsToAnswer)")
  367.     if equal(ModemNumber,55) set flag(HHS,true)
  368.     if equal(ModemNumber,56) gosub SetDowtySub
  369.     if equal(ModemNumber,56) set string(MiscString3,"AT&F0E1V1Q0X6&C1&Q11&I2%C1%R0%K3%U3-E3U/(MiscInt2)S0=/(RingsToAnswer)")
  370.     if equal(ModemNumber,56) set flag(HHS,true)
  371.     if equal(ModemNumber,57) set string(MiscString3,"ATE1V1Q0X4&C1&D2//Q3//N3S0=/(RingsToAnswer)")
  372.     if equal(ModemNumber,57) set flag(HHS,true)
  373.     if equal(ModemNumber,58) set string(MiscString3,"AT&F!C0E1Q0X3&C1&D2\J0\N3\V1\Q3\X1%C1S0=/(RingsToAnswer)")
  374.     if equal(ModemNumber,58) set flag(HHS,true)
  375.     if equal(ModemNumber,59) 
  376.         set string(MiscString3,"AT&FX4&C1&D2&K3&R0\D1")
  377.         set string(InitString2,"AT\J\N3\Q3\R\V1\X1S0=/(RingsToAnswer)")
  378.         set flag(HHS,true)
  379.     endif
  380.     if equal(ModemNumber,60) set string(MiscString3,"AT&FX4&C1&D2\J0\N3\Q3\V1\X1S0=/(RingsToAnswer)")
  381.     if equal(ModemNumber,60) set flag(HHS,true)
  382.     if equal(ModemNumber,65) goto Telebit
  383.     if equal(ModemNumber,70) set string(MiscString3,"AT&FE1V1Q0L0&C1&D2&K3S95=2S38=0S0=/(RingsToAnswer)")
  384.     if equal(ModemNumber,70) set flag(HHS,true)
  385.     if equal(ModemNumber,71) set string(MiscString3,"AT&FE1V1Q0L0X4&C1&D2&R0\Q1\V0S25=0S0=/(RingsToAnswer)")
  386.     if equal(ModemNumber,71) set flag(HHS,true)
  387.     if equal(ModemNumber,73) set string(MiscString3,"AT&F&C1&D2E1Q\J\N3\Q3\V1\X1S0=/(RingsToAnswer)")
  388.     if equal(ModemNumber,73) set flag(HHS,true)
  389.     if equal(ModemNumber,74) set string(MiscString3,"AT&FE1X4\V1\D1\J\N3\Q3&C1&D2&R%C1%F1\M1\X1S0=/(RingsToAnswer)")
  390.     if equal(ModemNumber,74) set flag(HHS,true)
  391.     if equal(ModemNumber,75) set string(MiscString3,"AT&F2E1V1L0Q0W2X4&C1&D2S0=/(RingsToAnswer)")
  392.     if equal(ModemNumber,75) set flag(HHS,true)
  393.     if equal(ModemNumber,76) set string(MiscString3,"AT&FE1V1Q0S0=0*F3S0=/(RingsToAnswer)")
  394.     if equal(ModemNumber,76) set flag(HHS,true)
  395.     if equal(ModemNumber,77) set string(MiscString3,"AT&F&C1&D2&K1SS0=/(RingsToAnswer)")
  396.     if equal(ModemNumber,77) set flag(HHS,true)
  397.     if equal(ModemNumber,78) set string(MiscString3,"AT&F&C1&D2X4\N3\Q3%F2*B1&W1&Y1S64=1S0=/(RingsToAnswer)")
  398.     if equal(ModemNumber,78) set flag(HHS,true)
  399.     if equal(ModemNumber,79)
  400.         if string match(ModemName, "PSD on D")
  401.             set string(MiscString3,"%A1=1%A3=9%A0=2")
  402.         elseif string match(ModemName, "PSD on B1")
  403.             set string(MiscString3,"%A1=1%A3=3%A0=2")
  404.         elseif string match(ModemName, "PSD on B2")
  405.             set string(MiscString3,"%A1=1%A3=5%A0=2")
  406.         else
  407.             set string(MiscString3,"%A1=0%A2=2%A0=2")
  408.         endif
  409.         set string(MiscString3,"ATE1V1Q0X4&C1&D2&K3/(MiscString3)S0=/(RingsToAnswer)")
  410.         set flag(HHS,true)
  411.         goto AddExtraCmds
  412.     endif
  413.     if equal(ModemNumber,81) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&J0&K3\G1\N3S95=2S0=/(RingsToAnswer)")
  414.     if equal(ModemNumber,81) set flag(HHS,true)
  415.     if equal(ModemNumber,82) set string(MiscString3,"AT&FE1Q0V1X4&C1&D2&R0*E9*F3*M1*S1S0=/(RingsToAnswer)")
  416.     if equal(ModemNumber,82) set flag(HHS,true)
  417.     if equal(ModemNumber,83) set string(MiscString3,"AT&FE1V1Q0X4B1&B1&H1&R2&N0S0=/(RingsToAnswer)")
  418.     if equal(ModemNumber,83) set flag(HHS,true)
  419.     if equal(ModemNumber,84) set string(MiscString3,"AT&FE1V1Q0X4B0&B1&H1&R2&N0&A3S0=/(RingsToAnswer)")
  420.     if equal(ModemNumber,84) set flag(HHS,true)
  421.     if equal(ModemNumber,85) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&R0\H0\N6\Q3S0=/(RingsToAnswer)")
  422.     if equal(ModemNumber,85) set flag(HHS,true)
  423.     if equal(ModemNumber,86) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\J\V1\X1&R0S0=/(RingsToAnswer)")
  424.     if equal(ModemNumber,86) set flag(HHS,true)
  425.     if equal(ModemNumber,87) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&R0*SC1*FL3*XC2S0=/(RingsToAnswer)")
  426.     if equal(ModemNumber,87) set flag(HHS,true)
  427.     if equal(ModemNumber,88) goto Telebit
  428.     if equal(ModemNumber,89) set string(MiscString3,"AT&F&C1&D2&R%C1%E1\A3\G\J\N3\Q3\X1S0=/(RingsToAnswer)")
  429.     if equal(ModemNumber,89) set flag(HHS,true)
  430.     if equal(ModemNumber,100) set string(MiscString3,"AT&FX4&C1&D2&R0\J0\Q3\V2\X1S0=/(RingsToAnswer)")
  431.     if equal(ModemNumber,100) set flag(HHS,true)
  432.     if equal(ModemNumber,101) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2&R%BS7=50S0=/(RingsToAnswer)")
  433.     if equal(ModemNumber,101) set flag(HHS,true)
  434.     if equal(ModemNumber,104) set string(MiscString3,"AT&FX4&C1&D2\J\N3\Q3\V2\X1S0=/(RingsToAnswer)")
  435.     if equal(ModemNumber,104) set flag(HHS,true)
  436.     if equal(ModemNumber,105) set string(MiscString3,"AT&F&C1&D2S0=/(RingsToAnswer)")
  437.     if equal(ModemNumber,106) set string(MiscString3,"ATE1V1Q0&C1S0=/(RingsToAnswer)")
  438.     if equal(ModemNumber,107) set string(MiscString3,"AT&F&C1&D2\N3\V2\Q3\J0\C1\X1%C1/"H3S0=/(RingsToAnswer)")
  439.     if equal(ModemNumber,107) set flag(HHS, true)
  440.     if equal(ModemNumber,108) set string(MiscString3,"AT&FX6&C1&D2&R0\D1\N3\Q3\X1/"H3S0=/(RingsToAnswer)")
  441.     if equal(ModemNumber,108) set flag(HHS, true)
  442.     if equal(ModemNumber,109) set string(MiscString3,"AT&FE1V1Q0X4&A3&B1&H1&R2S0=/(RingsToAnswer)")
  443.     if equal(ModemNumber,109) set flag(HHS, true)
  444.     if equal(ModemNumber,110) set string(MiscString3,"AT&F2E1V1X4\N6\Q3\V1\J\X1%C1S0=/(RingsToAnswer)")
  445.     if equal(ModemNumber,110) set flag(HHS, true)
  446.     if equal(ModemNumber,111) 
  447.         if equal(BaudRate, 300) 
  448.             set integer(MiscInt1, 1)
  449.         elseif equal(BaudRate, 600)
  450.             set integer(MiscInt1, 2)
  451.         elseif equal(BaudRate, 1200)
  452.             set integer(MiscInt1, 3)
  453.         elseif equal(BaudRate, 2400)
  454.             set integer(MiscInt1, 4)
  455.         elseif equal(BaudRate, 4800)
  456.             set integer(MiscInt1, 5)
  457.         elseif equal(BaudRate, 9600)
  458.             set integer(MiscInt1, 6)
  459.         else  
  460.             set integer(MiscInt1, 7)
  461.         endif
  462.         set string(MiscString3,"AT&FX4&A1&B/(MiscInt1)&H1&R2S0=/(RingsToAnswer)")
  463.         set flag(HHS, true)
  464.     endif
  465.     if equal(ModemNumber,112) set string(MiscString3,"AT&FX4&C1&D2&K3\N3S95=61S0=/(RingsToAnswer)")
  466.     if equal(ModemNumber,112) set flag(HHS, true)
  467.     if equal(ModemNumber,113) set string(MiscString3,"AT&FX4&C1&D2&K3\G0S36=7S46=138S95=3S0=/(RingsToAnswer)")
  468.     if equal(ModemNumber,113) set flag(HHS, true)
  469.     if equal(ModemNumber,114) set string(MiscString3,"AT&F2X4&C1&D2&K3&Q9\N3S95=32S0=/(RingsToAnswer)")
  470.     if equal(ModemNumber,114) set flag(HHS, true)
  471.     if equal(ModemNumber,115) set string(MiscString3,"AT&FX4&C1&D2&K3&R0\N3%C1S95=35S0=/(RingsToAnswer)")
  472.     if equal(ModemNumber,115) set flag(HHS, true)
  473.     if equal(ModemNumber,116) set string(MiscString3,"AT&FX4&C1&D2\D1\J0\N6\Q3\V1\X1S0=/(RingsToAnswer)")
  474.     if equal(ModemNumber,116) set flag(HHS, true)
  475.     if equal(ModemNumber,117) set string(MiscString3,"AT&FX4&C1&D2&K3S59=0S0=/(RingsToAnswer)")
  476.     if equal(ModemNumber,117) set flag(HHS, true)
  477.     if equal(ModemNumber,118) set string(MiscString3,"AT&FX4&C1&D2&K3&Q5&R0S95=35S0=/(RingsToAnswer)")
  478.     if equal(ModemNumber,118) set flag(HHS, true)
  479.     if equal(ModemNumber,119) set string(MiscString3,"AT&F1V1X4&C1&D2&K3&Q5S0=/(RingsToAnswer)")
  480.     if equal(ModemNumber,119) set flag(HHS, true)
  481.     if equal(ModemNumber,120) set string(MiscString3,"AT&FX4&C1&D2*FL3*MS0*SM3*XC2S0=/(RingsToAnswer)")
  482.     if equal(ModemNumber,120) set flag(HHS, true)
  483.     if equal(ModemNumber,121) 
  484.         set string(MiscString3,"AT&FX4&C1&D2&Q5\J0\N3\Q3\V1\X1%C1")
  485.         set string(InitString2,"ATS46=138S48=7S0=/(RingsToAnswer)")
  486.         set flag(HHS, true)
  487.     endif
  488.     if equal(ModemNumber,122) 
  489.         set string(MiscString3,"AT&F1&C1&D2\Q3&S1S0=/(RingsToAnswer)")
  490.         set flag(HHS, true)
  491.     endif
  492.     if equal(ModemNumber,125) set string(MiscString3,"AT&F0X6&C1&D2&R0\C1\D1\N5\Q3\X1S0=/(RingsToAnswer)")
  493.     if equal(ModemNumber,125) set flag(HHS, true)
  494.     if equal(ModemNumber,126) set string(MiscString3,"AT&F&C1&D2&K3&Q5\N3S11=55S95=47S0=/(RingsToAnswer)")
  495.     if equal(ModemNumber,126) set flag(HHS, true)
  496.     if equal(ModemNumber,127) set string(MiscString3,"AT&F&C1&D2*SM3*XC2*FL3S0=/(RingsToAnswer)")
  497.     if equal(ModemNumber,127) set flag(HHS, true)
  498.     if equal(ModemNumber,128) set string(MiscString3,"AT&F&C1&D2&K3&Q9\N3S95=1S0=/(RingsToAnswer)")
  499.     if equal(ModemNumber,128) set flag(HHS, true)
  500.     if equal(ModemNumber,129) set string(MiscString3,"AT&FV1&C1&D2\D1\G1\N3\X1S0=/(RingsToAnswer)")
  501.     if equal(ModemNumber,129) set flag(HHS, true)
  502.     if equal(ModemNumber,130) set string(MiscString3,"AT&F&C1&D2\J\N3\Q3\V2\X1S0=/(RingsToAnswer)")
  503.     if equal(ModemNumber,130) set flag(HHS, true)
  504.     if equal(ModemNumber,131) set string(MiscString3,"AT&F&C1&D2\J\N3\Q3\V2\X1S0=/(RingsToAnswer)")
  505.     if equal(ModemNumber,131) set flag(HHS, true)
  506.     if equal(ModemNumber,132) set string(MiscString3,"AT&FX6&C1&D2\N7\Q3\X1S0=/(RingsToAnswer)")
  507.     if equal(ModemNumber,132) set flag(HHS, true)
  508.     if equal(ModemNumber,133) set string(MiscString3,"AT&FX4&C1&D2\N3\Q1\V0\X1\M1\P1S0=/(RingsToAnswer)")
  509.     if equal(ModemNumber,133) set flag(HHS, true)
  510.     if equal(ModemNumber,134) set string(MiscString3,"AT&FX4&C1&D2&K3%C1\J0\Q3\V1\X1S0=/(RingsToAnswer)")
  511.     if equal(ModemNumber,134) set flag(HHS, true)
  512.     if equal(ModemNumber,135) set string(MiscString3,"AT&F&C1&D2\N9\J0\V1\X1S0=/(RingsToAnswer)")
  513.     if equal(ModemNumber,135) set flag(HHS, true)
  514.     if equal(ModemNumber,136) set string(MiscString3,"AT&FX4&C1&D2&K3S0=/(RingsToAnswer)")
  515.     if equal(ModemNumber,136) set flag(HHS, true)
  516.     if equal(ModemNumber,136) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2S0=/(RingsToAnswer)")
  517.     if equal(ModemNumber,137) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2")
  518.     if equal(ModemNumber,139) set string(MiscString3,"AT&FS0=/(RingsToAnswer)")
  519.     if equal(ModemNumber,139) set flag(HHS, true)
  520.     if equal(ModemNumber,140) set string(MiscString3,"AT&F0S0=/(RingsToAnswer)")
  521.     if equal(ModemNumber,140) set flag(HHS, true)
  522.     if equal(ModemNumber,141) set string(MiscString3,"AT&F2S0=/(RingsToAnswer)")
  523.     if equal(ModemNumber,141) set flag(HHS, true)
  524.     if equal(ModemNumber,142) set string(MiscString3,"AT&F&C1&D2S0=/(RingsToAnswer)")
  525.     if equal(ModemNumber,143) set string(MiscString3,"AT&F&C1&D2&I0E1V1Q0X3\X0\V1\Q2\R2\N3%C1S0=/(RingsToAnswer)")
  526.     if equal(ModemNumber,143) set flag(HHS, true)
  527.     if equal(ModemNumber,144) set string(MiscString3,"AT&F&C1&D2N3\N3\Q3\V1\X1S11=55S0=/(RingsToAnswer)")
  528.     if equal(ModemNumber,144) set flag(HHS, true)
  529.     if equal(ModemNumber,145) set string(MiscString3,"AT&F&C1&D2S0=/(RingsToAnswer)")
  530.     if equal(ModemNumber,146) set string(MiscString3,"AT&F&C1&D2&K3\N35S95=2S0=/(RingsToAnswer)")
  531.     if equal(ModemNumber,146) set flag(HHS, true)
  532.     if equal(ModemNumber,147) set string(MiscString3,"AT&FX4&C1&D2\J0\Q3\V2\X1S0=/(RingsToAnswer)")
  533.     if equal(ModemNumber,147) set flag(HHS,true)
  534.     if equal(ModemNumber,148) set string(MiscString3,"ATE1V1Q0X1S0=/(RingsToAnswer)")
  535.     if equal(ModemNumber,148) set flag(HHS,false)
  536.     if equal(ModemNumber,149) set string(MiscString3,"AT&F0E1V1Q0X4&C1&D2&R0\N3&K3%C3S0=/(RingsToAnswer)")
  537.     if equal(ModemNumber,149) set flag(HHS,true)
  538.     if equal(ModemNumber,150) set string(MiscString3,"AT&FX3W0&C1&D2&K3\N5S0=/(RingsToAnswer)")
  539.     if equal(ModemNumber,150) set flag(HHS,true)
  540.     if equal(ModemNumber,150) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\J0\N3\X1S0=/(RingsToAnswer)")
  541.     if equal(ModemNumber,150) set flag(HHS,true)
  542.     if equal(ModemNumber,151) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\J0\N3\X1S0=/(RingsToAnswer)")
  543.     if equal(ModemNumber,151) set flag(HHS,true)
  544.     if equal(ModemNumber,152) set string(MiscString3,"AT&FE1V1Q0X4&C1&D2\N3\V1%C1S0=/(RingsToAnswer)")
  545.     if equal(ModemNumber,152) set flag(HHS,true)
  546.     if equal(ModemNumber,153) set string(MiscString3, "AT&FE1V1Q0X4&C1&D2&K3\V1\J0\N3\Q3S0=/(RingsToAnswer)")
  547.     if equal(ModemNumber,153) set flag(HHS,true)
  548.  
  549. AddExtraCmds:
  550.     if length("/(ExtraMdmCmds)",MiscInt2)
  551.         ifnot string match(InitString2, "AT") set string(InitString2, "AT")
  552.         set string(InitString2,"/(InitString2)/(ExtraMdmCmds)")
  553.     endif
  554.     goto InitializeModem
  555.  
  556. ISDNDevices:
  557.     gosub DisplayBanner4
  558.     set flag(HHS,true)
  559.     if answer(TRUE) then goto ContinueModemInit else goto _Error
  560.  
  561. NEC_ISDterm:
  562.     set string(MiscString3,"NEC")
  563.     if flag(FromVoiceCall) goto ErrSwitchNotAvailable
  564.     character delay(50)
  565.     set integer(MiscInt2,6)
  566. NEC_ISDterm1:
  567.     if equal(MiscInt2,6) set integer(MiscInt1,9600)
  568.     if equal(MiscInt2,5) set integer(MiscInt1,19200)
  569.     if equal(MiscInt2,4) set integer(MiscInt1,4800)
  570.     if equal(MiscInt2,3) set integer(MiscInt1,2400)
  571.     if equal(MiscInt2,2) set integer(MiscInt1,1200)
  572.     if equal(MiscInt2,1) set integer(MiscInt1,300)
  573.     setting("baud",MiscInt1)
  574.     type("AT/r")
  575.     if wait text("OK",1) goto NEC_ISDterm2
  576.     if decrement(MiscInt2) goto NEC_ISDterm1
  577.     goto ErrNoModemResponse
  578. NEC_ISDterm2:
  579.     set integer(BaudRate,MiscInt1)
  580.     option("xprotocol",on)
  581.     set integer(AnswerCall,1)
  582.     goto VoiceToData1
  583.  
  584. NEC_Modem:
  585.     set string(MiscString3,"AT&FE1V1Q0X4&C1&D2L1S0=/(RingsToAnswer) /(ExtraMdmCmds)")
  586.     set flag(HHS,true)
  587.     set integer(AnswerCall,1)
  588.     type("/(MiscString3)/r")
  589.     ifnot wait text("OK") goto ErrNoModemResponse
  590.     type("AT</r")
  591.     ifnot wait text("*") goto ErrNoModemResponse
  592.     type("C1 T1/r")
  593.     ifnot wait text("OK") end()
  594.     type("Q/r")
  595.     ifnot wait text("OK") goto ErrNoModemResponse
  596.     if flag(FromVoiceCall) goto ContinueModemInit
  597.     goto PrepareToWait
  598.  
  599. Fujitsu:
  600.     set string(MiscString3,"Fujitsu")
  601.     if flag(FromVoiceCall) goto ErrSwitchNotAvailable
  602.     character delay(50)
  603.     type ("AT/r")
  604.     wait seconds (1)
  605.     if screen match("1>",1) goto Fujitsu1
  606.     type("ATMENU/r")
  607.     ifnot wait line(1,2) goto ErrNoModemResponse
  608.     ifnot wait text("1>",1) goto ErrNoModemResponse
  609. Fujitsu1:
  610.     type("/(MiscString2):/r")
  611.     ifnot wait line(1,2) goto ErrNoModemResponse
  612.     ifnot wait text("1>",1) goto ErrNoModemResponse
  613.     type("END/r")
  614.     if wait text("OK",2) goto Fujitsu2
  615. Fujitsu2:
  616.     ifnot wait line(1,1) prompt("/n")
  617.     type("AT%P0/r")
  618.     if equal(VoiceDataCable,9600) goto Fujitsu3
  619.     setting("baud", 9600)
  620.     ifnot wait text("OK",2) goto ErrNoModemResponse
  621.     setting("baud",VoiceDataCable)
  622.     type("AT/r")
  623. Fujitsu3:
  624.     ifnot wait text("OK",2) goto ErrNoModemResponse
  625.     type("ATS54=1/r")
  626.     ifnot wait text("OK",2) goto ErrNoModemResponse
  627.     type("ATS56=5/r")
  628.     ifnot wait text("OK",2) goto ErrNoModemResponse
  629.     option("xprotocol",on)
  630.     set integer(AnswerCall,1)
  631.     goto VoiceToData1
  632.  
  633. Telrad:
  634.     set string(MiscString3,"Telrad")
  635.     if flag(FromVoiceCall) goto ErrSwitchNotAvailable
  636. Telrad1:
  637.     character delay(50)
  638.     set integer(MiscInt2,7)
  639. Telrad2:
  640.     if equal(MiscInt2,7) set integer(MiscInt1,9600)
  641.     if equal(MiscInt2,6) set integer(MiscInt1,4800)
  642.     if equal(MiscInt2,5) set integer(MiscInt1,2400)
  643.     if equal(MiscInt2,4) set integer(MiscInt1,1200)
  644.     if equal(MiscInt2,3) set integer(MiscInt1,300)
  645.     if equal(MiscInt2,2) set integer(MiscInt1,1800)
  646.     if equal(MiscInt2,1) set integer(MiscInt1,600)
  647.     setting("baud",MiscInt1)
  648.     type("/r")
  649.     if wait text("*",2) goto Telrad3
  650.     if decrement(MiscInt2) goto Telrad2
  651.     goto ErrNoModemResponse
  652. Telrad3:
  653.     setting("outgoing hhs",0)
  654.     setting("incoming hhs",0)
  655.     type("PROF 4/r")
  656.     wait seconds (1)
  657.     setting("baud",9600)
  658.     type("/r")
  659.     ifnot wait line(1,2) goto ErrNoModemResponse
  660.     ifnot wait text("*",1) goto ErrNoModemResponse
  661.     if equal(BaudRate,9600) goto Telrad4
  662.     set integer(MiscInt1,2)
  663.     if equal(BaudRate,4800) set integer(MiscInt1,13)
  664.     if equal(BaudRate,2400) set integer(MiscInt1,12)
  665.     if equal(BaudRate,1800) set integer(MiscInt1,7)
  666.     if equal(BaudRate,1200) set integer(MiscInt1,3)
  667.     if equal(BaudRate,600) set integer(MiscInt1,4)
  668.     type("set 11:/(MiscInt1)/r")
  669.     wait seconds (2)
  670.     setting("baud",BaudRate)
  671.     type("/r")
  672.     ifnot wait line(1,2) goto ErrNoModemResponse
  673.     ifnot wait text("*",2) goto ErrNoModemResponse
  674. Telrad4:
  675.     type("set 2:0,101:32,103:16,104:80,126:1,130:0/r")
  676.     ifnot wait line(1,3) goto ErrNoModemResponse
  677.     ifnot wait text("*",3) goto ErrNoModemResponse
  678.     set flag(HHS,true)
  679.     set integer(AnswerCall,1)
  680.     goto PrepareToWait2
  681.  
  682. ATT:
  683.     set string(MiscString3,"AT&T")
  684.     if flag(FromVoiceCall) goto ErrSwitchNotAvailable
  685.     character delay(50)
  686.     set integer(MiscInt2,6)
  687. ATT1:
  688.     if equal(MiscInt2,6) set integer(MiscInt1,9600)
  689.     if equal(MiscInt2,5) set integer(MiscInt1,19200)
  690.     if equal(MiscInt2,4) set integer(MiscInt1,4800)
  691.     if equal(MiscInt2,3) set integer(MiscInt1,2400)
  692.     if equal(MiscInt2,2) set integer(MiscInt1,1200)
  693.     if equal(MiscInt2,1) set integer(MiscInt1,300)
  694.     setting("baud",MiscInt1)
  695.     break()
  696.     wait seconds (1)
  697.     type("at/r")
  698.     if wait text("CMD:",1) goto ATT2
  699.     if decrement(MiscInt2) goto ATT1
  700.     goto ErrNoModemResponse
  701. ATT2:
  702.     type("set au on/r")
  703.     ifnot wait line(1,2) goto ErrNoModemResponse
  704.     ifnot wait text("CMD:",2) goto ErrNoModemResponse
  705.     setting("baud",9600)
  706.     break()
  707.     wait seconds (1)
  708.     type("at/r")
  709.     ifnot wait line(1,2) goto ErrNoModemResponse
  710.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  711.     type("copy p0 to active/r")
  712.     ifnot wait line(1,2) goto ErrNoModemResponse
  713.     ifnot wait text("CMD:",2) goto ErrNoModemResponse
  714.     setting("baud",BaudRate)
  715.     break()
  716.     wait seconds (1)
  717.     type("at/r")
  718.     ifnot wait line(1,2) goto ErrNoModemResponse
  719.     ifnot wait text("CMD:",2) goto ErrNoModemResponse
  720.     type("set dcd fo/r")
  721.     ifnot wait line(1,2) goto ErrNoModemResponse
  722.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  723.     type("set dtr fo/r")
  724.     ifnot wait line(1,2) goto ErrNoModemResponse
  725.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  726.     if string match(ModemName, "D Channel")
  727.         type("set mode DX25/r")
  728.     else
  729.         type("set mode B2/r")
  730.     endif
  731.     ifnot wait line(1,2) goto ErrNoModemResponse
  732.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  733.     type("set rec eia/r")
  734.     ifnot wait line(1,2) goto ErrNoModemResponse
  735.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  736.     type("set tran eia/r")
  737.     ifnot wait line(1,2) goto ErrNoModemResponse
  738.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  739.     type("set an auto/r")
  740.     ifnot wait line(1,2) goto ErrNoModemResponse
  741.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  742.     set flag(HHS, true)
  743.     set integer(AnswerCall,1)
  744.     goto PrepareToWait2
  745.  
  746. Fastcomm:
  747.     setting("baud",BaudRate)
  748.     character delay(250)
  749.     if greater(BaudRate,8000) setting("baud",2400) 
  750.     hangup()
  751.     gosub Fastcomm2
  752.     ifnot flag(ModemResponded) goto ErrNoModemResponse
  753.     if less(BaudRate,8000) goto Fastcomm1
  754.     setting("baud",BaudRate) 
  755.     hangup()
  756.     gosub Fastcomm2
  757.     ifnot flag(ModemResponded) goto ErrNoModemResponse
  758. Fastcomm1:
  759.     set flag(ModemResponded,false)
  760.     character delay(50)
  761.     if greater(BaudRate,3000) set flag(HHS,true)
  762.     if greater(AnswerCall,0) goto ContinueModemInit
  763.     set integer(MiscInt2,1)
  764.     if greater(BaudRate,10000) set integer(MiscInt2,0)
  765.     type("AT #F Q0 S0=/(RingsToAnswer) S58=/(MiscInt2) #LCN #LDN #LX3 #LRF ExtraMdmCmds/r")
  766.     ifnot wait text("OK",10) goto ErrNoModemResponse
  767.     ifnot wait line(1,2) goto ErrNoModemResponse
  768.     hangup()
  769.     goto ContinueModemInit
  770. Fastcomm2:
  771.     set flag(ModemResponded,false)
  772.     gosub Fastcomm4
  773.     if wait text("OK",3) goto Fastcomm3
  774.     gosub Fastcomm4
  775.     if wait text("OK",3) goto Fastcomm3
  776.     return()
  777. Fastcomm3:
  778.     ifnot wait line(1,1) prompt("/n")
  779.     set flag(ModemResponded,true)
  780.     return()
  781. Fastcomm4:
  782.     set integer(MiscInt2,5)
  783. Fastcomm5:
  784.     type("A")
  785.     if wait text("A",1) goto Fastcomm6
  786.     if decrement(MiscInt2) goto Fastcomm5
  787. Fastcomm6:
  788.     type("T/r")
  789.     return()
  790.  
  791. Telebit:
  792.     set string(MiscString2,"/(MiscString3)")
  793.     if flag(OS2)
  794.         set integer(MiscInt2,6)
  795.         goto Telebit1:
  796.     endif
  797.     if equal(ModemNumber, 37)
  798.         set integer(MiscInt2,8)
  799.     else
  800.         set integer(MiscInt2,7)
  801.     endif
  802. Telebit1:
  803.     if equal(MiscInt2,8) set integer(MiscInt1,57600)
  804.     if equal(MiscInt2,7) set integer(MiscInt1,38400)
  805.     if equal(MiscInt2,6) set integer(MiscInt1,19200)
  806.     if equal(MiscInt2,5) set integer(MiscInt1,9600)
  807.     if equal(MiscInt2,4) set integer(MiscInt1,4800)
  808.     if equal(MiscInt2,3) set integer(MiscInt1,2400)
  809.     if equal(MiscInt2,2) set integer(MiscInt1,1200)
  810.     if equal(MiscInt2,1) set integer(MiscInt1,300)
  811.     ifnot equal(ModemNumber,42) goto Telebit2
  812.     divide(MiscInt1,10)
  813.     multiply(MiscInt1,9)
  814. Telebit2:
  815.     setting("baud",MiscInt1)
  816.     type("AT&F/r")
  817.     if wait text("OK",1) goto Telebit3
  818.     if decrement(MiscInt2) goto Telebit1
  819.     goto ErrNoModemResponse
  820. Telebit3:
  821.     setting("baud",9600)
  822.     set integer(MiscInt2,5)
  823.     if equal(BaudRate,300)   set integer(MiscInt2,0)
  824.     if equal(BaudRate,1200)  set integer(MiscInt2,1)
  825.     if equal(BaudRate,2400)  set integer(MiscInt2,2)
  826.     if equal(BaudRate,4800)  set integer(MiscInt2,3)
  827.     if equal(BaudRate,9600)  set integer(MiscInt2,4)
  828.     if equal(BaudRate,19200) set integer(MiscInt2,5)
  829.     if equal(BaudRate,38400) set integer(MiscInt2,6)
  830.     if equal(BaudRate,57600) set integer(MiscInt2,7)
  831.     if equal(ModemNumber, 88)
  832.         set string(MiscString2,"/(MiscString2)X2S51=/(MiscInt2)")
  833.     elseif equal(ModemNumber, 65)
  834.         set string(MiscString2,"ATE1V1Q0X2S0=/(RingsToAnswer)S51=/(MiscInt2)")
  835.     elseif equal(ModemNumber, 37)
  836.         set string(MiscString2,"ATE1V1Q0X2S0=/(RingsToAnswer)S51=/(MiscInt2)")
  837.     elseif equal(ModemNumber, 51) 
  838.         set string(MiscString2,"/(MiscString2)X3S51=/(MiscInt2)")
  839.     else
  840.         set string(MiscString2,"/(MiscString2)X3S51=/(MiscInt2)I")
  841.     endif
  842.     wait seconds (1)
  843.     character delay(50)
  844.     type("/(MiscString2)/r")
  845.     ifnot wait text("OK",17) goto ErrNoModemResponse
  846.     if equal(ModemNumber,51) goto Telebit4
  847.     ifnot screen match("96",2) goto Telebit4
  848.     ifnot get integer(MiscInt2,"/S(9)") goto Telebit4
  849.     ifnot equal(MiscInt2,961) set integer(ModemNumber,41)
  850. Telebit4:
  851.     if wait line(1,1) goto Telebit5
  852.     prompt("/n")
  853. Telebit5:
  854.     setting("baud",BaudRate)
  855.     if equal(ModemNumber,42) gosub SetFastlinkSub
  856.     character delay(50)
  857.     set flag(HHS,true)
  858.     if equal(ModemNumber, 88)
  859.         set string(MiscString3,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  860.     elseif equal(ModemNumber, 65)
  861.         set string(MiscString3,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  862.     elseif equal(ModemNumber, 37)
  863.         set string(MiscString3,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  864.     elseif equal(ModemNumber, 51) 
  865.         set string(MiscString3,"ATS52=1S53=1S58=2S66=1S95=2/(ExtraMdmCmds)")
  866.     else
  867.         set string(MiscString3,"ATS52=1S53=1S58=2S66=1/(ExtraMdmCmds)")
  868.     endif
  869.     wait seconds (1)
  870.     goto InitializeModem
  871.  
  872. WorldBlazer:
  873.     option("Blank", yes)
  874.     option("Display Ascii", yes)
  875.     option("Tenths", yes)
  876.     type("AT/r",0)
  877.     if wait text("OK",1)
  878.         ifnot wait line(1,1) greater(2,1)
  879.         option("Blank", no)
  880.         option("Display Ascii", no)
  881.         option("Tenths", no)
  882.         goto TelebitInit
  883.     else
  884.         length(ModemName, MiscInt1)
  885.         add(MiscInt1, 35)
  886.         option("Blank", no)
  887.         option("use menu colors", yes)
  888.         option("Blink", yes)
  889.         position(2,MiscInt1)
  890.         prompt("(Hunting for DTE rate...)")
  891.         option("Blank", yes)
  892.         option("use menu colors", no)
  893.         option("Blink", no)
  894.         position(5,1)
  895.     endif
  896.     set integer(BaudIndex, 13)
  897.     set flag(SlowOS2, false)
  898.     if flag(OS2)
  899.         if less(OSVersion, 200)
  900.             set flag(SlowOS2, True)
  901.         endif
  902.     endif
  903.     goto HuntLoop
  904.  
  905. HuntLoop:
  906.     if equal(BaudIndex,13)
  907.         if and(OS2, SlowOS2) goto NextBaudIndex
  908.         set integer(TempBaud,38400)
  909.     elseif equal(BaudIndex,12) 
  910.         set integer(TempBaud,19200)
  911.     elseif equal(BaudIndex,11) 
  912.         set integer(TempBaud,9600)
  913.     elseif equal(BaudIndex,10) 
  914.         set integer(TempBaud,2400)
  915.     elseif equal(BaudIndex,9)
  916.         if and(OS2, SlowOS2) goto NextBaudIndex
  917.         set integer(TempBaud,57600)
  918.     elseif equal(BaudIndex,8)
  919.         if and(OS2, SlowOS2) goto NextBaudIndex
  920.         set integer(TempBaud,115200)
  921.     elseif equal(BaudIndex,7) 
  922.         if and(OS2, SlowOS2) goto NextBaudIndex
  923.         set integer(TempBaud,76800)
  924.     elseif equal(BaudIndex,6)
  925.         if and(OS2, SlowOS2) goto NextBaudIndex
  926.         set integer(TempBaud,14400)
  927.     elseif equal(BaudIndex,5) 
  928.         if and(OS2, SlowOS2) goto NextBaudIndex
  929.         set integer(TempBaud,12000)
  930.     elseif equal(BaudIndex,4)
  931.         if and(OS2, SlowOS2) goto NextBaudIndex
  932.         set integer(TempBaud,7200)
  933.     elseif equal(BaudIndex,3)
  934.         if and(OS2, SlowOS2) goto NextBaudIndex
  935.         set integer(TempBaud,4800)
  936.     elseif equal(BaudIndex,2) 
  937.         set integer(TempBaud,1200)
  938.     elseif equal(BaudIndex,1) 
  939.         set integer(TempBaud,300)
  940.     endif
  941.     type("AT/r",0)
  942.     if wait text("OK",1)
  943.         ifnot wait line(1,1) greater(2,1)
  944.         option("Tenths", no)
  945.         option("Blank", no)
  946.         option("use menu colors", yes)
  947.         position(2,MiscInt1)
  948.         prompt("                         ")
  949.         option("use menu colors", no)
  950.         position(5,1)
  951.         option("Blank", no)
  952.         option("Display Ascii", no)
  953.         goto TelebitInit
  954.     endif
  955. NextBaudIndex:
  956.     if decrement(BaudIndex) goto HuntLoop
  957.     option("Blank", no)
  958.     option("Display Ascii", no)
  959.     option("Tenths", no)
  960.     goto ErrNoModemResponse
  961.  
  962. TelebitInit:
  963.     if equal(BaudRate,115200) 
  964.         set integer(BaudIndex,9)
  965.     elseif equal(BaudRate,76800) 
  966.         set integer(BaudIndex,8)
  967.     elseif equal(BaudRate,57600) 
  968.         set integer(BaudIndex,7)
  969.     elseif equal(BaudRate,38400)
  970.         set integer(BaudIndex,6)
  971.     elseif equal(BaudRate,19200)
  972.         set integer(BaudIndex,5)
  973.     elseif equal(BaudRate,14400)
  974.         set integer(BaudIndex,46)
  975.     elseif equal(BaudRate,12000) 
  976.         set integer(BaudIndex,43)
  977.     elseif equal(BaudRate,9600) 
  978.         set integer(BaudIndex,4)
  979.     elseif equal(BaudRate,7200)
  980.         set integer(BaudIndex,35)
  981.     elseif equal(BaudRate,4800) 
  982.         set integer(BaudIndex,3)
  983.     elseif equal(BaudRate,2400)
  984.         set integer(BaudIndex,2)
  985.     elseif equal(BaudRate,1200) 
  986.         set integer(BaudIndex,1)
  987.     elseif equal(BaudRate,300) 
  988.         set integer(BaudIndex,0)
  989.     endif
  990.     position(5,1)
  991.     type("AT&F&C1&D2X2S0=/(RingsToAnswer)S11=55S51=/(BaudIndex)S58=2S59=15S69=2S92=1/(ExtraMdmCmds)/r",0)
  992.     ifnot wait text("OK",3) goto ErrNoModemResponse
  993.     ifnot wait line(1,1) greater(2,1)
  994.     setting("baud",BaudRate)
  995.     set flag(HHS,true)
  996.     set integer(AnswerCall, 1)
  997.     goto    PrepareToWait
  998.  
  999. Rixon:
  1000.     wait seconds (1)
  1001.     type("/r/r")
  1002.     ifnot wait text("$",10) goto ErrNoModemResponse
  1003.     wait seconds (1)
  1004.     type("NU")
  1005.     ifnot wait text("OK",3) goto ErrNoModemResponse
  1006.     option("rvideo",on)
  1007.     goto CarrierDetectError
  1008.  
  1009. USR2400E:
  1010.     set integer(MiscInt2,7)
  1011. USR2400E1:
  1012.     type("AT/r")
  1013.     if wait text("OK",1) goto USR2400E2
  1014.     if equal(MiscInt2,7) setting("baud",2400)
  1015.     if equal(MiscInt2,6) setting("baud",19200)
  1016.     if equal(MiscInt2,5) setting("baud",9600)
  1017.     if equal(MiscInt2,4) setting("baud",4800)
  1018.     if equal(MiscInt2,3) setting("baud",1200)
  1019.     if equal(MiscInt2,2) setting("baud",300)
  1020.     if equal(MiscInt2,1) setting("baud",600)
  1021.     if decrement(MiscInt2) goto USR2400E1
  1022.     goto ErrNoModemResponse
  1023. USR2400E2:
  1024.     ifnot wait lines(1,3) prompt("/n")
  1025.     if less(BaudRate,4800) type("AT&F/r")
  1026.     if equal(BaudRate,19200) type("AT&F&B7/r")
  1027.     if equal(BaudRate,9600) type("AT&F&B6/r")
  1028.     if equal(BaudRate,4800) type("AT&F&B5/r")
  1029.     ifnot wait text("OK",8) goto ErrNoModemResponse
  1030.     ifnot wait lines(1,3) prompt("/n")
  1031.     setting("baud",BaudRate)
  1032.     set flag(HHS,true)
  1033.     type("ATE1X4&H1&R2&D2&C1S0=/(RingsToAnswer)/(ExtraMdmCmds)/r")
  1034.     if wait text("OK",15) goto ContinueModemInit
  1035.     goto ErrNoModemResponse
  1036.  
  1037. USR2400:
  1038.     set string(MiscString2,"/(MiscString3)")
  1039.     type("ATS14?/r")
  1040.     ifnot wait text("OK",15) goto ErrNoModemResponse
  1041.     if screen match("000",4) set string(MiscString2,"/(MiscString2)&C1&D2/(ExtraMdmCmds)")
  1042.     set string(MiscString3,"/(MiscString2)")
  1043.     ifnot wait line(1,1) prompt("/n")
  1044.     goto InitializeModem
  1045.  
  1046. Convertible:
  1047.     prompt("/n")
  1048.     option("receive line feeds",yes)
  1049.     set string(MiscString3,"/x0EL 0,F 4,C 1,S 2")
  1050.     if equal(BaudRate,300) set string(MiscString3,"/x0EL 0,F 4,C 1,S 1")
  1051.     if equal(BaudRate,110) set string(MiscString3,"/x0EL 0,F 4,C 1,S 0")
  1052.     setting("baud",1200)
  1053.     type("/(MiscString3)/r")
  1054.     if wait text("OK",5) goto ContinueModemInit
  1055.     setting("baud",300)
  1056.     type("/(MiscString3)/r")
  1057.     if wait text("OK",5) goto ContinueModemInit
  1058.     setting("baud",110)
  1059.     type("/(MiscString3)/r")
  1060.     if wait text("OK",5) goto ContinueModemInit
  1061.     goto ErrNoModemResponse
  1062.  
  1063. Avatex:
  1064.     set string(MiscString3,"in. ")
  1065.     if equal(BaudRate,300) goto Avatex1
  1066.     set string(MiscString3,"out.")
  1067. Avatex1:
  1068.     position(2,5)
  1069.     prompt("The DATA//VOICE button should be in and the 300//1200 button should be /(MiscString3)")
  1070.     goto CheckModem1
  1071. Avatex2:
  1072.     set string(MiscString3,"ATAA")
  1073.     ifnot flag(FromVoiceCall) goto InitializeModem
  1074.     goto VoiceToData1
  1075.  
  1076. MultiTech:
  1077.     set flag(HHS,true)
  1078.     type("AT&FX4B0$BA0$SB/(BaudRate)/r")
  1079.     gosub CheckResponse
  1080.     type("AT&E1&E4&E7&E13S0=/(RingsToAnswer)/(ExtraMdmCmds)/r")
  1081.     gosub CheckResponse
  1082.     type("AT/r")
  1083.     gosub CheckResponse
  1084.     goto ContinueModemInit
  1085.  
  1086. Microcom:
  1087.     ;Modem number 44  = Microcom QX/4232hs
  1088.     ;Modem number 123 = Microcom QX/4232bis
  1089.     if equal(ModemNumber, 44)  set integer(LoopCount,6)
  1090.     if equal(ModemNumber, 123) set integer(LoopCount,8)
  1091.     if flag(OS2)
  1092.         ifnot equal(OSVersion, 200) set integer(LoopCount, 6)
  1093.     endif
  1094. Microcom1:
  1095.     if equal(LoopCount,8) set integer(TempBaud,115200)
  1096.     if equal(LoopCount,7) set integer(TempBaud,38400)
  1097.     if equal(LoopCount,6) set integer(TempBaud,9600)
  1098.     if equal(LoopCount,5) set integer(TempBaud,19200)
  1099.     if equal(LoopCount,4) set integer(TempBaud,4800)
  1100.     if equal(LoopCount,3) set integer(TempBaud,2400)
  1101.     if equal(LoopCount,2) set integer(TempBaud,1200)
  1102.     if equal(LoopCount,1) set integer(TempBaud,300)
  1103.     ifnot setting("baud", TempBaud)
  1104.         if decrement(LoopCount) 
  1105.             goto Microcom1
  1106.         else
  1107.             goto ErrNoModemResponse
  1108.         endif
  1109.     endif
  1110.     type("AT&F/r")
  1111.     if wait text("OK",1)
  1112.         ifnot wait lines(1,1) prompt("/n")
  1113.         goto Microcom2
  1114.     endif
  1115.     if decrement(LoopCount) goto Microcom1
  1116.     goto ErrNoModemResponse
  1117. Microcom2:
  1118.     if less(TempBaud,2401) goto Microcom3
  1119.     type("AT%U/r")
  1120.     gosub CheckResponse
  1121. Microcom3:
  1122.     setting("baud", BaudRate)
  1123.     if equal(ModemNumber, 123)
  1124.         set string(MiscString3,"AT&F&C1&D2\J0\N3\Q3\V2W2-M\X1S0=/(RingsToAnswer)")
  1125.     else
  1126.         set string(MiscString3,"ATX4&C1&D2\J0\N3\Q3S0=/(RingsToAnswer)")
  1127.     endif
  1128.     set flag(HHS, true)
  1129.     type("/(MiscString3)/r")
  1130.     gosub CheckResponse
  1131. Microcom4:
  1132.     if length("/(ExtraMdmCmds)", MiscInt1)
  1133.         ifnot string match(InitString2, "AT") set string(InitString2, "AT")
  1134.         set string(InitString2,"/(InitString2)/(ExtraMdmCmds)")
  1135.         type("/(InitString2)/r")
  1136.         gosub CheckResponse
  1137.     endif
  1138.     goto ContinueModemInit
  1139.  
  1140. Concord:
  1141.     type("ATZ/r")
  1142.     if wait text("OK",7) goto Concord1
  1143.     ifnot screen match(">",1) goto ErrNoModemResponse
  1144.     type("SMC/r")
  1145.     if wait text("OK",7) goto Concord1
  1146.     goto ErrNoModemResponse
  1147. Concord1:
  1148.     if wait line(1,1) goto Concord2
  1149. Concord2:
  1150.     type("AT@ SMD2 SMF0 SLCA2 SPF2 SLCB0 SLCF1 SLCD1 /(ExtraMdmCmds)/r")
  1151.     ifnot wait text("OK",18) goto ErrNoModemResponse
  1152.     if wait line(1,1) goto Concord3
  1153. Concord3:
  1154.     set flag(HHS, true)
  1155.     if less(RingsToAnswer,2) set integer(RingsToAnswer,2)
  1156.     set string(MiscString3,"AT X1 S0=/(RingsToAnswer)")
  1157.     goto InitializeModem
  1158.  
  1159. UserDefined:
  1160.     ifnot read from("modemdef.dat") goto ErrNoModemDef
  1161.     ifnot read string(UserDefCall,"") goto ErrBadModemDef
  1162.     ifnot read string(UserDefAnswer, "") goto ErrBadModemDef
  1163.     ifnot read string(UserDefDial, "") goto ErrBadModemDef
  1164.     ifnot read string(UserDefHangup, "") goto ErrBadModemDef
  1165.     ifnot read string(UserDefCD, "") goto ErrBadModemDef
  1166.     ifnot read string(UserDefToggleDTR, "") goto ErrBadModemDef
  1167.     ifnot read string(UserDefHHS, "") goto ErrBadModemDef
  1168.     read from("")
  1169.     set flag(UserDefinedModem, true)
  1170.     set string(MiscString3, UserDefAnswer)
  1171.     if length("/(ExtraMdmCmds)",MiscInt2) set string(MiscString3,"/(MiscString3)/(ExtraMdmCmds)")
  1172.     if wait carrier(0,0)
  1173.         if string match(UserDefCD,"NO")
  1174.             goto CarrierDetectError
  1175.         endif
  1176.     endif
  1177.     if string match(UserDefHHS,"YES")
  1178.         set flag(HHS, true)
  1179.     else
  1180.         set flag(HHS, false)
  1181.     endif
  1182.     goto CheckModem
  1183.  
  1184. InitializeModem:
  1185.     gosub CheckAbort
  1186.     type("/(MiscString3)/r",50)
  1187.     ifnot wait text("OK",5) goto ErrNoModemResponse
  1188.     ifnot wait lines(1,1) goto ErrNoModemResponse
  1189.     if equal(ModemNumber,47) goto Rixon
  1190.     if length(InitString2, MiscInt1)
  1191.         type("/(InitString2)/r")
  1192.         ifnot wait text("OK",5) goto ErrNoModemResponse
  1193.         ifnot wait lines(1,1) goto ErrNoModemResponse
  1194.     endif
  1195.     gosub CheckAbort
  1196.  
  1197.     if get environment(S(9),"HA5INIT")
  1198.         if string match(S(9),"TRUE")
  1199.             put environment("HA5INIT","")
  1200.             wipe screen()
  1201.             prompt("Modem initialized.../n")
  1202.             end()
  1203.         endif
  1204.     endif
  1205.  
  1206. ContinueModemInit:
  1207.     gosub CHeckAbort
  1208.     set integer(MiscInt2,BaudRate)
  1209.     set integer(AnswerCall,1)
  1210.     setting("baud",BaudRate)
  1211.     if equal(ModemNumber,42) gosub SetFastlinkSub
  1212.     wait seconds (1)
  1213.     ifnot equal(ModemNumber,47) goto ContinueModemInit1
  1214.     type("ATZ/r")
  1215.     wait seconds (1)
  1216. ContinueModemInit1:
  1217.     ifnot flag(FromVoiceCall) goto PrepareToWait
  1218.  
  1219. VoiceToData:
  1220.     ifnot equal(ModemNumber,45) type("ATA/r")
  1221.     if equal(ModemNumber,45) type("/x0EA/r")
  1222.     if wait carrier(1,40) goto AdjustBaudRate
  1223.     set integer(EscBranch ,295)
  1224.     set string(MiscString3,"A data connection could not be established.")
  1225.     gosub DisplayBanner
  1226.     goto _Error
  1227. VoiceToData1:
  1228.     set integer(EscBranch ,980)
  1229.     type("A/r")
  1230.     ifnot wait text("RIER",5) goto _Escape
  1231.     goto _Escape
  1232.  
  1233. PrepareToWait:
  1234.     if flag(ISDN_Support) goto WaitForCarrier
  1235.     if equal(ModemNumber,45) goto PrepareToWait2
  1236.     ifnot equal(BaudRate,2400) goto PrepareToWait1
  1237.     setting("baud",BaudRate)
  1238.     if equal(ModemNumber,42) gosub SetFastlinkSub
  1239.     type("AT/r")
  1240. PrepareToWait1:
  1241.     if flag(LeasedLine) goto DirectCableHost
  1242.     if equal(ModemNumber,97) goto UncommandedModems
  1243.     if equal(ModemNumber,98) goto UncommandedModems
  1244.     if equal(ModemNumber,99) goto UncommandedModems
  1245. PrepareToWait2:
  1246.     wait seconds (1)
  1247.     gosub DisplayBanner4
  1248.  
  1249. WaitForCarrier:
  1250.     gosub DisplayBanner5
  1251.     set integer(LoopCount, 60)
  1252.     while decrement(LoopCount)
  1253.         gosub CheckAbort
  1254.         if wait carrier(1,1) goto AdjustBaudRate
  1255.     endwhile
  1256.     goto WaitForCarrier
  1257.  
  1258. AdjustBaudRate:
  1259.     if wait lines(1,1) goto AdjustBaudRate
  1260. AdjustBaudRate1:
  1261.     if equal(ModemNumber,17) goto AdjustBaudRate2
  1262.     if equal(ModemNumber,61) wait seconds(5)
  1263.     if flag(HHS) goto SetBaudAndSynch1
  1264. AdjustBaudRate2:
  1265.     ifnot screen match("NECT",5) goto ConfigureHostTerminal
  1266.     ifnot get integer(MiscInt2,"/S(9)") goto ConfigureHostTerminal
  1267.     ifnot equal(ModemNumber,17) goto AdjustBaudRate3
  1268.     if greater(MiscInt2,3000) goto SetBaudAndSynch1
  1269. AdjustBaudRate3:
  1270.     if equal(MiscInt2,300) goto SetBaudAndSynch
  1271.     if equal(MiscInt2,600) goto SetBaudAndSynch
  1272.     if equal(MiscInt2,1200) goto SetBaudAndSynch
  1273.     if equal(MiscInt2,2400) goto SetBaudAndSynch
  1274.     if equal(MiscInt2,4800) goto SetBaudAndSynch
  1275.     if equal(MiscInt2,9600) goto SetBaudAndSynch
  1276.     if equal(MiscInt2,19200) goto SetBaudAndSynch
  1277.     goto ConfigureHostTerminal
  1278.  
  1279. SetBaudAndSynch:
  1280.     setting("baud",MiscInt2)
  1281. SetBaudAndSynch1:
  1282.     set flag(ConstantDteRate,true)
  1283.  
  1284. ConfigureHostTerminal:
  1285.     set integer(EscBranch ,620)
  1286.     gosub SetFlowControl
  1287.     option("use menu colors",yes)
  1288.     option("bold",yes)
  1289.     prompt("/n")
  1290.     get position(Row,Col)
  1291.     if greater(Row, 15)
  1292.         wipe screen()
  1293.         set integer(Row,0)
  1294.     endif
  1295.     add (Row,1)
  1296.     position(Row,0)
  1297.     if flag(FromVoiceCall) draw box(5,80)
  1298.     ifnot flag(FromVoiceCall) draw box(4,80)
  1299.     option("bold",no)
  1300.     add(Row,1)
  1301.     position(Row,3)
  1302.     prompt("Your modem has just answered a data call.")
  1303.     option("use menu colors",no)
  1304.     ifnot flag(FromVoiceCall) goto SynchronizeCall
  1305.     add(Row,1)
  1306.     position(Row,5)
  1307.     option("use menu colors",yes)
  1308.     key string(MiscString3,"Place your telephone receiver in its cradle now and press ENTER when ready.")
  1309.  
  1310. SynchronizeCall:
  1311.     position(Row,5)
  1312.     ifnot equal(ModemNumber,26) goto  SynchronizeCall1
  1313.     type("/x11")
  1314.     wait seconds (1)
  1315. SynchronizeCall1:
  1316.     add(Row,1)
  1317.     position(Row,5)
  1318.     if flag(ConstantDteRate) goto SynchronizeCall2
  1319.     if synchronize(MiscInt2,60) goto SynchronizeCall2
  1320.     option("use menu colors",yes)
  1321.     prompt("Unable to find the incoming call's baud rate./n/n/n")
  1322.     option("use menu colors",no)
  1323.     goto HardwareDisconnect
  1324. SynchronizeCall2:
  1325.     set flag(ConstantDteRate,false)
  1326.     option("use menu colors",yes)
  1327.     report("baud", DisplayRate)
  1328.     prompt("The incoming call is at /(DisplayRate) baud./n/n/n")
  1329.     option("use menu colors",no)
  1330.     ifnot equal(ModemNumber,45) goto GetPassword
  1331.     character delay(50)
  1332.     if equal(MiscInt2,BaudRate) goto SynchronizeCall4
  1333.     setting("baud",BaudRate)
  1334.     if equal(MiscInt2,300) type("/x0ES 1/r")
  1335.     if equal(MiscInt2,1200) type("/x0ES 2/r")
  1336.     if wait text("OK",3) goto SynchronizeCall3
  1337. SynchronizeCall3:
  1338.     setting("baud",MiscInt2)
  1339. SynchronizeCall4:
  1340.     wait seconds (1)
  1341.     type("/x0ET 0/r")
  1342.     wait seconds (2)
  1343.  
  1344. GetPassword:
  1345.     if wait characters("/x0D", 1) goto GetPassword:
  1346.     character delay(0) 
  1347.     set integer(PasswordRetry,3)
  1348. GetPassword1:
  1349.     set string(Password,"")
  1350.     if password("/(Password)",1) goto PasswordValid
  1351.     get position(Row,Col)
  1352.     option("use menu colors",yes)
  1353.     option("bold",yes)
  1354.     draw box(3,80)
  1355.     add(Row,1)
  1356.     position(Row,3)
  1357.     option("bold",no)
  1358.     prompt("For the host only: You can skip the required password by pressing ESC.")
  1359.     option("use menu colors",no)
  1360.     add(Row,3)
  1361.     position(Row,1)
  1362.     set integer(EscBranch ,490)
  1363.     set integer(Row,4)
  1364.     if flag(DirectCable) set integer(Row,1000)
  1365. GetPassword2:
  1366.     set flag(CallerIsLoggedOn,false)
  1367.     option("rvideo",off)
  1368.     timeout(30)
  1369.     if flag(DirectCable) timeout(6000)
  1370.     option("receive line feeds",no)
  1371.     prompt("Enter password: /r")
  1372.     type("Enter password: ",0)
  1373. GetPassword3:
  1374.     option("blank",yes)
  1375.     ifnot fetch string(Password,"") goto CheckPassword1
  1376.     option("blank",no)
  1377.     prompt("Enter password: ")
  1378.  
  1379. CheckPassword:
  1380.     if password("/(Password)",1) goto PasswordValid
  1381. CheckPassword1:
  1382.     option("blank",no)
  1383.     ifnot wait carrier(0,0) goto ResetHost
  1384. CheckPassword2:
  1385.     type("/rIncorrect password/r",0)
  1386.     if decrement(PasswordRetry) goto GetPassword2
  1387.     if flag(DirectCable) goto GetPassword2
  1388.     type("/rIf you are having difficulties logging/r",0)
  1389.     type("onto this host, please contact your host operator.",0)
  1390.     goto HardwareDisconnect
  1391.  
  1392. PasswordValid:
  1393.     set flag(CallerIsLoggedOn,true)
  1394.     type("/r")
  1395.     timeout(30)
  1396.     option("blank",no)
  1397.     set string(CallersName,"/S(9)")
  1398.     set integer(EscBranch ,620)
  1399.  
  1400. GetUserName:
  1401.     if length("/(CallersName)",MiscInt1) goto CallbackCheck
  1402.     option("echo",yes)
  1403.     ifnot fetch string(CallersName,"/rPlease enter your name: ") goto HardwareDisconnect
  1404.     type("/r")
  1405.     option("echo",no)
  1406.     password("/(CallersName)",40)
  1407.  
  1408. CallbackCheck:
  1409.     set string(MiscString3,"")
  1410.     if flag(DirectCable) goto ScrogAtLogon
  1411.     password("/(Password)",11)
  1412.     ifnot length("/S(9)", MiscInt1) goto ScrogAtLogon
  1413.     type("/rCallback will take place in 15 seconds./r",0)
  1414.     hangup()
  1415.     wipe screen()
  1416.     set integer(MiscInt1,15)
  1417.     while decrement(MiscInt1)
  1418.         position(1,1)
  1419.         prompt("Callback will take place in /(MiscInt1) seconds...  /n")
  1420.         wipe screen(10,80)
  1421.         wait seconds(1)
  1422.     endwhile
  1423.     if flag(ISDN_Support)
  1424.         ifnot call("/S(9)") goto ErrNoModemResponse
  1425.         goto CallBackCheck1
  1426.     endif
  1427.     option("fduplex", on)
  1428.     character delay(50)
  1429.     gosub SetFlowControl1
  1430.     type("ATDT/S(9)/r")
  1431.     ;type("ATDP/S(9)/r")
  1432.     prompt("/n/n")
  1433.     option("fduplex", off)
  1434.     character delay(0)
  1435. CallbackCheck1:
  1436.     gosub SetFlowControl
  1437.     ifnot wait carrier(1,60) goto HardwareDisconnect
  1438.  
  1439. ScrogAtLogon:
  1440.     ifnot flag(PopupOS2) goto GetLogonScrog
  1441.     ifnot popup("A caller has just logged onto HyperACCESS//5",5) goto GetLogonScrog
  1442. GetLogonScrog:
  1443.     option("echo",on)
  1444.     set integer(PasswordDetail,12)
  1445.     option("echo", yes)
  1446. GetNextLogonScrog:
  1447.     password("/(Password)",PasswordDetail)
  1448.     set string(ScrogName, "/S(9)")
  1449.     ifnot length(ScrogName,MiscInt1) goto LetCallerIn
  1450.     password("/(Password)", 20)
  1451.     get integer(ScrogType,"/S(9)")
  1452.     if equal(ScrogType, 0)
  1453.         ifnot run(ScrogName) goto SetLogonDetailNumber
  1454.     elseif equal(ScrogType, 1)
  1455.         ifnot execute(ScrogName, no) goto SetLogonDetailNumber
  1456.     elseif equal(ScrogType, 2)
  1457.         ifnot execute(ScrogName, yes) goto SetLogonDetailNumber
  1458.     endif
  1459. SetLogonDetailNumber:
  1460.     set integer(PasswordDetail,13)
  1461.     goto GetNextLogonScrog
  1462.  
  1463. LetCallerIn:
  1464.     timeout(30)
  1465.     date(DateTime)
  1466.     time(MiscString2,MiscInt1)
  1467.     wipe screen()
  1468.     position(1,1)
  1469.     type("/rYou're in at /(MiscString2) on /(DateTime), /(CallersName)./r",0)
  1470.     type("Welcome to HyperACCESS//5 by Hilgraeve/r/r",0)
  1471.  
  1472. StartLogging:
  1473.     add(CallsReceived,1)
  1474.     ifnot flag(Logging) goto StartSlave
  1475.     ifnot write to(LogFileName,true) goto StartSlave
  1476.     ifnot write("/r/n/(CallersName), /(DateTime) /(MiscString2)") goto StartSlave
  1477.     ifnot flag(DirectCable)
  1478.         set string(MiscString3,"Duration = //DURATION (min:sec)/r/n/r/n")
  1479.         log duration(MiscString3,LogFileName)
  1480.     else
  1481.         time(MiscString1, DirectStartTime)
  1482.     endif
  1483.  
  1484. StartSlave:
  1485.     option("receive line feeds",yes)
  1486.     option("bottom line",yes)
  1487.     if get environment(MiscString3,"HA5_NOSLAVE") goto LogCallerOff
  1488.     cdelay(0)
  1489.     ifnot flag(DirectCable) slave(15)
  1490.     if flag(DirectCable) slave(0)
  1491.  
  1492. LogCallerOff:
  1493.     gosub SetFlowControl1
  1494.     character delay(0)
  1495.     option("fduplex",no)
  1496.     ifnot wait carrier(0,0) goto LogCallerOff1
  1497.     type("/rThank you for using HyperACCESS//5, /(CallersName). Goodbye./r/n/n",0)
  1498. LogCallerOff1:
  1499.     option("fduplex",no)
  1500.  
  1501. SetBannerInfo:
  1502.     set string(LastCallerName,"/(CallersName)")
  1503.     ifnot length(LastCallerName,MiscInt1) greater(2,1)
  1504.     if greater(MiscInt1,16) left(LastCallerName,16)
  1505.     time(LastCallTime, MiscInt1)
  1506.     left(LastCallTime,5)
  1507.  
  1508. LogDirectCableDuration:
  1509.     timeout(30)
  1510.     ifnot flag(DirectCable) goto HardwareDisconnect
  1511.     time(MiscString1,DirectEndTime)
  1512.     ifnot flag(Logging) goto ScrogAtLogoff
  1513.     ifnot write to(LogFileName,true) goto ScrogAtLogoff
  1514.     subtract(DirectEndTime, DirectStartTime)
  1515.     add(DirectEndTime,1)
  1516.     ifnot write("Duration = /(DirectEndTime):00 (min:sec)") goto ScrogAtLogoff
  1517.     goto ScrogAtLogoff
  1518.  
  1519. HardwareDisconnect:
  1520.     if flag(DirectCable) goto ScrogAtLogoff
  1521.     if flag(UserDefinedModem)
  1522.         ifnot string match(UserDefToggleDTR,"YES") 
  1523.             goto SoftwareDisconnect
  1524.         endif
  1525.     endif
  1526.     gosub SetFlowControl1
  1527.     ifnot wait carrier(0,0) goto ScrogAtLogoff
  1528.     if equal(ModemNumber,62) goto TelradHangup
  1529.     ifnot equal(ModemNumber,62) hangup()
  1530.     ifnot wait carrier(3,1) goto ScrogAtLogoff
  1531.     if equal(ModemNumber,45) goto ManualDisconnect
  1532.     if equal(ModemNumber,97) goto ResetHost
  1533.     if equal(ModemNumber,98) goto ResetHost
  1534.  
  1535. SoftwareDisconnect:
  1536.     character delay(250)
  1537.     wait seconds (1)
  1538.     type("+++")
  1539.     wait seconds (2)
  1540.     if flag(UserDefinedModem)
  1541.         type(UserDefHangup, 0)
  1542.     else
  1543.         type("ATH0/r", 0)
  1544.     endif
  1545.     ifnot wait carrier(4,1) goto ScrogAtLogoff
  1546.     if equal(ModemNumber,51) goto ManualDisconnect
  1547.     wait seconds (2)
  1548.     ifnot wait carrier(4,1) goto ScrogAtLogoff
  1549.  
  1550. TelradHangup:
  1551.     break()
  1552.     ifnot wait text("*",10) goto TelradHangup
  1553.     type("clr/r",30)
  1554.     ifnot wait line(1,2) goto TelradHangup
  1555.     ifnot wait text("*",20) goto TelradHangup
  1556.     goto ScrogAtLogoff
  1557.  
  1558. ManualDisconnect:
  1559.     set flag(ManualHangup,true)
  1560.     set string(MiscString3,"You will have to hang up your modem by hand and then press ENTER to continue.  ")
  1561.     gosub DisplayBanner2
  1562.     option("rvideo",on)
  1563.     if alert("",60) goto ScrogAtLogoff
  1564.     if wait carrier(0,0) goto ManualDisconnect
  1565.  
  1566. ScrogAtLogoff:
  1567.     ifnot flag(CallerIsLoggedOn) goto ResetHost
  1568.     set integer(PasswordDetail,16)
  1569. GetNextLogoffScrog:
  1570.     password("/(Password)",PasswordDetail)
  1571.     set string(ScrogName, "/S(9)")
  1572.     ifnot length(ScrogName,MiscInt1) goto ResetHost
  1573.     password("/(Password)", 20)
  1574.     get integer(ScrogType, "/S(9)")
  1575.     if equal(ScrogType, 0)
  1576.         ifnot run(ScrogName) goto SetLogoffDetailNumber
  1577.     elseif equal(ScrogType, 1)
  1578.         ifnot execute(ScrogName, no) goto SetLogoffDetailNumber
  1579.     elseif equal(ScrogType, 2)
  1580.         ifnot execute(ScrogName, yes) goto SetLogoffDetailNumber
  1581.     endif
  1582. SetLogoffDetailNumber:  
  1583.     set integer(PasswordDetail,17)
  1584.     goto GetNextLogoffScrog
  1585.  
  1586. ResetHost:
  1587.     password("/(Password)",0)
  1588.     if flag(DirectCable) goto DirectCableHost
  1589.     gosub SetFlowControl1
  1590.     set integer(EscBranch ,980)
  1591.     if flag(ISDN_Support) goto SpecialHangup
  1592.     if equal(ModemNumber,97) goto ManualHangup
  1593.     if equal(ModemNumber,98) goto ManualHangup
  1594.     if equal(ModemNumber,99) goto ManualHangup
  1595.     if flag(DirectConnect) goto SpecialHangup
  1596.     if flag(ManualHangup) goto SpecialHangup
  1597.     goto SpecialHangup
  1598. ManualHangup:
  1599.     option("use menu colors",no)
  1600.     wipe screen()
  1601.     if equal(ModemNumber,99) goto SpecialHangup
  1602.     position(1,1)
  1603.     option("use menu colors",yes)
  1604.     option("bold",yes)
  1605.     draw box(3,80)
  1606.     option("bold",no)
  1607.     position(2,3)
  1608.     prompt("Place the phone receiver in the cradle now and press ENTER when ready. ")
  1609.     option("use menu colors",no)
  1610.     wait key(MiscString3,100)
  1611.  
  1612. SpecialHangup:
  1613.     if flag(FromVoiceCall) goto _Error
  1614.     if flag(DirectCable) goto _Error
  1615.     if equal(ModemNumber,97) goto AcousticOrDirect1
  1616.     if equal(ModemNumber,98) goto UncommandedModems
  1617.     if flag(ManualHangup) goto SpecialHangup2
  1618.     if equal(ModemNumber,102) goto ISDNDevices
  1619.     if flag(ISDN_Support) goto PrepareToWait2
  1620.     if equal(ModemNumber,99) goto PrepareToWait2
  1621.     if equal(ModemNumber,17) goto SpecialModemSupportRoutines
  1622.     if equal(ModemNumber,45) goto SpecialModemSupportRoutines
  1623.     if equal(ModemNumber,49) setting("baud",BaudRate)
  1624.     if equal(ModemNumber,49) goto SpecialModemSupportRoutines
  1625.     if equal(ModemNumber,61) set string(MiscString2,"AT&T ISDN deskset")
  1626.     if equal(ModemNumber,61) goto PrepareToWait2
  1627.     if equal(ModemNumber,62) set string(MiscString2,"Telrad IDS 287")
  1628.     if equal(ModemNumber,62) goto CarrierDetectCheck
  1629.     if equal(ModemNumber,63) goto SpecialHangup1
  1630.     if equal(ModemNumber,64) goto SpecialHangup1
  1631.     goto PrepareToWait
  1632. SpecialHangup1:
  1633.     if flag(FromVoiceCall) goto PrepareToWait
  1634.     goto _Escape
  1635. SpecialHangup2:
  1636.     set flag(ManualHangup,false)
  1637.     if equal(ModemNumber,99) goto AutodialSwitch
  1638.     goto SpecialModemSupportRoutines
  1639.  
  1640. UncommandedModems:
  1641.     if equal(ModemNumber,99) goto AutodialSwitch
  1642.     if equal(ModemNumber,97) goto AcousticOrDirect1
  1643.  
  1644. AcousticOrDirect:
  1645.     option("use menu colors",no)
  1646.     wipe screen()
  1647.     option("use menu colors",yes)
  1648.     option("bold",yes)
  1649.     position(1,1)
  1650.     draw box(8,80)
  1651.     position(8,32)
  1652.     prompt(" ESC to cancel ")
  1653.     option("bold",no)
  1654.     set flag(ModemResponded,true)
  1655.     position(2,3)
  1656.     prompt("To answer a data call or to switch from a voice call to a data call...")
  1657.     position(4,4)
  1658.     prompt("1. Pickup the telephone receiver when the telephone rings.")
  1659.     position(5,4)
  1660.     prompt("2. Set the modem's ORIGINATE//ANSWER switch to ANSWER.")
  1661.     position(6,4)
  1662.     if equal(ModemNumber,98) prompt("3. Nest the receiver in the rubber cups.")
  1663.     if equal(ModemNumber,97) prompt("3. Set the modem's TALK//DATA switch to DATA, or press the CONNECT button.")
  1664.     position(7,4)
  1665.     prompt("4. Press ENTER when the data call is established. ")
  1666.     key string(MiscString3,"")
  1667.     set integer(AnswerCall,1)
  1668.     if wait carrier(1,5) goto AdjustBaudRate
  1669.     option("use menu colors",no)
  1670.     wipe screen()
  1671.     goto ErrNoDataConnection
  1672. AcousticOrDirect1:
  1673.     option("use menu colors",no)
  1674.     wipe screen()
  1675.     option("use menu colors",yes)
  1676.     if flag(FromVoiceCall) goto AcousticOrDirect
  1677.     if flag(DirectConnect) goto AcousticOrDirect4
  1678.     if flag(ModemResponded) goto AcousticOrDirect
  1679.     position(1,1)
  1680.     option("bold",yes)
  1681.     draw box(3,80)
  1682.     position(3,32)
  1683.     prompt(" ESC to cancel ")
  1684.     option("bold",no)
  1685.     position(2,3)
  1686.     prompt("Can your /(MiscString2) auto-answer? (Y or N) ")
  1687.     option("use menu colors",no)
  1688. AcousticOrDirect2:
  1689.     wait key(MiscString3,100)
  1690.     if string match(MiscString3,"N") goto AcousticOrDirect
  1691.     if string match(MiscString3,"Y") goto AcousticOrDirect3
  1692.     goto AcousticOrDirect2
  1693. AcousticOrDirect3:
  1694.     set flag(DirectConnect,true)
  1695.     wipe screen()
  1696.     position(1,1)
  1697.     option("use menu colors",yes)
  1698.     option("bold",yes)
  1699.     draw box(4,80)
  1700.     position(4,32)
  1701.     prompt(" ESC to cancel ")
  1702.     option("bold",no)
  1703.     position(2,3)
  1704.     prompt("Manually set your modem's ORIGINATE//ANSWER switch to ANSWER and set")
  1705.     position(3,3)
  1706.     prompt("the TALK//DATA switch to DATA.  Press ENTER when your modem is ready.")
  1707.     key string(MiscString3,"")
  1708.     set integer(AnswerCall,1)
  1709.     goto PrepareToWait2
  1710. AcousticOrDirect4:
  1711.     option("use menu colors",no)
  1712.     wipe screen()
  1713.     option("use menu colors",yes)
  1714.     option("bold",yes)
  1715.     position(1,1)
  1716.     draw box(3,80)
  1717.     position(3,32)
  1718.     prompt(" ESC to cancel ")
  1719.     option("bold",no)
  1720.     position(2,3)
  1721.     prompt("Place your telephone receiver in its cradle now and press ENTER when ready.")
  1722.     wait key(MiscString3,100)
  1723.     goto PrepareToWait2
  1724.  
  1725. AutodialSwitch:
  1726.     option("use menu colors",no)
  1727.     wipe screen()
  1728.     option("use menu colors",yes)
  1729.     position(1,1)
  1730.     if flag(FromVoiceCall) goto VoiceToDataAutoDial
  1731.     option("bold",yes)
  1732.     draw box(4,80)
  1733.     position(4,26)
  1734.     prompt(" ALT-R then ESC to cancel ")
  1735.     option("bold",no)
  1736.     position(2,3)
  1737.     prompt("Manually command your modem to answer calls.  Include a command that")
  1738.     position(3,3)
  1739.     prompt("will turn local echo off.  Press ALT-R when your modem is ready.")
  1740.     option("use menu colors",no)
  1741.     prompt("/n/n/n")
  1742.     type("<ALT-L>VKA")
  1743.     set integer(AnswerCall,1)
  1744.     goto PrepareToWait2
  1745.  
  1746. VoiceToDataAutoDial:
  1747.     option("use menu colors",off)
  1748.     wipe screen()
  1749.     option("use menu colors",on)
  1750.     option("bold",yes)
  1751.     position(1,1)
  1752.     draw box(5,80)
  1753.     option("bold",no)
  1754.     position(2,3)
  1755.     prompt("Manually command your modem to emit an answering carrier tone.")
  1756.     position(3,3)
  1757.     prompt("When the data connection is established, press ALT-R. If the data connection")
  1758.     position(4,3)
  1759.     prompt("cannot be established, press ALT-R, then ESC to return to the menus.")
  1760.     option("use menu colors",off)
  1761.     prompt("/n/n/n")
  1762.     type("<ALT-L>VKA")
  1763.     if wait carrier(1,5) goto AdjustBaudRate
  1764.     goto ErrNoDataConnection
  1765.  
  1766. SetFlowControl:
  1767.     option("echo",no)
  1768.     option("fduplex",no)
  1769.     option("use line wait",no)
  1770.     option("send line feeds",yes)
  1771.     option("receive line feeds",yes)
  1772.     character delay(0)
  1773.     ifnot flag(HHS) return()
  1774.     setting("outgoing hhs",4)
  1775.     setting("incoming hhs",5)
  1776.     return()
  1777. SetFlowControl1:
  1778.     option("echo",no)
  1779.     option("fduplex",yes)
  1780.     option("use line wait",yes)
  1781.     option("send line feeds",no)
  1782.     option("receive line feeds",no)
  1783.     character delay(50)
  1784.     return()
  1785.  
  1786. SetFastlinkSub:
  1787.     set integer(MiscInt1,BaudRate)
  1788.     divide(MiscInt1,10)
  1789.     multiply(MiscInt1,9)
  1790.     setting("baud", MiscInt1)
  1791.     set integer(ModemNumber,42)
  1792.     return()
  1793.  
  1794. SetDowtySub:
  1795.     set integer(MiscInt2,0)
  1796.     if equal(BaudRate,19200) set integer(MiscInt2,17)
  1797.     if equal(BaudRate,9600)  set integer(MiscInt2,13)
  1798.     if equal(BaudRate,4800)  set integer(MiscInt2,11)
  1799.     if equal(BaudRate,2400)  set integer(MiscInt2,10)
  1800.     if equal(BaudRate,1200)  set integer(MiscInt2,9)
  1801.     if equal(BaudRate,300)   set integer(MiscInt2,7)
  1802.     if equal(BaudRate,110)   set integer(MiscInt2,3)
  1803.     if equal(BaudRate,50)    set integer(MiscInt2,1)
  1804.     return()
  1805.  
  1806. CheckResponse:
  1807.     ifnot wait text("OK", 3) goto ErrNoModemResponse
  1808.     ifnot wait lines(1, 1) goto ErrNoModemResponse
  1809.     return()
  1810.  
  1811. CheckAbort:
  1812.     mouse position(Row, Col)
  1813.     if equal(Row, 0) return()
  1814.     if string match(S(9), "ESC") goto _Escape
  1815.     return()
  1816.  
  1817. DisplayBanner:
  1818.     set integer(MiscInt2, 80)
  1819.     ifnot length("/(MiscString3)",VoiceDataCable) goto DisplayBanner1
  1820. DisplayBanner1:
  1821.     gosub DisplayBanner2
  1822.     goto _Escape
  1823. DisplayBanner2:
  1824.     option("use menu colors",yes)
  1825.     option("bold",yes)
  1826.     position(10,1)
  1827.     draw box(3,80)
  1828.     position(12,32)
  1829.     prompt(" ESC to continue ")
  1830.     option("bold",no)
  1831.     position(11,3)
  1832.     subtract(MiscInt2,VoiceDataCable)
  1833.     divide(MiscInt2,2)
  1834. DisplayBanner3:
  1835.     set string(MiscString3," /(MiscString3)")
  1836.     if decrement(MiscInt2) goto DisplayBanner3
  1837.     prompt("/(MiscString3)")
  1838.     position(14,1)
  1839.     whilenot get key(MiscString1)
  1840.         gosub CheckAbort
  1841.         wait seconds(1)
  1842.     endwhile
  1843.     return()
  1844.  
  1845. DisplayBanner4:
  1846.     option("bottom line",no)
  1847.     option("use menu colors",no)
  1848.     gosub CheckAbort
  1849.     wipe screen()
  1850.     position(1,1)
  1851.     option("use menu colors",yes)
  1852.     option("bold",yes)
  1853.     draw box(5,80)
  1854.     position(1,12)
  1855.     prompt("┬")
  1856.     position(1,72)
  1857.     prompt("┬")
  1858.     position(2,12)
  1859.     prompt("│")
  1860.     position(2,72)
  1861.     prompt("│")
  1862.     position(3,1)
  1863.     prompt("├──────────┴──────────────────────────────────────")
  1864.     prompt("─────────────────────┴───────┤")
  1865.     position(4,23)
  1866.     prompt("·")
  1867.     position(4,46)
  1868.     prompt("·")
  1869.     position(5,32)
  1870.     prompt(" ESC to cancel ")
  1871.     option("bold",no)
  1872.     position(2,22)
  1873.     prompt("HyperACCESS//5 is waiting for calls")
  1874. DisplayBanner5:
  1875.     option("use menu colors",yes)
  1876.     option("bold",yes)
  1877.     date(MiscString3)
  1878.     position(2,3)
  1879.     prompt("/(MiscString3)")
  1880.     time(MiscString3,VoiceDataCable)
  1881.     left(MiscString3,5)
  1882.     position(2,74)
  1883.     prompt("/(MiscString3)")
  1884.     option("bold",no)
  1885.     position(4,3)
  1886.     prompt("Calls received: /(CallsReceived)")
  1887.     set integer(VoiceDataCable,1)
  1888.     position(4,27)
  1889.     prompt("Last call: /(LastCallTime)")
  1890.     set integer(VoiceDataCable,0)
  1891.     position(4,50)
  1892.     prompt("Last caller: /(LastCallerName)")
  1893.     option("use menu colors",no)
  1894.     position(6,1)
  1895.     wait seconds (2)
  1896.     position(6,1)
  1897.     wipe screen(20,80)
  1898.     return()
  1899.  
  1900. ErrNoModemResponse:
  1901.     set string(MiscString3,"Your modem isn't responding to commands. (See Appendix C for remedies).")
  1902. ErrDisplayErrMessage:
  1903.     gosub DisplayBanner
  1904.     goto _Error
  1905. ErrNoPhoneLine:
  1906.     set string(MiscString3,"Your modem isn't connected to the phone line.")
  1907.     goto ErrDisplayErrMessage
  1908. ErrUnsupportedRate:
  1909.     set string(MiscString3,"Your modem doesn't support /(BaudRate) baud.")
  1910.     goto ErrDisplayErrMessage
  1911. ErrSwitchNotAvailable:
  1912.     set string(MiscString3,"Can't switch voice calls to data with the /(MiscString3) deskset.")
  1913.     goto ErrDisplayErrMessage
  1914. ErrInvalidDataMode:
  1915.     set string(MiscString3,"The /(MiscString3) deskset does not support that data mode.")
  1916.     goto ErrDisplayErrMessage
  1917. ErrNoDataConnection:
  1918.     set string(MiscString3,"A data connection could not be established")
  1919.     goto ErrDisplayErrMessage
  1920. ErrNoModemDef:
  1921.     set string(MiscString1,"User-defined modem definition file not found. Run the MODEMDEF script.")
  1922.     goto ErrDisplayErrMessage
  1923. ErrBadModemDef:
  1924.     set string(MiscString1,"User-defined modem definition file is bad. Run the MODEMDEF script.")
  1925.     goto ErrDisplayErrMessage
  1926.  
  1927. _Escape:
  1928.     option("mouse", off)
  1929.     option("echo",no)
  1930.     option("blank",off)
  1931.     if equal(EscBranch ,295) goto VoiceToData1
  1932.     if equal(EscBranch ,490) password("",50)
  1933.     if equal(EscBranch ,490) goto PasswordValid
  1934.     if equal(EscBranch ,620) goto HardwareDisconnect
  1935.  
  1936. _Error:
  1937.     gosub SetFlowControl1
  1938.     option("blank",no)
  1939.     if equal(AnswerCall,0) goto ExitAnswerMode
  1940.     if flag(ISDN_Support)
  1941.         ifnot answer(FALSE) greater(2,1)
  1942.         goto ExitAnswerMode
  1943.     endif
  1944.     if equal(ModemNumber, 97)
  1945.         goto DirectConnectExit
  1946.     elseif equal(ModemNumber, 98)
  1947.         goto ExitAnswerMode
  1948.     elseif equal(ModemNumber, 99)
  1949.         goto AutodialExit
  1950.     else 
  1951.         goto DisableAutoAnswer
  1952.     endif
  1953.  
  1954.  
  1955. DirectConnectExit:
  1956.     option("use menu colors",no)
  1957.     wipe screen()
  1958.     option("use menu colors",yes)
  1959.     option("bold",yes)
  1960.     position(1,1)
  1961.     draw box(4,80)
  1962.     option("bold",no)
  1963.     position(2,3)
  1964.     prompt("Manually set your modem's ORIGINATE//ANSWER switch to ORIGINATE or OFF.")
  1965.     position(3,3)
  1966.     prompt("Press ENTER when your modem is ready.")
  1967.     wait key(MiscString3,100)
  1968.     goto ExitAnswerMode
  1969.  
  1970. AutodialExit:
  1971.     option("use menu colors",no)
  1972.     wipe screen()
  1973.     option("use menu colors",yes)
  1974.     option("bold",yes)
  1975.     position(1,1)
  1976.     draw box(4,80)
  1977.     option("bold",no)
  1978.     position(2,3)
  1979.     prompt("Manually command your modem to stop answering calls. When your modem")
  1980.     position(3,3)
  1981.     prompt("is ready, press ALT-M to return to the menus.")
  1982.     option("use menu colors",no)
  1983.     prompt("/n/n/n")
  1984.     goto ExitAnswerMode
  1985.  
  1986. DisableAutoAnswer:
  1987.     character delay(50)
  1988.     if equal(ModemNumber,49) set string(MiscString3,"ATAD")
  1989.     ifnot equal(ModemNumber,49) set string(MiscString3,"ATE1Q0S0=0")
  1990.     if equal(ModemNumber,61) set string(MiscString3,"set an man")
  1991.     if equal(ModemNumber,62) goto ExitAnswerMode
  1992.     if equal(ModemNumber,63) goto ExitAnswerMode
  1993.     if equal(ModemNumber,64) goto ExitAnswerMode
  1994.     if equal(ModemNumber,17) set string(MiscString3,"AAA/(MiscString3)")
  1995.     if equal(ModemNumber,45) prompt("/n")
  1996.     if equal(ModemNumber,45) set string(MiscString3,"/x0EC 0")
  1997.     set string(MiscString1,"OK")
  1998.     if equal(ModemNumber,61) set string(MiscString1,"CMD:")
  1999.     type("/(MiscString3)/r")
  2000.     ifnot wait line(1,3) goto ExitAnswerMode
  2001.     if wait text("/(MiscString1)",5) goto ExitAnswerMode
  2002.  
  2003. ExitAnswerMode:
  2004.     password("/(Password)",0)
  2005.     option("blank",no)
  2006.     option("use menu colors",off)
  2007.     wipe screen()
  2008.     position(1,1)
  2009.     character delay(0)
  2010.     option("bottom line",on)
  2011.     type("<ALT-M>A<ALT-L>SS")
  2012.     end()
  2013.