home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msk314.pkz / MODEMS / DATAPORT.SCR < prev    next >
Text File  |  1994-10-17  |  5KB  |  133 lines

  1. ; FILE DATAPORT.SCR (MSMDATAP.SCR)
  2. ; An MS-DOS Kermit script program for dialing the AT&T / Paradyne Dataport
  3. ; 14400 modem, internal or external, to be used with MS-DOS Kermit 3.12 or
  4. ; later.  The modem is set for V.32bis, compression, error correction, all
  5. ; types of fallback, RTS/CTS flow control, fixed interface speed of 57600.
  6. ; Rename this file to DATAPORT.SCR if necessary.
  7. ;
  8. ; To use: SET MODEM=DATAPORT (in DOS, before starting Kermit)
  9. ; or:     DEFINE _MODEM DATAPORT (in Kermit, before dialing)
  10. ; and:    Make sure Kermit executes the standard MSKERMIT.INI file.
  11. ;
  12. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, September 1993
  13. ; Revised Oct 94.
  14. ;
  15. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  16. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  17.  
  18. define chkerr if fail stop 1 \%1
  19. define chkok input 3 OK, if fail stop 1 \%1
  20.  
  21. set input echo on        ; So we can watch what happens.
  22. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  23. set input case ignore        ; Use caseless string comparisons
  24.  
  25. set parity none            ; Avoid parity foulups
  26. set flow none            ; Avoid flow control deadlocks
  27. hangup                ; Begin by dropping DTR
  28.  
  29. ; Speed.  Don't worry about modem, it autobauds up to 57600 bps.
  30. ; NOTE: This modem doesn't seem to have a command for locking the
  31. ; interface speed.  But it seems to do it anyway.
  32. ;
  33. set speed 57600
  34. wait 5 dsr            ; Time to recover from HANGUP...
  35.  
  36. echo Configuring AT&T DataPort on \v(line).
  37.  
  38. :INIT
  39. output ATQ0V1\13        ; Enable word result codes
  40. chkok {Can't get modem's attention}
  41. ; X6 = Verbose result codes, show modulation speed
  42. ; &C1 = CD follows RS232
  43. ; &D2 = DTR follows RS232
  44. ; &Q0 = Asynchronous data mode, use AT command set
  45. ; S84=0 = Normal ERROR response to bad commands
  46. output AAAT E1 X6 &C1 &D2 &Q0 S84=0\13
  47. chkok {Can't initialize modem}
  48. output AT \92Q3\13        ; RTS/CTS hardware flow control
  49. chkok {Can't enable RTS/CTS}    ; On modem
  50. wait 5 cts
  51. if fail errfail {Modem is not asserting CTS!}
  52. set flow rts/cts        ; And in Kermit too, but only now
  53. pause 2                ; This is needed for internal model
  54. output AT %B14400 S41=1 S78=0\13 ; Modulation = V.32bis with fallback
  55. chkok {Can't enable modulation fallback}
  56. output AT \92N7%C1\13        ; Compression and EC enabled
  57. chkok {Can't enable compression and EC}
  58. output AT \92K5\13        ; Make modem pass BREAK transparently
  59. chkok {Can't become transparent to BREAK}
  60.  
  61. if def \%1 if not equal "\%1" "=" goto BEGIN
  62. echo Modem initialization complete, no number to dial
  63. end 0
  64.  
  65. :BEGIN                ; Now DIAL.
  66. clear                ; Clear INPUT buffer.
  67. set count 5                     ; Dialing retry counter, 5 tries allowed.
  68. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  69. echo
  70. pause 1
  71. goto dial                       ; 1st time, skip pause and Redialing message
  72.  
  73. :REDIAL
  74. set alarm 30
  75. pause 30            ; Wait 30 seconds before redialing.
  76. if not alarm errfail {Dialing canceled.}
  77. echo Redialing...               ; Message for redialing.
  78. pause 1
  79.  
  80. :DIAL
  81. output ATD\%1\13                ; Dial the number.
  82. set alarm 90            ; (For detecting keyboard interruptions.)
  83. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  84. if < VERSION 313 clear
  85. input 30 \10                    ; Wait for the linefeeds...
  86.  
  87. :GETMSG
  88. input 60 \10            ; ...that surround the response message.
  89. if success goto gotmsg        ; Got a message.
  90. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  91. hangup                ; User interrupted from keyboard,
  92. output \13            ; cancel dialing by sending carriage return,
  93. goto again            ; and go try again right away.
  94.  
  95. :GOTMSG
  96. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  97. if success goto done            ; If so, we're done.
  98. reinput 1 BUSY            ; Line is busy.
  99. if success goto busy        ; Go wait a while and then dial again.
  100. reinput 1 ERROR            ; Command syntax error.
  101. if success errfail {Dialing command error}
  102. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  103. if success errfail {No answer or no carrier}
  104. reinput 1 NO ANSWER        ; No answer
  105. if success errfail {No answer - try again later}
  106. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  107. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  108. goto getmsg            ; None of the above, get another message.
  109.  
  110. :BUSY
  111. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  112. Echo Line is busy, will dial again in 30 seconds.
  113. echo Press any key to cancel...
  114. output \13            ; CR cancels dialing
  115. hangup                          ; Hang up.
  116. :AGAIN
  117. if count goto redial            ; Then go redial.
  118. :QUIT
  119. errfail {It never answers!  I give up.} ; Too many tries.
  120.  
  121. :DONE                           ; Connected.
  122. echo \7                         ; Celebrate with a beep.
  123. define errfail            ; Erase local macro definitions...
  124. end 0                ; Finished, return success code.
  125.  
  126. :FAIL                ; Dialing failed, no beep.
  127. define errfail            ; Erase local macro definitions...
  128. end 1                ; Return failure code.
  129.  
  130. ; End of DATAPORT.SCR
  131.