home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmboca.scr < prev    next >
Text File  |  1994-06-18  |  6KB  |  135 lines

  1. ; FILE BOCA.SCR
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the BOCA 14.4 (V.32bis)
  4. ; Faxmodem, to be used with MS-DOS Kermit 3.13 or later.  The modem is set
  5. ; up for compression, error correction, all types of fallback,
  6. ; RTS/CTS flow control, fixed interface speed of 57600.
  7. ;
  8. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, March 1994.
  9. ;
  10. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  11. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  12. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 You must SET LINE first
  13.  
  14. define chkerr if fail stop 1 \%1
  15. define chkok input 3 OK, if fail stop 1 \%1
  16.  
  17. set input echo on               ; So we can watch what happens.
  18. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  19. set input case ignore           ; Use caseless string comparisons
  20.  
  21. set parity none                 ; Avoid parity foulups
  22. set flow none                   ; Avoid flow control deadlocks
  23. hangup                          ; Begin by dropping DTR
  24. pause 1                         ; for one second
  25.  
  26. ; Speed.  Modem autobauds up to 57600.
  27.  
  28. set speed 57600                 ; Use high interface speed.
  29.  
  30. echo Configuring BOCA 14.4 Faxmodem on \v(line) at \v(speed) bps...
  31.  
  32. ; Get rid of the next four commands if they cause trouble (they shouldn't)
  33.  
  34. wait 0 DSR                      ; Check modem signals that should be on
  35. chkerr {No DSR signal - check your modem and cable}
  36. wait 0 CTS
  37. chkerr {No CTS signal - check your modem and cable}
  38.  
  39. :INIT
  40. output ATQ0V1\13                ; Enable word result codes
  41. chkok {Can't get modem's attention}
  42.  
  43. output AT E1 W1 &D2 S95=47 X4\13 ; Echoing, result codes, etc.
  44. chkok {Can't initialize modem}
  45.  
  46. echo Enabling modulation negotiation...
  47. output AT F1 S37=11 N1\13       ; Start modulation speed negotiation at V32bis
  48. chkok {Can't enable modulation speed negotiation}
  49. echo Enabling hardware flow control...
  50. output AT &K3\13                ; RTS/CTS hardware flow control
  51. chkok {Can't enable RTS/CTS}    ; On modem
  52. set flow rts/cts                ; And in Kermit too, but only now
  53. echo Configuring modem to ignore BREAK...
  54. output AT S82=128\13            ; Make modem ignore BREAK
  55. chkok {Can't become transparent to BREAK}
  56. echo Enabling error correction and data compression...
  57. output AT &Q5 S36=7 S46=138\13  ; Enable error correction & compression
  58.                                 ; with automatic speed buffering
  59. chkok {Can't enable compression EC and fallback}
  60. echo Fixing interface speed...
  61. output AT \{92}N3 S48=7\13      ; Fix speed, start EC negotiation with LAPM
  62. chkok {Can't fix interface speed}
  63. echo Reduce forced hangup delay to 1 second...
  64. output AT S38=1\13
  65. chkok {Can't set forced hangup delay}
  66.  
  67. if def \%1 if not equal "\%1" "=" goto BEGIN
  68. echo Modem initialization complete, no number to dial
  69. end 0
  70.  
  71. :BEGIN                          ; Now DIAL.
  72. clear                           ; Clear INPUT buffer.
  73. set count 5                     ; Dialing retry counter, 5 tries allowed.
  74. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  75. echo
  76. pause 1
  77. goto dial                       ; 1st time, skip pause and Redialing message
  78.  
  79. :REDIAL
  80. set alarm 30
  81. pause 30                        ; Wait 30 seconds before redialing.
  82. if not alarm errfail {Dialing canceled.}
  83. echo Redialing...               ; Message for redialing.
  84. pause 1
  85.  
  86. :DIAL
  87. output ATD\%1\13                ; Dial the number.
  88. set alarm 90                    ; (For detecting keyboard interruptions.)
  89. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  90. if < VERSION 313 clear
  91. input 30 \10                    ; Wait for the linefeeds...
  92.  
  93. :GETMSG
  94. input 60 \10                    ; ...that surround the response message.
  95. if success goto gotmsg          ; Got a message.
  96. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  97. hangup                          ; User interrupted from keyboard,
  98. output \13                      ; cancel dialing by sending carriage return,
  99. goto again                      ; and go try again right away.
  100.  
  101. :GOTMSG
  102. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  103. if success goto done            ; If so, we're done.
  104. reinput 1 BUSY                  ; Line is busy.
  105. if success goto busy            ; Go wait a while and then dial again.
  106. reinput 1 ERROR                 ; Command syntax error.
  107. if success errfail {Dialing command error}
  108. reinput 1 NO CARRIER            ; Phone didn't answer or no carrier.
  109. if success errfail {No answer or no carrier}
  110. reinput 1 NO DIALTONE           ; No dialtone when phone taken off hook.
  111. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  112. goto getmsg                     ; None of the above, get another message.
  113.  
  114. :BUSY
  115. if < \v(count) 2 goto quit      ; Don't wait 30 seconds if tries are used up.
  116. Echo Line is busy, will dial again in 30 seconds
  117. echo Press any key to cancel...
  118. output \13                      ; CR cancels dialing
  119. hangup                          ; Hang up.
  120. :AGAIN
  121. if count goto redial            ; Then go redial.
  122. :QUIT
  123. errfail {It never answers!  I give up.} ; Too many tries.
  124.  
  125. :DONE                           ; Connected.
  126. echo \7                         ; Celebrate with a beep.
  127. define errfail                  ; Erase local macro definitions...
  128. end 0                           ; Finished, return success code.
  129.  
  130. :FAIL                           ; Dialing failed, no beep.
  131. define errfail                  ; Erase local macro definitions...
  132. end 1                           ; Return failure code.
  133.  
  134. ; End of BOCA.SCR
  135.