home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / modem31.zip / CALL.HP < prev    next >
Text File  |  1993-08-30  |  70KB  |  1,962 lines

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