home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmmt1432.scr < prev    next >
Text File  |  1994-05-11  |  5KB  |  136 lines

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