home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskermit / msmdatap.scr < prev    next >
Text File  |  2020-01-01  |  5KB  |  139 lines

  1. ; FILE DATAPORT.SCR (MSMDATAP.SCR)
  2. ; An MS-DOS Kermit script program for dialing the AT&T / Paradyne Dataport
  3. ; 14400 and Express modems, internal or external, to be used with MS-DOS
  4. ; Kermit 3.12 or later.  The modem is set for V.32bis, compression, error
  5. ; correction, all types of fallback, RTS/CTS flow control, fixed interface
  6. ; speed of 57600.
  7. ; Rename this file to DATAPORT.SCR if necessary.
  8. ;
  9. ; To use: SET MODEM DATAPORT (in MS-DOS Kermit 3.14 or later)
  10. ;  or:    DEFINE _MODEM DATAPORT (in MS-DOS Kermit 3.00 or later)
  11. ;  or:    SET MODEM=DATAPORT (at DOS prompt or in AUTOEXEC.BAT)
  12. ; and:    Make sure Kermit executes the standard MSKERMIT.INI file.
  13. ; and then ... DIAL number.
  14. ;
  15. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, September 1993.
  16. ; Revised Oct 94 for v3.14.
  17. ; Adapted to Dataport Express, Apr 95, by removing several commands that were
  18. ; available only in the original Dataport, but which were redundant.  Thanks
  19. ; to Mike Walsh (Cal State) and Armand Zakarian (U of Wisconsin) for info.
  20. ;
  21. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  22. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  23.  
  24. define chkerr if fail stop 1 \%1
  25. define chkok input 3 OK, if fail stop 1 \%1
  26.  
  27. set input echo on        ; So we can watch what happens.
  28. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  29. set input case ignore        ; Use caseless string comparisons
  30.  
  31. set parity none            ; Avoid parity foulups
  32. set flow none            ; Avoid flow control deadlocks
  33. hangup                ; Begin by dropping DTR
  34.  
  35. ; Speed.  Don't worry about modem, it autobauds up to 57600 bps.
  36. ; NOTE: This modem doesn't seem to have a command for locking the
  37. ; interface speed.  But it seems to do it anyway.
  38. ;
  39. set speed 57600
  40. wait 5 dsr            ; Time to recover from HANGUP...
  41.  
  42. echo Configuring AT&T DataPort modem on \v(line).
  43.  
  44. :INIT
  45. output ATQ0V1\13        ; Enable word result codes
  46. chkok {Can't get modem's attention}
  47. ; X6  = Verbose result codes, show modulation speed
  48. ; &C1 = CD follows RS232
  49. ; &D2 = DTR follows RS232
  50. ; &Q0 = Asynchronous data mode, use AT command set
  51. ; L0  = Low speaker volume
  52. output AAAT E1 X6 &C1 &D2 &Q0 L0\13
  53. chkok {Can't initialize modem}
  54. output AT \92Q3\13        ; RTS/CTS hardware flow control
  55. chkok {Can't enable RTS/CTS}    ; On modem
  56. wait 5 cts
  57. if fail errfail {Modem is not asserting CTS!}
  58. set flow rts/cts        ; And in Kermit too, but only now
  59. pause 2                ; This is needed for internal model
  60. output AT %B14400 S78=0\13      ; Modulation = V.32bis with fallback
  61. chkok {Can't enable modulation and fallback}
  62. output AT \92N7%C1\13        ; Compression and EC enabled
  63. chkok {Can't enable compression and EC}
  64. output AT \92K5\13        ; Make modem pass BREAK transparently
  65. chkok {Can't become transparent to BREAK}
  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 ANSWER        ; No answer
  111. if success errfail {No answer - try again later}
  112. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  113. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  114. goto getmsg            ; None of the above, get another message.
  115.  
  116. :BUSY
  117. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  118. Echo Line is busy, will dial again in 30 seconds.
  119. echo Press any key to cancel...
  120. output \13            ; CR cancels dialing
  121. hangup                          ; Hang up.
  122. :AGAIN
  123. if count goto redial            ; Then go redial.
  124. :QUIT
  125. errfail {It never answers!  I give up.} ; Too many tries.
  126.  
  127. :DONE                           ; Connected.
  128. echo \7                         ; Celebrate with a beep.
  129. define errfail            ; Erase local macro definitions...
  130. end 0                ; Finished, return success code.
  131.  
  132. :FAIL                ; Dialing failed, no beep.
  133. define errfail            ; Erase local macro definitions...
  134. end 1                ; Return failure code.
  135.  
  136. ; End of DATAPORT.SCR
  137.