home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskscripts / supra.kds < prev    next >
Text File  |  2020-01-01  |  5KB  |  137 lines

  1. ; FILE SUPRA.SCR
  2. ; An MS-DOS Kermit script program for dialing Supra V.32/V.32bis/V.34 modems,
  3. ; to be used with MS-DOS Kermit 3.15 or later.  The modem is set for RTS/CTS
  4. ; flow control, fixed interface speed, and to negotiate highest modulation,
  5. ; error correction, compression, and all types of fallback.
  6. ;
  7. ; Authors: C. Gianone & F. da Cruz, Columbia U, December 1996
  8. ;
  9. ; To use: SET MODEM=SUPRA (in DOS, before starting Kermit or in AUTOEXEC.BAT)
  10. ; or:     SET MODEM SUPRA (in Kermit, or in MSCUSTOM.INI)
  11. ; and:    Make sure Kermit has executed the standard MSKERMIT.INI file,
  12. ;         and then DIAL the desired number.
  13. ;
  14. ; Variables - define these prior to dialing if desired; they can be either
  15. ; Kermit variables or DOS environment variables:
  16. ;   DIALPORT    - COM port to use for dialing (COM1, COM2, etc)
  17. ;   DIALSPEED   - Speed for dialing (57600 by default)
  18. ;   DIALMETHOD  - TONE or PULSE (modem's default method is used by default)
  19. ;   DIALRETRIES - Maximum times to redial the call (default 5)
  20. ;   DIALTIMEOUT - How long to wait for result from modem (default 90 seconds)
  21. ;
  22. if < VERSION 315 stop 1 MS-DOS Kermit 3.15 or later required.
  23. def ERRFAIL echo \%1, forward FAIL
  24. def CHKOK input 3 OK, if fail stop 1 \%1
  25.  
  26. local __dm __parity        ; Local variables
  27. set carrier off                 ; Don't require carrier during dialing.
  28. set input echo on        ; So we can watch what happens.
  29. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  30. set input case ignore        ; Use caseless string comparisons
  31.  
  32. :PORT
  33. if not def DIALPORT asg DIALPORT \$(DIALPORT)
  34. if not def DIALPORT forward SPEED
  35. set port \m(DIALPORT)
  36. if success forward SPEED
  37. echo SET PORT \m(DIALPORT) failed 
  38. end 1
  39.  
  40. :SPEED
  41. asg __parity \v(parity)        ; Save parity setting
  42. set parity none            ; Switch to none while dialing
  43. set flow none            ; Avoid flow control deadlocks
  44. hangup                ; Begin by dropping DTR
  45.  
  46. if not def DIALSPEED asg DIALSPEED \$(DIALSPEED)
  47. if not def DIALSPEED asg DIALSPEED 57600
  48. set speed \m(DIALSPEED)
  49. if fail end 1 \m(DIALSPEED) - Speed not supported
  50.  
  51. ; Dial method, retry limit, and timeout...
  52.  
  53. xif numeric \fsubstr(\%1,1,1) {
  54.     if eq "\m(DIALMETHOD)" "TONE" asg __dm T
  55.     if eq "\m(DIALMETHOD)" "PULSE" asg __dm P
  56. }
  57. if not def DIALRETRIES asg DIALRETRIES \$(DIALRETRIES)
  58. if not def DIALRETRIES asg DIALRETRIES 5
  59.  
  60. if not def DIALTIMEOUT asg DIALTIMEOUT \$(DIALTIMEOUT)
  61. if not def DIALTIMEOUT asg DIALTIMEOUT 90
  62.  
  63. ; Begin the modem dialog...
  64.  
  65. echo Configuring Supra modem on \v(line)...
  66. output ATQ0V1\13        ; Enable word result codes
  67. chkok {Can't get modem's attention}
  68. output ATE1X4&C1&D2&F2\13    ; Set echoing, result codes, etc.
  69. chkok {Can't initialize modem}
  70. output AT &K3\13        ; RTS/CTS hardware flow control
  71. chkok {Can't enable RTS/CTS}    ; On modem
  72. wait 5 cts
  73. if fail errfail {Configuration failed - no CTS from modem}
  74. set flow rts/cts        ; And in Kermit too, but only now
  75. output AT N1\13            ; Enable modulation fallback
  76. chkok {Can't enable modulation fallback}
  77. output AT \\N3&Q5\13        ; Compression and EC enabled
  78. Chkok {Can't enable compression and EC}
  79. output AT &Y3\13        ; Make modem pass BREAK transparently
  80. chkok {Can't become transparent to BREAK}
  81. mpause 500
  82. clear input            ; Clear INPUT buffer.
  83. clear device            ; Clear device buffer.
  84.  
  85. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  86. echo
  87.  
  88. for \%i 1 \m(DIALRETRIES) 1 {    ; Redial loop
  89.     xif > \%i 1 {
  90.         echo Redialing...       ; Message for redialing
  91.         hangup            ; Hang up first
  92.     }
  93.     pause 1            ; Wait a sec for modem to settle
  94.     output ATD\m(__dm)\%1\13    ; Dial the number.
  95.     minput \m(DIALTIMEOUT) -
  96.       CONNECT BUSY ERROR {NO CARRIER} {NO ANSWER} {NO DIALTONE} -
  97.       RING DELAYED BLACKLISTED FAX
  98.     xif fail { echo Call timed out, hangup, out \13, continue }
  99.     switch \v(minput) {
  100.       :1, forward done
  101.       :2, Echo Line is busy - will dial again in 30 seconds.
  102.           echo Press any key to cancel...
  103.           output \13
  104.           pause 30
  105.           if fail errfail Canceled
  106.           break
  107.       :3, errfail {Dialing command error}
  108.       :4, errfail {Call failed - no carrier}
  109.       :5, errfail {No answer - try again later}
  110.       :6, errfail {No dialtone - is your modem connected to the phone line?}
  111.       :7, errfail {Call failed - your phone is ringing}
  112.       :8, errfail {Call failed - answered by voice}
  113.       :9, errfail {Call delayed - try again later}
  114.       :10, errfail {Call failed - blacklisted}
  115.       :11, errfail {Call failed - answered by fax}
  116.       :default, break
  117.     }    
  118. }
  119. errfail {It never answers!  I give up.} ; Too many tries.
  120.  
  121. :DONE                           ; Connected.
  122. echo \7                         ; Celebrate with a beep.
  123. set carrier on            ; Require carrier from now on.
  124. set parity \m(__parity)        ; Restore host parity setting
  125. undef errfail            ; Erase local macro definitions...
  126. end 0                ; Finished, return success code.
  127.  
  128. :FAIL
  129. undef errfail            ; Erase local macro definitions...
  130. set carrier off            ; Let them reconnect to see what's up.
  131. hangup
  132. end 1                ; Return failure code.
  133.  
  134. ; End of SUPRA.SCR
  135.