home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / ha5mdm.zip / CALL.HP < prev    next >
Text File  |  1994-02-01  |  70KB  |  1,970 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&Q5\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&Q5S11=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.     if equal(ModemNumber,154) set string(MiscString1,"AT&FE1V1Q0X4&C1&D2&Q5&K3W1S95=53")
  495.     if equal(ModemNumber,154) set flag(HHS,True)
  496.     if equal(ModemNumber,155) set string(MiscString1,"AT&F&N0&R0S11=55S95=3")
  497.     if equal(ModemNumber,155) set flag(HHS,True)
  498.     if equal(ModemNumber,156) set string(MiscString1,"ATE1V1Q0X4&C1&D2&K3S0=0")
  499.     if equal(ModemNumber,156) set flag(HHS,True)
  500.     if equal(ModemNumber,157) set string(MiscString1,"AT&F&C1&D2S11=55")
  501.     if equal(ModemNumber,157) set flag(HHS,True)
  502.  
  503. AddExtraCmds:
  504.     if length("/(ExtraMdmCmds)",MiscInt2)
  505.         ifnot string match(InitString2, "AT") set string(InitString2, "AT")
  506.         set string(InitString2,"/(InitString2)/(ExtraMdmCmds)")
  507.     endif
  508.     goto InitializeModem
  509.  
  510. NEC_ISDterm:
  511.     set string(MiscString1,"NEC")
  512.     if flag(VoiceCall) goto ErrVoiceThruDeskset
  513.     character delay(50)
  514.     set integer(MiscInt2,6)
  515. NEC_ISDterm1:
  516.     if equal(MiscInt2,6) set integer(MaxCallAttempts,9600)
  517.     if equal(MiscInt2,5) set integer(MaxCallAttempts,19200)
  518.     if equal(MiscInt2,4) set integer(MaxCallAttempts,4800)
  519.     if equal(MiscInt2,3) set integer(MaxCallAttempts,2400)
  520.     if equal(MiscInt2,2) set integer(MaxCallAttempts,1200)
  521.     if equal(MiscInt2,1) set integer(MaxCallAttempts,300)
  522.     ifnot flag(DirectCable) setting("baud",MaxCallAttempts)
  523.     type("AT/r")
  524.     if wait text("OK",1)
  525.         set integer(BaudRate,MaxCallAttempts)
  526.         option("xprotocol",on)
  527.         goto CheckCD
  528.     elseif decrement(MiscInt2) 
  529.         goto NEC_ISDterm1
  530.     else 
  531.         goto ErrNoModemResponse
  532.     endif
  533.  
  534. NEC_Modem:
  535.     set string(MiscString1,"AT&FE1V1Q0X4&C1&D2L1/(ExtraMdmCmds)")
  536.     set flag(HHS,true)
  537.     type("/(MiscString1)/r")
  538.     ifnot wait text("OK") goto ErrNoModemResponse
  539.     type("AT</r")
  540.     ifnot wait text("*") goto ErrNoModemResponse
  541.     type("C1 T1/r")
  542.     ifnot wait text("OK") end()
  543.     type("Q/r")
  544.     ifnot wait text("OK") goto ErrNoModemResponse
  545.     goto ContinueModemInit
  546.  
  547. Fujitsu:
  548.     set string(MiscString1,"Fujitsu")
  549.     if flag(VoiceCall) goto ErrVoiceThruDeskset
  550.     set string(ModemName, "/(PhoneNumber)")
  551.     ifnot truncate(ModemName,"//")  set string(ModemName, "ADPS")
  552.     if string match(ModemName, "ADPS") goto Fujitsu1
  553.     ifnot string match(ModemName, "ABCS") goto ErrInvalidDataMode
  554.     if greater(MaxCallAttempts,9600) goto ErrUnsupportedRate
  555. Fujitsu1:
  556.     character delay(50)
  557.     type ("AT/r")
  558.     wait seconds(1)
  559.     if screen match("1>",1) goto Fujitsu2
  560.     type("ATMENU/r")
  561.     ifnot wait line(1,2) goto ErrNoModemResponse
  562.     ifnot wait text("1>",1) goto ErrNoModemResponse
  563. Fujitsu2:
  564.     type("/(ModemName):/r")
  565.     ifnot wait line(1,2) goto ErrNoModemResponse
  566.     ifnot wait text("1>",1) goto ErrNoModemResponse
  567.     type("END/r")
  568.     if wait text("OK",2) goto Fujitsu3
  569. Fujitsu3:
  570.     ifnot wait line(1,1) prompt("/n")
  571.     type("AT%P0/r")
  572.     if equal(MaxCallAttempts,9600) goto Fujitsu4
  573.     setting("baud", 9600)
  574.     ifnot wait text("OK",2) goto ErrNoModemResponse
  575.     setting("baud",MaxCallAttempts)
  576.     type("AT/r")
  577. Fujitsu4:
  578.     ifnot wait text("OK",2) goto ErrNoModemResponse
  579.     type("ATS54=1/r")
  580.     ifnot wait text("OK",2) goto ErrNoModemResponse
  581.     type("ATS56=5/r")
  582.     ifnot wait text("OK",2) goto ErrNoModemResponse
  583.     option("xprotocol",on)
  584.     goto CheckCD
  585.  
  586. Telrad:
  587.     ifnot flag(VoiceCall) goto Telrad1
  588.     set string(MiscString1,"Telrad")
  589.     goto ErrVoiceThruDeskset
  590. Telrad1:
  591.     set string(ModemName, "/(PhoneNumber)")
  592.     ifnot cut(ModemName,"//") goto Telrad2
  593.     truncate(PhoneNumber,"//")
  594.     if string match(ModemName,"B") set integer(IrqLevel,70)
  595.     if string match(ModemName,"b") set integer(IrqLevel,70)
  596.     if equal(IrqLevel,70) goto UncommandedModems
  597. Telrad2:
  598.     character delay(50)
  599.     set integer(MiscInt2,7)
  600. Telrad3:
  601.     if equal(MiscInt2,7) set integer(MaxCallAttempts,9600)
  602.     if equal(MiscInt2,6) set integer(MaxCallAttempts,4800)
  603.     if equal(MiscInt2,5) set integer(MaxCallAttempts,2400)
  604.     if equal(MiscInt2,4) set integer(MaxCallAttempts,1200)
  605.     if equal(MiscInt2,3) set integer(MaxCallAttempts,300)
  606.     if equal(MiscInt2,2) set integer(MaxCallAttempts,1800)
  607.     if equal(MiscInt2,1) set integer(MaxCallAttempts,600)
  608.     setting("baud",MaxCallAttempts)
  609.     type("/r")
  610.     if wait text("*",2) goto Telrad4
  611.     if decrement(MiscInt2) goto Telrad3
  612.     goto ErrNoModemResponse
  613. Telrad4:
  614.     setting("outgoing hhs",0)
  615.     setting("incoming hhs",0)
  616.     type("PROF 4/r")
  617.     wait seconds(1)
  618.     setting("baud",9600)
  619.     type("/r")
  620.     ifnot wait line(1,2) goto ErrNoModemResponse
  621.     ifnot wait text("*",1) goto ErrNoModemResponse
  622.     if equal(BaudRate,9600) goto Telrad5
  623.     set integer(MaxCallAttempts,2)
  624.     if equal(BaudRate,4800) set integer(MaxCallAttempts,13)
  625.     if equal(BaudRate,2400) set integer(MaxCallAttempts,12)
  626.     if equal(BaudRate,1800) set integer(MaxCallAttempts,7)
  627.     if equal(BaudRate,1200) set integer(MaxCallAttempts,3)
  628.     if equal(BaudRate,600) set integer(MaxCallAttempts,4)
  629.     type("set 11:/(MaxCallAttempts)/r")
  630.     wait seconds(1)
  631.     setting("baud",BaudRate)
  632.     type("/r")
  633.     ifnot wait line(1,2) goto ErrNoModemResponse
  634.     ifnot wait text("*",2) goto ErrNoModemResponse
  635. Telrad5:
  636.     type("set 2:0,101:32,103:16,104:80,126:1,130:0/r")
  637.     ifnot wait line(1,3) goto ErrNoModemResponse
  638.     ifnot wait text("*",3) goto ErrNoModemResponse
  639.     set flag(HHS, true)
  640.     goto CheckCD
  641.  
  642. ATT:
  643.     if flag(ATT_Initialized) goto CheckCD
  644.     if flag(VoiceCall)
  645.         set string(MiscString1,"AT&T")
  646.         goto ErrVoiceThruDeskset
  647.     else
  648.         character delay(50)
  649.         set integer(MiscInt2,6)
  650.     endif
  651. ATT2:
  652.     if equal(MiscInt2,6) set integer(MaxCallAttempts,9600)
  653.     if equal(MiscInt2,5) set integer(MaxCallAttempts,19200)
  654.     if equal(MiscInt2,4) set integer(MaxCallAttempts,4800)
  655.     if equal(MiscInt2,3) set integer(MaxCallAttempts,2400)
  656.     if equal(MiscInt2,2) set integer(MaxCallAttempts,1200)
  657.     if equal(MiscInt2,1) set integer(MaxCallAttempts,300)
  658.     setting("baud",MaxCallAttempts)
  659.     break()
  660.     wait seconds(1)
  661.     type("at/r")
  662.     if wait text("CMD:",1) goto ATT3
  663.     if decrement(MiscInt2) goto ATT2
  664.     goto ErrNoModemResponse
  665. ATT3:
  666.     type("set au on/r")
  667.     ifnot wait line(1,2) goto ErrNoModemResponse
  668.     ifnot wait text("CMD:",2) goto ErrNoModemResponse
  669.     setting("baud",9600)
  670.     break()
  671.     wait seconds(1)
  672.     type("at/r")
  673.     ifnot wait line(1,2) goto ErrNoModemResponse
  674.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  675.     type("copy p0 to active/r")
  676.     ifnot wait line(1,2) goto ErrNoModemResponse
  677.     ifnot wait text("CMD:",2) goto ErrNoModemResponse
  678.     setting("baud",BaudRate)
  679.     break()
  680.     wait seconds(1)
  681.     type("at/r")
  682.     ifnot wait line(1,2) goto ErrUnsupportedRate
  683.     ifnot wait text("CMD:",2) goto ErrUnsupportedRate
  684.     type("set dcd fo/r")
  685.     ifnot wait line(1,2) goto ErrNoModemResponse
  686.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  687.     type("set dtr fo/r")
  688.     ifnot wait line(1,2) goto ErrNoModemResponse
  689.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  690.     if string match(ModemName, "D Channel")
  691.         type("set mode DX25/r")
  692.     else
  693.         type("set mode B2/r")
  694.     endif
  695.     ifnot wait line(1,2) goto ErrNoModemResponse
  696.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  697.     type("set rec eia/r")
  698.     ifnot wait line(1,2) goto ErrNoModemResponse
  699.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  700.     type("set tran eia/r")
  701.     ifnot wait line(1,2) goto ErrNoModemResponse
  702.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  703.     type("set an man/r")
  704.     ifnot wait line(1,2) goto ErrNoModemResponse
  705.     ifnot wait text("CMD:",1) goto ErrNoModemResponse
  706.     set flag(HHS, true)
  707.     goto CheckCD
  708.  
  709. Fastcomm:
  710.     character delay(250)
  711.     if greater(BaudRate,8000) setting("baud",2400) 
  712.     hangup()
  713.     gosub Fastcomm2
  714.     ifnot flag(MiscFlag1) goto ErrNoModemResponse
  715.     if less(BaudRate,8000) goto Fastcomm1
  716.     setting("baud",BaudRate) 
  717.     hangup()
  718.     gosub Fastcomm2
  719.     ifnot flag(MiscFlag1) goto ErrNoModemResponse
  720. Fastcomm1:
  721.     set flag(MiscFlag1,false)
  722.     character delay(50)
  723.     if greater(BaudRate,3000) set flag(HHS,true)
  724.     type("AT#FQ0S0=0#LCN#LDN#LX3#LRF/(ExtraMdmCmds)#W/r")
  725.     ifnot wait text("OK",3) goto ErrNoModemResponse
  726.     ifnot wait line(1,2) goto ErrNoModemResponse
  727.     hangup()
  728.     goto ContinueModemInit
  729. Fastcomm2:
  730.     set flag(MiscFlag1,false)
  731.     gosub Fastcomm4
  732.     if wait text("OK",3) goto Fastcomm3
  733.     gosub Fastcomm4
  734.     if wait text("OK",3) goto Fastcomm3
  735.     return()
  736. Fastcomm3:
  737.     ifnot wait line(1,1) prompt("/n")
  738.     set flag(MiscFlag1,true)
  739.     return()
  740. Fastcomm4:
  741.     set integer(MiscInt2,5)
  742. Fastcomm5:
  743.     type("A")
  744.     if wait text("A",1) goto Fastcomm6
  745.     if decrement(MiscInt2) goto Fastcomm5
  746. Fastcomm6:
  747.     type("T/r")
  748.     return()
  749.  
  750. Telebit:
  751.     set string(ModemInitString,"/(MiscString1)")
  752.     if flag(OS2)
  753.         set integer(MiscInt2, 6)
  754.         goto Telebit1
  755.     endif
  756.     if equal(ModemNumber, 37)
  757.         set integer(MiscInt2, 8)
  758.     else
  759.         set integer(MiscInt2,7)
  760.     endif
  761. Telebit1:
  762.     if equal(MiscInt2,8) set integer(MaxCallAttempts,57600)
  763.     if equal(MiscInt2,7) set integer(MaxCallAttempts,38400)
  764.     if equal(MiscInt2,6) set integer(MaxCallAttempts,19200)
  765.     if equal(MiscInt2,5) set integer(MaxCallAttempts,9600)
  766.     if equal(MiscInt2,4) set integer(MaxCallAttempts,4800)
  767.     if equal(MiscInt2,3) set integer(MaxCallAttempts,2400)
  768.     if equal(MiscInt2,2) set integer(MaxCallAttempts,1200)
  769.     if equal(MiscInt2,1) set integer(MaxCallAttempts,300)
  770.     ifnot equal(ModemNumber,42) goto Telebit2
  771.     divide(MaxCallAttempts,10)
  772.     multiply(MaxCallAttempts,9)
  773. Telebit2:
  774.     setting("baud",MaxCallAttempts)
  775.     type("AT&F/r")
  776.     if wait text("OK",1) goto Telebit3
  777.     if decrement(MiscInt2) goto Telebit1
  778.     goto ErrNoModemResponse
  779. Telebit3:
  780.     setting("baud",9600)
  781.     set integer(MiscInt2,5)
  782.     if equal(BaudRate,300)   set integer(MiscInt2,0)
  783.     if equal(BaudRate,1200)  set integer(MiscInt2,1)
  784.     if equal(BaudRate,2400)  set integer(MiscInt2,2)
  785.     if equal(BaudRate,4800)  set integer(MiscInt2,3)
  786.     if equal(BaudRate,9600)  set integer(MiscInt2,4)
  787.     if equal(BaudRate,19200) set integer(MiscInt2,5)
  788.     if equal(BaudRate,38400) set integer(MiscInt2,6)
  789.     if equal(BaudRate,57600) set integer(MiscInt2,7)
  790.     if equal(ModemNumber, 88)
  791.         set string(ModemInitString,"/(ModemInitString)X2S51=/(MiscInt2)")
  792.     elseif equal(ModemNumber, 65)
  793.         set string(ModemInitString,"ATE1V1Q0X2S11=50S51=/(MiscInt2)")
  794.     elseif equal(ModemNumber, 37)
  795.         set string(ModemInitString,"ATE1V1Q0X2S11=50S51=/(MiscInt2)")
  796.     elseif equal(ModemNumber, 51) 
  797.         set string(ModemInitString,"/(ModemInitString)X3S51=/(MiscInt2)")
  798.     else
  799.         set string(ModemInitString,"/(ModemInitString)X3S51=/(MiscInt2)I")
  800.     endif
  801.     wait seconds(1)
  802.     character delay(50)
  803.     type("/(ModemInitString)/r")
  804.     ifnot wait text("OK",3) goto ErrNoModemResponse
  805.     if equal(ModemNumber,51) goto Telebit4
  806.     ifnot screen match("96",2) goto Telebit4
  807.     ifnot get integer(MiscInt2,"/(MiscString1)") goto Telebit4
  808.     ifnot equal(MiscInt2,961) set integer(ModemNumber,41)
  809. Telebit4:
  810.     if wait line(1,1) goto Telebit5
  811.     prompt("/n")
  812. Telebit5:
  813.     setting("baud",BaudRate)
  814.     if equal(ModemNumber,42) gosub SetFastlinkSub
  815.     character delay(50)
  816.     set flag(HHS,true)
  817.     if equal(ModemNumber, 88)
  818.         set string(MiscString1,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  819.     elseif equal(ModemNumber, 65)
  820.         set string(MiscString1,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  821.     elseif equal(ModemNumber, 37)
  822.         set string(MiscString1,"AT&C1&D2S58=2S59=15/(ExtraMdmCmds)")
  823.     elseif equal(ModemNumber, 51) 
  824.         set string(MiscString1,"ATS52=1S53=1S58=2S66=1S95=2/(ExtraMdmCmds)")
  825.     else
  826.         set string(MiscString1,"ATS52=1S53=1S58=2S66=1/(ExtraMdmCmds)")
  827.     endif
  828.     wait seconds(1)
  829.     goto InitializeModem
  830.  
  831. WorldBlazer:
  832.     option("Blank", yes)
  833.     option("Display Ascii", yes)
  834.     option("Tenths", yes)
  835.     type("AT/r",0)
  836.     if wait text("OK",1)
  837.         ifnot wait line(1,1) greater(2,1)
  838.         option("Blank", no)
  839.         option("Display Ascii", no)
  840.         option("Tenths", no)
  841.         goto TelebitInit
  842.     else
  843.         length(ModemName, MiscInt1)
  844.         add(MiscInt1, 20)
  845.         option("Blank", no)
  846.         option("use menu colors", yes)
  847.         option("Blink", yes)
  848.         position(3,MiscInt1)
  849.         prompt("(Hunting for DTE rate...)")
  850.         option("Blank", yes)
  851.         option("use menu colors", no)
  852.         option("Blink", no)
  853.         position(6,1)
  854.     endif
  855.     set integer(BaudIndex, 13)
  856.     set flag(SlowOS2, false)
  857.     if flag(OS2)
  858.         if less(OSVersion, 200)
  859.             set flag(SlowOS2, True)
  860.         endif
  861.     endif
  862.     goto HuntLoop
  863.  
  864. HuntLoop:
  865.     if equal(BaudIndex,13)
  866.         if and(OS2, SlowOS2) goto NextBaudIndex
  867.         set integer(TempBaud,38400)
  868.     elseif equal(BaudIndex,12) 
  869.         set integer(TempBaud,19200)
  870.     elseif equal(BaudIndex,11) 
  871.         set integer(TempBaud,9600)
  872.     elseif equal(BaudIndex,10) 
  873.         set integer(TempBaud,2400)
  874.     elseif equal(BaudIndex,9) 
  875.         if and(OS2, SlowOS2) goto NextBaudIndex
  876.         set integer(TempBaud,57600)
  877.     elseif equal(BaudIndex,8)
  878.         if and(OS2, SlowOS2) goto NextBaudIndex
  879.         set integer(TempBaud,115200)
  880.     elseif equal(BaudIndex,7) 
  881.         if and(OS2, SlowOS2) goto NextBaudIndex
  882.         set integer(TempBaud,76800)
  883.     elseif equal(BaudIndex,6)
  884.         if and(OS2, SlowOS2) goto NextBaudIndex
  885.         set integer(TempBaud,14400)
  886.     elseif equal(BaudIndex,5)
  887.         if and(OS2, SlowOS2) goto NextBaudIndex
  888.         set integer(TempBaud,12000)
  889.     elseif equal(BaudIndex,4) 
  890.         if and(OS2, SlowOS2) goto NextBaudIndex
  891.         set integer(TempBaud,7200)
  892.     elseif equal(BaudIndex,3)
  893.         if and(OS2, SlowOS2) goto NextBaudIndex
  894.         set integer(TempBaud,4800)
  895.     elseif equal(BaudIndex,2) 
  896.         set integer(TempBaud,1200)
  897.     elseif equal(BaudIndex,1) 
  898.         set integer(TempBaud,300)
  899.     endif
  900.     setting("Baud",TempBaud)
  901.     type("AT/r",0)
  902.     if wait text("OK",1)
  903.         ifnot wait line(1,1) greater(2,1)
  904.         option("Tenths", no)
  905.         option("Blank", no)
  906.         option("use menu colors", yes)
  907.         position(3,MiscInt1)
  908.         prompt("                         ")
  909.         option("use menu colors", no)
  910.         position(6,1)
  911.         option("Blank", no)
  912.         option("Display Ascii", no)
  913.         position(5,1)
  914.         goto TelebitInit
  915.     endif
  916. NextBaudIndex:
  917.     if decrement(BaudIndex) goto HuntLoop
  918.     option("Blank", no)
  919.     option("Display Ascii", no)
  920.     option("Tenths", no)
  921.     goto ErrNoModemResponse
  922.  
  923. TelebitInit:
  924.     if equal(BaudRate,115200) 
  925.         set integer(BaudIndex,9)
  926.     elseif equal(BaudRate,76800) 
  927.         set integer(BaudIndex,8)
  928.     elseif equal(BaudRate,57600) 
  929.         set integer(BaudIndex,7)
  930.     elseif equal(BaudRate,38400)
  931.         set integer(BaudIndex,6)
  932.     elseif equal(BaudRate,19200)
  933.         set integer(BaudIndex,5)
  934.     elseif equal(BaudRate,14400)
  935.         set integer(BaudIndex,46)
  936.     elseif equal(BaudRate,12000) 
  937.         set integer(BaudIndex,43)
  938.     elseif equal(BaudRate,9600) 
  939.         set integer(BaudIndex,4)
  940.     elseif equal(BaudRate,7200)
  941.         set integer(BaudIndex,35)
  942.     elseif equal(BaudRate,4800) 
  943.         set integer(BaudIndex,3)
  944.     elseif equal(BaudRate,2400)
  945.         set integer(BaudIndex,2)
  946.     elseif equal(BaudRate,1200) 
  947.         set integer(BaudIndex,1)
  948.     elseif equal(BaudRate,300) 
  949.         set integer(BaudIndex,0)
  950.     endif
  951.     position(6,1)
  952.     type("AT&F&C1&D2X2S11=55S51=/(BaudIndex)S58=2S59=15S69=2S92=1/(ExtraMdmCmds)/r",0)
  953.     ifnot wait text("OK",3) goto ErrNoModemResponse
  954.     ifnot wait line(1,1) greater(2,1)
  955.     setting("baud",BaudRate)
  956.     set flag(HHS,true)
  957.     goto    ContinueModemInit
  958.  
  959. Rixon:
  960.     wait seconds(1)
  961.     type("/r/r")
  962.     ifnot wait text("$",10) goto ErrNoModemResponse
  963.     wait seconds(1)
  964.     type("NU")
  965.     ifnot wait text("OK",3) goto ErrNoModemResponse
  966.     goto ContinueModemInit
  967.  
  968. USR2400E:
  969.     set integer(MiscInt2,7)
  970. USR2400E1:
  971.     type("AT/r")
  972.     if wait text("OK",1) goto USR2400E2
  973.     if equal(MiscInt2,7) setting("baud",2400)
  974.     if equal(MiscInt2,6) setting("baud",19200)
  975.     if equal(MiscInt2,5) setting("baud",9600)
  976.     if equal(MiscInt2,4) setting("baud",4800)
  977.     if equal(MiscInt2,3) setting("baud",1200)
  978.     if equal(MiscInt2,2) setting("baud",300)
  979.     if equal(MiscInt2,1) setting("baud",600)
  980.     if decrement(MiscInt2) goto USR2400E1
  981.     goto ErrNoModemResponse
  982. USR2400E2:
  983.     ifnot wait lines(1,3) prompt("/n")
  984.     if less(BaudRate,300) type("AT &F/r")
  985.     if equal(BaudRate,19200) type("AT&F&B7/r")
  986.     if equal(BaudRate,9600) type("AT&F&B6/r")
  987.     if equal(BaudRate,4800) type("AT&F&B5/r")
  988.     if equal(BaudRate,2400) type("AT&F&B4/r")
  989.     if equal(BaudRate,1200) type("AT&F&B3/r")
  990.     if equal(BaudRate,600) type("AT&F&B2/r")
  991.     if equal(BaudRate,300) type("AT&F&B1/r")
  992.     ifnot wait text("OK",3) goto ErrNoModemResponse
  993.     ifnot wait lines(1,3) prompt("/n")
  994.     setting("baud",BaudRate)
  995.     set flag(HHS,true)
  996.     type("ATE1S0=0X4&H1&R2&D2&C1/(ExtraMdmCmds)/r")
  997.     if wait text("OK",3) goto ContinueModemInit
  998.     goto ErrNoModemResponse
  999.  
  1000. USR2400:
  1001.     set string(ModemName,"/(MiscString1)")
  1002.     type("AT S14?/r")
  1003.     ifnot wait text("OK",3) goto ErrNoModemResponse
  1004.     ifnot wait lines(1,2) goto USR24001
  1005. USR24001:
  1006.     if screen match("000",5) set string(ModemName,"/(ModemName) &C1&D2")
  1007.     set string(MiscString1,"/(ModemName)")
  1008.     if length("/(ExtraMdmCmds)",MiscInt2) set string(MiscString1,"/(MiscString1) /(ExtraMdmCmds)")
  1009.     goto InitializeModem
  1010.  
  1011. Convertible:
  1012.     option("receive line feeds",yes)
  1013.     set string(MiscString1,"/x0EL 0,F 4,C 0,S 2")
  1014.     if equal(BaudRate,300) set string(MiscString1,"/x0EL 0,F 4,C 0,S 1")
  1015.     if equal(BaudRate,110) set string(MiscString1,"/x0EL 0,F 4,C 0,S 0")
  1016.     if length("/(ExtraMdmCmds)",MiscInt2) set string(MiscString1,"/(MiscString1) /(ExtraMdmCmds)")
  1017.     setting("baud",1200)
  1018.     type("/(MiscString1)/r")
  1019.     if wait text("OK",3) goto ContinueModemInit
  1020.     setting("baud",300)
  1021.     type("/(MiscString1)/r")
  1022.     if wait text("OK",3) goto ContinueModemInit
  1023.     setting("baud",110)
  1024.     type("/(MiscString1)/r")
  1025.     if wait text("OK",3) goto ContinueModemInit
  1026.     goto ErrNoModemResponse
  1027.  
  1028. Avatex:
  1029.     set string(MiscString1,"in. ")
  1030.     if equal(BaudRate,300) goto Avatex1
  1031.     ifnot equal(BaudRate,1200) goto ErrUnsupportedRate
  1032.     set string(MiscString1,"out.")
  1033. Avatex1:
  1034.     position(3,3)
  1035.     prompt("The DATA//VOICE button should be in and the 300//1200 button should be /(MiscString1)")
  1036.     goto DisplayModemName
  1037.  
  1038. MultiTech:
  1039.     set flag(HHS,true)
  1040.     type("AT&FX4B0$BA0S11=55$SB/(BaudRate)/r")
  1041.     gosub CheckResponse
  1042.     type("AT&E1&E4&E7&E13/(ExtraMdmCmds)/r")
  1043.     gosub CheckResponse
  1044.     type("AT/r")
  1045.     gosub CheckResponse
  1046.     goto ContinueModemInit
  1047.  
  1048. Microcom:
  1049.     ;Modem number 44  = Microcom QX/4232hs
  1050.     ;Modem number 123 = Microcom QX/4232bis
  1051.     if equal(ModemNumber, 44)  set integer(LoopCount,6)
  1052.     if equal(ModemNumber, 123) set integer(LoopCount,8)
  1053.     if flag(OS2)
  1054.         ifnot equal(OSVersion, 200) set integer(LoopCount, 6)
  1055.     endif
  1056. Microcom1:
  1057.     if equal(LoopCount,8) set integer(TempBaud,115200)
  1058.     if equal(LoopCount,7) set integer(TempBaud,38400)
  1059.     if equal(LoopCount,6) set integer(TempBaud,9600)
  1060.     if equal(LoopCount,5) set integer(TempBaud,19200)
  1061.     if equal(LoopCount,4) set integer(TempBaud,4800)
  1062.     if equal(LoopCount,3) set integer(TempBaud,2400)
  1063.     if equal(LoopCount,2) set integer(TempBaud,1200)
  1064.     if equal(LoopCount,1) set integer(TempBaud,300)
  1065.     ifnot setting("baud", TempBaud)
  1066.         if decrement(LoopCount) 
  1067.             goto Microcom1
  1068.         else
  1069.             goto ErrNoModemResponse
  1070.         endif
  1071.     endif
  1072.     type("AT&F/r")
  1073.     if wait text("OK",1) 
  1074.         ifnot wait lines(1,1) prompt("/n")
  1075.         goto Microcom2
  1076.     endif
  1077.     if decrement(LoopCount) goto Microcom1
  1078.     goto ErrNoModemResponse
  1079. Microcom2:
  1080.     if less(TempBaud, 2401) goto Microcom3
  1081.     type("AT%U/r")
  1082.     gosub CheckResponse
  1083. Microcom3:
  1084.     setting("baud", BaudRate)
  1085.     if equal(ModemNumber, 123)
  1086.         set string(MiscString1,"AT&F&C1&D2\J0\N3\Q3\V2W2-M\X1S0=0S11=55")
  1087.     else
  1088.         set string(MiscString1,"ATS0=0X4&C1&D2\J0\N3\Q3")
  1089.     endif
  1090.     set flag(HHS,true)
  1091.     type("/(MiscString1)/r")
  1092.     gosub CheckResponse
  1093. Microcom4:
  1094.     if length("/(ExtraMdmCmds)", MiscInt1)
  1095.         ifnot string match(InitString2, "AT") set string(InitString2, "AT")
  1096.         set string(InitString2,"/(InitString2)/(ExtraMdmCmds)")
  1097.         type("/(InitString2)/r")
  1098.         gosub CheckResponse
  1099.     endif
  1100.     goto ContinueModemInit
  1101.  
  1102. Concord:
  1103.     type("AT Z/r")
  1104.     if wait text("OK",3) goto Concord1
  1105.     ifnot screen match(">",1) goto ErrNoModemResponse
  1106.     type("SMC/r")
  1107.     if wait text("OK",3) goto Concord1
  1108.     goto ErrNoModemResponse
  1109. Concord1:
  1110.     if wait line(1,1) goto Concord2
  1111. Concord2:
  1112.     type("AT@ SMD2 SMF0 SLCA2 SPF2 SLCB0 SLCF1 SLCD1 /(ExtraMdmCmds) SAVE/r")
  1113.     ifnot wait text("OK",3) goto ErrNoModemResponse
  1114.     if wait line(1,1) goto Concord3
  1115. Concord3:
  1116.     set flag(HHS,true)
  1117.     set string(MiscString1,"AT X1 S0=0")
  1118.     goto InitializeModem
  1119.  
  1120. UserDefined:
  1121.     ifnot read from("modemdef.dat") goto ErrNoModemDef
  1122.     ifnot read string(UserDefCall,"") goto ErrBadModemDef
  1123.     ifnot read string(UserDefAnswer, "") goto ErrBadModemDef
  1124.     ifnot read string(UserDefDial, "") goto ErrBadModemDef
  1125.     ifnot read string(UserDefHangup, "") goto ErrBadModemDef
  1126.     ifnot read string(UserDefCD, "") goto ErrBadModemDef
  1127.     ifnot read string(UserDefToggleDTR, "") goto ErrBadModemDef
  1128.     ifnot read string(UserDefHHS, "") goto ErrBadModemDef
  1129.     read from("")
  1130.     set flag(UserDefinedModem, true)
  1131.     set string(MiscString1, UserDefCall)
  1132.     if length("/(ExtraMdmCmds)",MiscInt2) set string(MiscString1,"/(MiscString1)/(ExtraMdmCmds)")
  1133.     if string match(UserDefHHS,"YES")
  1134.         set flag(HHS, true)
  1135.     else
  1136.         set flag(HHS, false)
  1137.     endif
  1138.     gosub SetFlowControl
  1139.     goto InitializeModem
  1140.  
  1141. InitializeModem:
  1142.     gosub CheckAbort
  1143.     type("/(MiscString1)/r")
  1144.     ifnot wait text("OK",5) goto ErrNoModemResponse
  1145.     ifnot wait lines(1,1) goto ErrNoModemResponse
  1146.     if equal(ModemNumber,47) goto Rixon
  1147.     if length(InitString2, MiscInt1)
  1148.         type("/(InitString2)/r")
  1149.         ifnot wait text("OK",5) goto ErrNoModemResponse
  1150.         ifnot wait lines(1,1) goto ErrNoModemResponse
  1151.     endif
  1152.  
  1153. ContinueModemInit:
  1154.     ifnot flag(DirectCable) setting("baud",BaudRate)
  1155.     if equal(ModemNumber,42) gosub SetFastlinkSub
  1156.     wait seconds(1)
  1157.     ifnot equal(ModemNumber,47) goto CheckCD
  1158.     type("ATZ/r")
  1159.     wait seconds(1)
  1160.  
  1161. CheckCD:
  1162.     if wait carrier(0,0) set flag(CD_High,true)
  1163.  
  1164. SetCallAttempts:
  1165.     if flag(UK_Version)
  1166.         set integer(MaxCallAttempts,4)
  1167.     else
  1168.         set integer(MaxCallAttempts,20)
  1169.     endif
  1170.     set integer(CallAttempt,0)
  1171.  
  1172. MainDialingLoop:
  1173.     character delay(50)
  1174.     wait seconds(1)
  1175.     add(CallAttempt,1)
  1176.     ifnot flag(UK_Version) goto ClearOldDialCommands
  1177.     if equal(CallAttempt,2) goto ErrNoDataConnection
  1178.  
  1179. ClearOldDialCommands:
  1180.     if flag(VoiceCall) gosub VoiceInstructions
  1181.     ifnot flag(VoiceCall) gosub DisplayBanners4
  1182.     position(3,5)
  1183.     if flag(VoiceCall) position(10,3)
  1184.     option("use menu colors",yes)
  1185.  
  1186. WaitForDialtone:
  1187.     ifnot string match(PhoneNumber,"$") goto SetDialCommand
  1188.     truncate(PhoneNumber,"$")
  1189.     prompt("Calling attempt #/(CallAttempt) (press ENTER when you hear dialtone):/n/n/n")
  1190.     option("use menu colors",no)
  1191.     type("ATH1/r")
  1192.     wait seconds(1)
  1193.     key string(DialType,"")
  1194.     position(3,5)
  1195.     if flag(VoiceCall) position(10,3)
  1196.  
  1197. SetDialCommand:
  1198.     if flag(LeasedLine) 
  1199.         option("use menu colors", no)
  1200.         wipe screen()
  1201.         goto DirectCableCall
  1202.     endif
  1203.     option("use menu colors",yes)
  1204.     ifnot flag(UK_Version) prompt("Calling attempt #/(CallAttempt) (press SPACEBAR to redial immediately)/n/n/n")
  1205.     if flag(UK_Version) prompt("Calling attempt #/(CallAttempt)/n/n/n")
  1206.     option("use menu colors",no)
  1207.     if flag(UserDefinedModem)
  1208.         set string(MiscString1, UserDefDial)
  1209.         goto SendDialCommand
  1210.     endif
  1211.     if flag(ISDN_Support) goto SendDialCommand
  1212.     set string(MiscString1,"ATDT")
  1213.     if string match(DialType,"P") set string(MiscString1,"ATDP")
  1214.     if equal(ModemNumber,61) set string(MiscString1,"di ")
  1215.     if equal(ModemNumber,62) set string(MiscString1,"")
  1216.     if equal(ModemNumber,63) set string(MiscString1,"ATD")
  1217.     if equal(ModemNumber,64) set string(MiscString1,"ATD")
  1218.     if equal(ModemNumber,79) set string(MiscString1,"ATD")
  1219.     ifnot equal(ModemNumber,49) goto SetDialCommand1
  1220.     if truncate(PhoneNumber,";") goto SetDialCommand1
  1221. SetDialCommand1:
  1222.     ifnot equal(ModemNumber,45) goto SendDialCommand
  1223.     set string(MiscString1,"/x0ED ")
  1224.     ifnot string match(PhoneNumber,";") goto SetDialCommand2
  1225.     set string(MiscString1,"/x0EV ,D ")
  1226. SetDialCommand2:
  1227.     if string match(DialType,"P") set string(MiscString1,"/(MiscString1)I")
  1228.  
  1229. SendDialCommand:
  1230.     gosub CheckAbort
  1231.     if flag(ISDN_Support)
  1232.         set flag(HHS, true)
  1233.         if call("/(PhoneNumber)") then goto SetDateFlag else goto SetDateFlag
  1234.     endif
  1235.     type("/(MiscString1)/(PhoneNumber)/r")
  1236.     if flag(VoiceCall) set integer(EscBranch,790)
  1237.     if flag(DateTime) goto NonDialableModem
  1238.  
  1239. SetDateFlag:
  1240.     set flag(DateTime,true)
  1241.     gosub TimeDateSub
  1242.  
  1243. NonDialableModem:
  1244.     if flag(NonDialable) goto LogCall
  1245.  
  1246. WaitConnection:
  1247.     if flag(ISDN_Support)
  1248.         set integer(LoopCount, 35)
  1249.     else
  1250.         set integer(LoopCount, 70)
  1251.     endif
  1252. ConnectionLoop:
  1253.     if wait line(1,2) goto MatchResultMessage
  1254. MatchResultMessage:
  1255.     gosub CheckAbort
  1256.     if get key(MiscString1) goto KeyPressed
  1257.     if screen match("NO CON",2) goto NoConnection
  1258.     if screen match("NO ANS",2) goto NoConnection
  1259.     if screen match("NECT",2) goto LogCall
  1260.     if screen match("NO CARRIER",2) goto NoConnection
  1261.     if screen match("BUSY",2) goto NoConnection
  1262.     if screen match("NO DIAL",2) goto ErrNoPhoneLine
  1263.     if screen match("BLACKL",2) goto ErrBlackList
  1264.     if screen match("OK",2)
  1265.         get position(Row,Col)
  1266.         subtract(Row, 2)
  1267.         position(Row,1)
  1268.         wipe screen(2,80)
  1269.         goto ConnectionLoop
  1270.     endif
  1271.     if flag(CD_High) goto ContinueLoop
  1272.     ifnot wait carrier(0,0) goto ContinueLoop
  1273.     if wait carrier(2,2) goto LogCall
  1274. ContinueLoop:
  1275.     if decrement(LoopCount) goto ConnectionLoop
  1276.     goto KeyPressedHangup
  1277.  
  1278. KeyPressed:
  1279.     if string match(MiscString1," ") goto KeyPressedHangup
  1280.     ifnot flag(VoiceCall) goto KeyPressedBeep
  1281.     if string match(MiscString1,"<ENTER>") goto LogCall
  1282. KeyPressedBeep:
  1283.     prompt("/x07")
  1284.     goto ContinueLoop
  1285. KeyPressedHangup:
  1286.     ifnot flag(ISDN_Support)
  1287.         type(" ",30)
  1288.         ifnot wait line(1,2) greater(2,1)
  1289.         type("ATH0/r",0)
  1290.         ifnot wait line(1,2) hangup()
  1291.     else
  1292.         hangup()
  1293.     endif
  1294.  
  1295. NoConnection:
  1296.     if flag(ISDN_Support) wait seconds(10)
  1297.     if equal(CallType, 0) goto Redial
  1298.     put environment("HA_CALL_STATUS","NO CONNECTION")
  1299.     type("<ALT-L>SS")
  1300.     end()
  1301.  
  1302. Redial:
  1303.     ifnot flag(VoiceCall) goto RedialCheck
  1304.     if flag(ISDN_Support) goto RedialCheck
  1305.     type("ATH0/r")
  1306.     if wait text("OK",3) goto RedialCheck
  1307. RedialCheck:
  1308.     if decrement(MaxCallAttempts)
  1309.         if equal(ModemNumber,82) wait seconds(1)
  1310.         goto MainDialingLoop
  1311.     endif
  1312.  
  1313.     set string(MiscString1,"Dialed /(PhoneNumber) 20 times w//o connecting.")
  1314.     gosub DisplayBanners
  1315.     goto _Error
  1316.  
  1317. LogCall:
  1318.     if screen match("NECT",1) goto LogCall3
  1319.     set integer(MaxCallAttempts, 10)
  1320. LogCall1:
  1321.     if flag(VoiceCall) goto LogCall3
  1322.     if screen match("NECT",2) goto LogCall3
  1323.     if wait line(1,1) goto LogCall2
  1324. LogCall2:
  1325.     if decrement(MaxCallAttempts) goto LogCall1
  1326. LogCall3:
  1327.     set string(ConnectMessage, "/S(9)")
  1328.     call connected("/(SystemName)")
  1329.     put environment("HA_CALL_STATUS","CONNECTED")
  1330.     ifnot flag(Logging) goto AdjustBaudRate
  1331.     ifnot write to("/(LogFileName)") goto AdjustBaudRate
  1332.     gosub LoggingName
  1333.     if flag(VoiceCall) set string(NamePlusPhone,"/(NamePlusPhone), (Voice)")
  1334.     ifnot write("/r/nCalled /(NamePlusPhone), /(ModemName) /(ConnectTime)") goto AdjustBaudRate
  1335.     ;if flag(DirectCable) return()
  1336.     if flag(VoiceCall) goto VoiceCalls
  1337. LogCall4:
  1338.     set integer(EscBranch,540)
  1339.     set string(ModemName,"Duration = //DURATION (min:sec)/r/n/r/n")
  1340.     if flag(VoiceCall) set string(ModemName,"Duration of data portion of call = //DURATION (min:sec)/r/n")
  1341.     set flag(VoiceCall, FALSE)
  1342.     log duration(ModemName,"/(LogFileName)")
  1343.  
  1344. AdjustBaudRate:
  1345.     if flag(VoiceCall) goto VoiceCalls
  1346.     if equal(ModemNumber,17) goto AdjustBaudRate1
  1347.     if equal(ModemNumber,23) goto AdjustBaudRate1
  1348.     if flag(HHS) goto ConfigureTerminal 
  1349. AdjustBaudRate1:
  1350.     ifnot screen match("NECT",3) goto ConfigureTerminal
  1351.     ifnot get integer(MiscInt2,"/S(9)") goto ConfigureTerminal
  1352.     ifnot equal(ModemNumber,17) goto AdjustBaudRate2
  1353.     if greater(MiscInt2,3000) goto ConfigureTerminal
  1354. AdjustBaudRate2:
  1355.     if equal(MiscInt2,300) goto AdjustBaudRate3
  1356.     if equal(MiscInt2,600) goto AdjustBaudRate3
  1357.     if equal(MiscInt2,1200) goto AdjustBaudRate3
  1358.     if equal(MiscInt2,2400) goto AdjustBaudRate3
  1359.     if equal(MiscInt2,4800) goto AdjustBaudRate3
  1360.     if equal(MiscInt2,9600) goto AdjustBaudRate3
  1361.     if equal(MiscInt2,19200) goto AdjustBaudRate3
  1362.     goto ConfigureTerminal
  1363. AdjustBaudRate3:
  1364.     ifnot equal(MiscInt2,BaudRate) set integer(BaudRate,MiscInt2)
  1365.  
  1366. ConfigureTerminal:
  1367.     if flag(ViewDataEmulation) wipe screen()
  1368.     load system("/(SystemName)",true)
  1369.     ifnot flag(DirectCable) setting("baud",BaudRate)
  1370.     option("BOTTOM LINE", yes)
  1371.     gosub SetFlowControl
  1372.     ifnot equal(ModemNumber,45) goto CheckLogon
  1373.     type("/x0ET 0/r")
  1374.     wait seconds(2)
  1375.     option("receive line feeds",no)
  1376.  
  1377. CheckLogon:
  1378.     ifnot flag(ViewDataEmulation)
  1379.         option("use menu colors",yes)
  1380.         get position(MiscInt2,CallAttempt)
  1381.         if equal(ModemNumber,97) add(MiscInt2,2)
  1382.         if equal(ModemNumber,98) add(MiscInt2,2)
  1383.         if equal(ModemNumber,99) add(MiscInt2,2)
  1384.         add(MiscInt2,1)
  1385.         if string match(ModemName,"Direct-cabled (no modem)") decrement(MiscInt2)
  1386.         position(MiscInt2,1)
  1387.         option("bold",yes)
  1388.         draw box(3,80)
  1389.         option("bold",no)
  1390.         add(MiscInt2,1)
  1391.         position(MiscInt2,3)
  1392.         set string(MiscString1,"You are now connected with")
  1393.         if length("/(SystemName)",MiscInt2) prompt("/(MiscString1) /(SystemName)./n")
  1394.         if equal(MiscInt2,0) prompt("/(MiscString1) /(PhoneNumber)./n")
  1395.         option("use menu colors",no)
  1396.         ifnot length("/(LogonScript)",MiscInt2) goto NoLogonConnection
  1397.     else
  1398.         wipe screen()
  1399.         position(1,1)
  1400.  
  1401.         option("use menu colors",yes)
  1402.         option("bold",yes)
  1403.         draw box(5,40)
  1404.         option("bold",no)
  1405.  
  1406.         position(2,4)
  1407.         prompt("You are now connected with:")
  1408.         position(3,4)
  1409.         prompt(SystemName)
  1410.         position(4,4)
  1411.         left(ConnectMessage,30)
  1412.         prompt(ConnectMessage)
  1413.         option("use menu colors",no)
  1414.         position(5,1)
  1415.         ifnot length(LogonScript, MiscInt1) goto NoLogonConnection
  1416.     endif
  1417.  
  1418. RunLogon:
  1419.     option("use menu colors",yes)
  1420.     ifnot flag(ViewDataEmulation)
  1421.         get position(MiscInt2,CallAttempt)
  1422.         add(MiscInt2,1)
  1423.         position(MiscInt2,1)
  1424.         option("bold",yes)
  1425.         draw box(3,80)
  1426.         option("bold",no)
  1427.         add(MiscInt2,1)
  1428.         position(MiscInt2,3)
  1429.         if string match(LogonScript, "LEARNING") goto LearnLogon
  1430.         prompt("HyperACCESS//5 will now run the logon script named: /(LogonScript)/n/n/n")
  1431.     else
  1432.         position(6,1)
  1433.         option("bold",yes)
  1434.         if string match(LogonScript, "LEARNING")
  1435.             draw box(4,40)
  1436.         else
  1437.             draw box(5,40)
  1438.         endif
  1439.         option("bold",no)
  1440.         position(7,4)
  1441.         if string match(LogonScript, "LEARNING") goto LearnLogon
  1442.         prompt("HyperACCESS//5 will now run the")
  1443.         position(8,4)
  1444.         prompt("logon script named:")
  1445.         position(9,4)
  1446.         left(LogonScript,20)
  1447.         prompt("/(LogonScript)/n/n/n")
  1448.     endif
  1449.     option("use menu colors",no)
  1450.     set integer(EscBranch,570)
  1451.     run("/(LogonScript)")
  1452.     get environment(MiscString1,"HA_SCRIPT_STATUS")
  1453.     put environment("HA_CALL_STATUS","/(MiscString1)")
  1454.     end()
  1455.  
  1456. LearnLogon:
  1457.     put environment("HA_CALL_STATUS","OK")
  1458.     ifnot flag(ViewDataEmulation)
  1459.         prompt("HyperACCESS//5 will now learn a logon script./n/n/n")
  1460.     else
  1461.         prompt("HyperACCESS//5 will now learn")
  1462.         position(8,4)
  1463.         prompt("a logon script./n/n/n")
  1464.     endif
  1465.         
  1466.     option("use menu colors",no)
  1467.     set integer(EscBranch,570)
  1468.     type("<ALT-L><ALT-L>CALL")
  1469.     end()
  1470.  
  1471. NoLogonConnection:
  1472.     put environment("HA_CALL_STATUS","OK")
  1473.     prompt("/n/n")
  1474.     set integer(EscBranch,570)
  1475. NoLogonConnection1:
  1476.     type("<ALT-L>SS")
  1477.     end()
  1478.  
  1479. UncommandedModems:
  1480.     set flag(NonDialable,true)
  1481.     if equal(ModemNumber,99) goto AutodialModems
  1482.     position(2,3)
  1483.     option("use menu colors",yes)
  1484.     option("bold",no)
  1485.     prompt("Manually place the call to /(PhoneNumber).")
  1486.     set string(MiscString1,"data ")
  1487.     if string match(PhoneNumber,";")   set string(MiscString1,"voice")
  1488.     position(3,3)
  1489.     prompt("Press ENTER when the /(MiscString1) connection is established. ")
  1490.     option("use menu colors",no)
  1491.     wait key(MiscString1,300)
  1492.     goto SetDateFlag
  1493.  
  1494. AutodialModems:
  1495.     set string(MiscString1,"data")
  1496.     if string match(PhoneNumber,";")   set string(MiscString1,"voice")
  1497.     position(1,1)
  1498.     draw box(4,80)
  1499.     position(2,3)
  1500.     option("bold",no)
  1501.     prompt("Manually command your modem to place a /(MiscString1) call to: /(SystemName)")
  1502.     position(3,3)
  1503.     prompt("Telephone number: /(PhoneNumber)/n")
  1504.     option("use menu colors",no)
  1505.     ifnot string match(LogonScript, "LEARNING") goto AutodialModems1
  1506.     option("use menu colors",yes)
  1507.     position(5,1)
  1508.     option("bold",yes)
  1509.     draw box(4,80)
  1510.     option("bold",no)
  1511.     position(6,3)
  1512.     prompt("HyperACCESS//5 will learn the commands you send to your modem and include")
  1513.     position(7,3)
  1514.     prompt("them as part of the logon during subsequent calls./n/n")
  1515.     goto RunLogon
  1516. AutodialModems1:
  1517.     if flag(VoiceCall) goto AutodialModems2
  1518.     if length("/(LogonScript)", CallAttempt) goto RunLogon
  1519. AutodialModems2:
  1520.     get position(MiscInt2,CallAttempt)
  1521.     add(MiscInt2, 2)
  1522.     position(MiscInt2,1)
  1523.     option("use menu colors", yes)
  1524.     option("bold",yes)
  1525.     draw box(5,80)
  1526.     option("bold",no)
  1527.     add(MiscInt2,1)
  1528.     position(MiscInt2,3)
  1529.     prompt("When the /(MiscString1) connection is established, press ALT-R. If the connection")
  1530.     add(MiscInt2,1)
  1531.     position(MiscInt2,3)
  1532.     prompt("can't be established, press ALT-R, then ALT-M to return to the menus.")
  1533.     add(MiscInt2,1)
  1534.     position(MiscInt2,3)
  1535.     prompt("You may have to command your modem to go on hook before pressing ALT-R./n/n/n")
  1536.     option("use menu colors", no)
  1537.     type("<ALT-L>VKA")
  1538.     if wait carrier(1,5) goto SetDateFlag
  1539.     ifnot flag(VoiceCall) goto UncommandedVoiceData2
  1540.  
  1541. UncommandedVoiceData:
  1542.     wipe screen()
  1543.     option("use menu colors", yes)
  1544.     position(1,1)
  1545.     option("bold",yes)
  1546.     draw box(3,80)
  1547.     option("bold",no)
  1548.     position(2,3)
  1549.     prompt("You should now be in voice communications with the remote system.")
  1550.     position(4,1)
  1551.     option("bold",yes)
  1552.     set integer(MaxCallAttempts,9)
  1553.     if equal(ModemNumber,99) set integer(MaxCallAttempts,5)
  1554.     draw box(MaxCallAttempts,80)
  1555.     option("bold",no)
  1556.     position(5,3)
  1557.     prompt("When you're done with the voice call or if you want to use HyperACCESS//5's")
  1558.     position(6,3)
  1559.     if equal(ModemNumber,99) goto UncommandedVoiceData1
  1560.     position(6,3)
  1561.     prompt("menus, press ESC.")
  1562.     position(8,3)
  1563.     prompt("If you want to switch this voice call over to a data call, do NOT press")
  1564.     position(9,3)
  1565.     prompt("ESC. Wait for the carrier tone and then follow your modem's manual on")
  1566.     position(10,3)
  1567.     prompt("originating a data call. When the data connection is established,")
  1568.     position(11,3)
  1569.     prompt("press ENTER.")
  1570.     option("bold",yes)
  1571.     position(12,32)
  1572.     prompt(" ESC to cancel ")
  1573.     option("bold",no)
  1574.     option("use menu colors",no)
  1575.     wait key(MiscString1,300)
  1576.     goto LogCall4
  1577. UncommandedVoiceData1:
  1578.     prompt("menus, press ALT-R, and then ALT-M. You may have to command your modem to go")
  1579.     position(7,3)
  1580.     prompt("on hook before pressing ALT-R./n/n")
  1581.     position(9,1)
  1582.     option("bold",yes)
  1583.     draw box(6,80)
  1584.     option("bold",no)
  1585.     position(10,3)
  1586.     prompt("If you want to switch this voice call over to a data call, do NOT press")
  1587.     position(11,3)
  1588.     prompt("ALT-R. Wait for the carrier tone and then command your modem to respond")
  1589.     position(12,3)
  1590.     prompt("to the answering modem's carrier tone. After the data connection is")
  1591.     position(13,3)
  1592.     prompt("established, press ALT-R./n/n/n")
  1593.     option("use menu colors",no)
  1594.     type("<ALT-L>VKA")
  1595.     if wait carrier(1,1) wipe screen()
  1596.     if wait carrier(1,1) position(0,0)
  1597.     if wait carrier(1,1) goto LogCall4
  1598.     wait seconds(1)
  1599.     ifnot get key(LogFileName) goto UncommandedVoiceData2
  1600.     if string match(LogFileName,"<ALT-M>") type("<ALT-M><ALT-L>SS")
  1601. UncommandedVoiceData2:
  1602.     set string(MiscString1,"No data connection was established.")
  1603.     gosub DisplayBanners
  1604.  
  1605. DirectCableCall:
  1606.     set flag(DirectCable,TRUE)
  1607.     option("BOTTOM LINE", yes)
  1608.     if flag(Logging)
  1609.         gosub LogCall3
  1610.     else
  1611.         call connected(SystemName)
  1612.     endif
  1613.     position(1,1)
  1614.     if flag(VoiceCall) goto ErrVoiceThruDirect
  1615.     if length("/(LogonScript)",MiscInt2) goto CheckLogon
  1616.     option("use menu colors",yes)
  1617.     option("bold",yes)
  1618.     draw box(3,80)
  1619.     option("bold",no)
  1620.     position(2,3)
  1621.     prompt("You are now connected with /(SystemName)./n/n/n")
  1622.     option("use menu colors",no)
  1623.     option("bottom line",on)
  1624.     end()
  1625.  
  1626. VoiceCalls:
  1627.     ifnot wait line(1,1) goto VoiceCalls1
  1628. VoiceCalls1:
  1629.     if flag(NonDialable) goto UncommandedVoiceData
  1630.     set integer(EscBranch,790)
  1631.     goto VoiceCalls3
  1632. VoiceCalls2:
  1633.     ifnot equal(ModemNumber,44) goto VoiceCalls3
  1634.     ifnot wait text("OK",8) goto ErrNoModemResponse
  1635.     ifnot wait line(1,1) goto VoiceCalls3
  1636. VoiceCalls3:
  1637.     if equal(ModemNumber,41) goto VoiceCalls4
  1638.     if equal(ModemNumber,42) goto VoiceCalls4
  1639.     type("ATH0/r")
  1640.     ifnot wait text("OK",8) goto VoiceCalls7
  1641.     ifnot wait line(1,1) goto VoiceCalls7
  1642.     goto VoiceCalls7
  1643. VoiceCalls4:
  1644.     if wait text("OK",1) goto VoiceCalls5
  1645. VoiceCalls5:
  1646.     prompt("/n")
  1647.     type("AT G/r")
  1648.     ifnot wait text("OK",5) goto VoiceCalls6
  1649. VoiceCalls6:
  1650.     if wait line(1,1) goto VoiceCalls7
  1651. VoiceCalls7:
  1652.     option("use menu colors",yes)
  1653.     option("bold",yes)
  1654.     get postion(MiscInt2,EscBranch)
  1655.     add(MiscInt2,1)
  1656.     position(MiscInt2,1)
  1657.     draw box(5,80)
  1658.     option("bold",no)
  1659.     add(MiscInt2,1)
  1660.     position(MiscInt2,3)
  1661.     prompt("If you want to switch this voice call over to a data call, wait for the")
  1662.     add(MiscInt2,1)
  1663.     position(MiscInt2,5)
  1664.     prompt("carrier tone and then press ENTER.  Otherwise, press ESC to return to")
  1665.     add(MiscInt2,1)
  1666.     position(MiscInt2,5)
  1667.     prompt("the Main menu./n/n")
  1668.     option("use menu colors",no)
  1669. VoiceCalls8:
  1670.     set string(MiscString1,"")
  1671.     set flag(MiscFlag1,FALSE)
  1672.     key string(MiscString1,"/(MiscString1)")
  1673.  
  1674. VoiceToData:
  1675.     set flag(MiscFlag1,TRUE)
  1676.     gosub TimeDateSub
  1677.     ifnot write("Voice portion of call ended, /(ModemName) /(ConnectTime)") goto VoiceToData1
  1678. VoiceToData1:
  1679.     option("use menu colors",no)
  1680.     prompt("/n")
  1681. VoiceToData2:
  1682.     ifnot equal(ModemNumber,44) goto VoiceToData4
  1683. VoiceToData3:
  1684.     wipe screen()
  1685.     position(1,1)
  1686.     option("use menu colors",yes)
  1687.     option("bold",yes)
  1688.     draw box(3,80)
  1689.     option("bold",no)
  1690.     get position(MiscInt2,CallAttempt)
  1691.     add(MiscInt2,1)
  1692.     position(MiscInt2,3)
  1693.     key string(MiscString1,"Push in the T//D button on the modem now and then press ENTER.")
  1694.     option("use menu colors",no)
  1695.     goto InitializeVoiceModem1
  1696. VoiceToData4:
  1697.     option("use menu colors",no)
  1698.     if equal(ModemNumber, 73)
  1699.         set string(MiscString1, "ATH1O1")
  1700.     else
  1701.         set string(MiscString1,"ATD")
  1702.     endif
  1703.  
  1704.     if equal(ModemNumber,38) set string(MiscString1,"AT \N1 H1 O")
  1705.     if equal(ModemNumber,45) set string(MiscString1,"/x0EO")
  1706.     ifnot equal(ModemNumber,49) goto InitializeVoiceModem
  1707.     set string(MiscString1,"ATO")
  1708.     ifnot wait text(">",20) goto InitializeVoiceModem
  1709.     set string(MiscString1,"ATO")
  1710.  
  1711.  
  1712. InitializeVoiceModem:
  1713.     type("/(MiscString1)/r")
  1714.     ifnot equal(ModemNumber,38) goto InitializeVoiceModem1
  1715.     wait seconds(2)
  1716.     ifnot screen match("CONNECT",2) goto ErrNoDataConnection
  1717.     ifnot get integer(BaudRate,"/(MiscString1)") goto ErrNoDataConnection
  1718.     ifnot flag(DirectCable) setting("baud",BaudRate)
  1719. InitializeVoiceModem1:
  1720.     wait seconds(2)
  1721.     wipe screen()
  1722.     option("use menu colors",yes)
  1723.     option("bold",yes)
  1724.     position(1,1)
  1725.     draw box(3,80)
  1726.     option("bold",no)
  1727.     position(2,3)
  1728.     prompt("Put the telephone handset into the cradle now./n/n/n")
  1729.     if equal(ModemNumber,38) goto LogCall4
  1730.     option("use menu colors",no)
  1731.     if wait carrier(1,40) goto LogCall4
  1732.     goto ErrNoDataConnection
  1733.  
  1734. DisconnectVoice:
  1735.     if flag(MiscFlag1) goto DisconnectVoice1
  1736.     gosub TimeDateSub
  1737.     ifnot write("Voice call ended, /(ModemName) /(ConnectTime)") goto DisconnectVoice1
  1738. DisconnectVoice1:
  1739.     option("use menu colors",no)
  1740.     prompt("/n")
  1741.     wait seconds(1)
  1742.     if equal(ModemNumber,45) goto _Error
  1743.     if equal(ModemNumber,49) goto _Error
  1744.     type("ATH0/r")
  1745.     if wait text("OK",3) goto _Error
  1746.     goto _Error
  1747.  
  1748. SetFlowControl:
  1749.     if flag(DirectCable) goto (SetFlowControl1)
  1750.     ifnot equal(BaudRate,0) setting("baud",BaudRate)
  1751. SetFlowControl1:
  1752.     if equal(ModemNumber,42) gosub SetFastlinkSub
  1753.     ifnot flag(HHS) return()
  1754.     setting("outgoing hhs",4)
  1755.     setting("incoming hhs",5)
  1756.     return()
  1757.  
  1758. SetFastlinkSub:
  1759.     set integer(ModemNumber,BaudRate)
  1760.     divide(ModemNumber,10)
  1761.     multiply(ModemNumber,9)
  1762.     setting("baud",ModemNumber)
  1763.     set integer(ModemNumber,42)
  1764.     return()
  1765.  
  1766. TimeDateSub:
  1767.     date(ModemName)
  1768.     length("/(ModemName)",MiscInt2)
  1769.     if less(MiscInt2,9) set string(ModemName," /(ModemName)")
  1770.     time oday(ConnectTime,MiscInt2)
  1771.     length("/(ConnectTime)",MiscInt2)
  1772.     if less(MiscInt2,6) set string(ConnectTime," /(ConnectTime)")
  1773.     return()
  1774.  
  1775. SetDowtySub:
  1776.     set integer(MiscInt2,0)
  1777.     if equal(BaudRate,19200) set integer(MiscInt2,17)
  1778.     if equal(BaudRate,9600)  set integer(MiscInt2,13)
  1779.     if equal(BaudRate,4800)  set integer(MiscInt2,11)
  1780.     if equal(BaudRate,2400)  set integer(MiscInt2,10)
  1781.     if equal(BaudRate,1200)  set integer(MiscInt2,9)
  1782.     if equal(BaudRate,300)   set integer(MiscInt2,7)
  1783.     if equal(BaudRate,110)   set integer(MiscInt2,3)
  1784.     if equal(BaudRate,50)    set integer(MiscInt2,1)
  1785.     return()
  1786.  
  1787. CheckResponse:
  1788.     ifnot wait text("OK", 3) goto ErrNoModemResponse
  1789.     ifnot wait lines(1, 1) goto ErrNoModemResponse
  1790.     return()
  1791.  
  1792. CheckAbort:
  1793.     mouse position(Row, Col)
  1794.     if equal(Row, 0) return()
  1795.     if string match(S(9), "ESC") goto _Escape
  1796.     return()
  1797.  
  1798. LoggingName:
  1799.     set integer(MiscInt1,41)
  1800.     set string(MiscString1,"...............................................")
  1801.     ifnot length(SystemName, MiscInt2) set integer(MiscInt2,0)
  1802.     ifnot length(PhoneNumber, MiscInt3) set integer(MiscInt2,0)
  1803.     add(MiscInt2,MiscInt3)
  1804.     subtract(MiscInt1,MiscInt2)
  1805.     left(MiscString1,MiscInt1)
  1806.     set string(NamePlusPhone,"/(SystemName)/(MiscString1)/(PhoneNumber)")
  1807.     if flag(DirectCable) left(NamePlusPhone,41)
  1808.     return()
  1809.  
  1810. DisplayBanners:
  1811.     set integer(MiscInt1, 80)
  1812.     ifnot length("/(MiscString1)",MaxCallAttempts) goto DisplayBanners1
  1813. DisplayBanners1:
  1814.     option("use menu colors",no)
  1815.     gosub DisplayBanners2
  1816.     goto _Escape
  1817. DisplayBanners2:
  1818.     option("use menu colors",yes)
  1819.     option("bold",yes)
  1820.     position(10,1)
  1821.     draw box(3,80)
  1822.     position(12,32)
  1823.     prompt(" ESC to continue ")
  1824.     option("bold",no)
  1825.     position(11,3)
  1826.     subtract(MiscInt1,MaxCallAttempts)
  1827.     divide(MiscInt1,2)
  1828. DisplayBanners3:
  1829.     set string(MiscString1," /(MiscString1)")
  1830.     if decrement(MiscInt1) goto DisplayBanners3
  1831.     prompt("/(MiscString1)")
  1832.     option("use menu colors",no)
  1833.     position(14,1)
  1834.     whilenot get key(MiscString1)
  1835.         gosub CheckAbort
  1836.         wait seconds(1)
  1837.     endwhile
  1838.     position(14,1)
  1839.     return()
  1840. DisplayBanners4:
  1841.     gosub CheckAbort
  1842.     wipe screen()
  1843.     position(1,1)
  1844.     option("use menu colors",yes)
  1845.     if equal(ModemNumber,49) set integer(MiscInt2,5)
  1846.     ifnot equal(ModemNumber,49) set integer(MiscInt2,4)
  1847.     if equal(ModemNumber,97) set integer(MiscInt2,4)
  1848.     if equal(ModemNumber,98) set integer(MiscInt2,4)
  1849.     if equal(ModemNumber,99) set integer(MiscInt2,4)
  1850.     option("bold",yes)
  1851.     draw box(MiscInt2,80)
  1852.     position(MiscInt2,32)
  1853.     prompt(" ESC to cancel ")
  1854.     if equal(ModemNumber,97) return()
  1855.     if equal(ModemNumber,98) return()
  1856.     if equal(ModemNumber,99) return()
  1857.     position(2,3)
  1858.     option("bold",no)
  1859.     prompt("The call will now be placed to ")
  1860.     if length("/(SystemName)",MiscInt2) prompt("/(SystemName).")
  1861.     if equal(MiscInt2,0) prompt("/(PhoneNumber).")
  1862.     return()
  1863.     ifnot flag(VoiceCall) return()
  1864.     prompt("/n/n")
  1865.     if flag(NonDialable) return()
  1866.     if less(CallAttempt,1) return()
  1867.  
  1868. VoiceInstructions:
  1869.     wipe screen()
  1870.     position(1,1)
  1871.     option("use menu colors",yes)
  1872.     option("bold",yes)
  1873.     draw box(11,80)
  1874.     position(11,32)
  1875.     prompt(" ESC to cancel ")
  1876.     option("bold",no)
  1877.     if equal(ModemNumber,97) return()
  1878.     if equal(ModemNumber,98) return()
  1879.     if equal(ModemNumber,99) return()
  1880.     position(2,3)
  1881.     prompt("The call will now be placed to ")
  1882.     if length("/(SystemName)",MiscInt2) prompt("/(SystemName).")
  1883.     if equal(MiscInt2,0) prompt("/(PhoneNumber).")
  1884.     position(3,5)
  1885.     prompt("1. If you don't have a modem or a phone with a speaker, pick up the")
  1886.     position(4,8)
  1887.     prompt("telephone handset now to hear how the call is progressing.")
  1888.     position(5,5)
  1889.     prompt("2. Press ESC if you want to cancel the call.")
  1890.     position(6,5)
  1891.     if flag(UK_Version) prompt("3. If busy or no answer, press ESC to cancel the call.")
  1892.     ifnot flag(UK_Version)prompt("3. If busy or no answer, the number will be redialed automatically.")
  1893.     position(7,5)
  1894.     prompt("4. When the call connects, pick up the telephone handset (if you haven't")
  1895.     position(8,8)
  1896.     if equal(ModemNumber,44) prompt("already), push in the T//D button on the modem and press ENTER.")
  1897.     ifnot equal(ModemNumber,44) prompt("already) and press ENTER.")
  1898.     option("use menu colors",no)
  1899.     return()
  1900.  
  1901. ErrNoModemResponse:
  1902.     set string(MiscString1,"Your modem isn't responding to commands. (See Appendix C for remedies.)")
  1903. ErrDisplayErrMessage:
  1904.     gosub DisplayBanners
  1905.     goto _Error
  1906. ErrNoPhoneLine:
  1907.     set string(MiscString1,"Your modem isn't connected to the phone line.")
  1908.     goto ErrDisplayErrMessage
  1909. ErrUnsupportedRate:
  1910.     set string(MiscString1,"Your modem doesn't support /(BaudRate) baud.")
  1911.     goto ErrDisplayErrMessage
  1912. ErrVoiceThruDeskset:
  1913.     set string(MiscString1,"Voice calls can't be placed through the /(MiscString1) deskset.")
  1914.     goto ErrDisplayErrMessage
  1915. ErrInvalidDataMode:
  1916.     set string(MiscString1,"The /(MiscString1) deskset does not support that data mode.")
  1917.     goto ErrDisplayErrMessage
  1918. ErrVoiceThruDirect:
  1919.     set string(MiscString1,"You cannot place a voice call through a direct-cable.")
  1920.     goto ErrDisplayErrMessage
  1921. ErrNoDataConnection:
  1922.     set string(MiscString1,"A data connection could not be established.")
  1923.     goto ErrDisplayErrMessage
  1924. ErrNoModemDef:
  1925.     set string(MiscString1,"User-defined modem definition file not found. Run the MODEMDEF script.")
  1926.     goto ErrDisplayErrMessage
  1927. ErrBadModemDef:
  1928.     set string(MiscString1,"User-defined modem definition file is bad. Run the MODEMDEF script.")
  1929.     goto ErrDisplayErrMessage
  1930. ErrBlackList:
  1931.     wipe screen()
  1932.     option("use menu colors",yes)
  1933.     option("bold",yes)
  1934.     position(7,1)
  1935.     draw box(4,79)
  1936.     position(10,30)
  1937.     prompt(" ESC to continue ")
  1938.     option("bold",no)
  1939.     position(8,3)
  1940.     prompt("Your modem has blacklisted this number.  You should wait for the period")
  1941.     position(9,3)
  1942.     prompt("shown in your modem's manual before retrying the number again.")
  1943.     position(10,31)
  1944.     option("use menu colors",no)
  1945. ErrBlackList1:
  1946.     ifnot wait key(S(0)) goto ErrBlackList1
  1947.     goto _Error
  1948.  
  1949. _Escape:
  1950.     option("mouse", off)
  1951.     if equal(EscBranch,790) goto DisconnectVoice
  1952.     if equal(EscBranch,540) goto CheckLogon
  1953.     if equal(EscBranch,570) goto NoLogonConnection1
  1954.     hangup()
  1955.     put environment("HA_CALL_STATUS","CANCELLED")
  1956.     type("/r")
  1957.     wait seconds(1)
  1958.     if flag(ViewDataEmulation) wipe screen()
  1959.     load system("/(SystemName)")
  1960.  
  1961. _Error:
  1962.     hangup()
  1963.     bottom line(0,"")
  1964.     option("ignore case",no)
  1965.     option("bottom line",on)
  1966.     option("use menu colors", no)
  1967.     wipe screen()
  1968.     type("<ALT-M><ALT-L>SS")
  1969.     end()
  1970.