home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / NextLibrary / PrivateFrameworks / Uucp.framework / Versions / A / Resources / contrib / Dial.Hayes < prev    next >
Text File  |  1992-09-06  |  2KB  |  109 lines

  1. #!xchat
  2. # @(#) dial.hayes V1.1 Tue Sep  1 13:59:58 1992 (Bob Denny)
  3. #
  4. # xchat script for dialing a vanilla Hayes modem
  5. #
  6. # Usage:
  7. #    xchat dial.hayes telno
  8. #
  9. # where telno is the telephone number, subject to pause and wait
  10. # character modification. 
  11. #
  12. # Uncomment the first two lines after "start:" to get debugging
  13. # in file "Dial.Log"
  14. #
  15. # Flush input, zero counter, set telephone number if supplied,
  16. # else fail if no telephone number given.
  17. #
  18. start:
  19. ###    dbgfile         Dial.Log
  20. ###    dbgset          15 
  21.     zero
  22.     flush
  23.     ifnstr    notelno        0
  24.     telno            0
  25.     goto    initmodem
  26. #
  27. # Missing telephone number.
  28. #
  29. notelno:
  30.     logerr    No telephone number given
  31.     failed
  32. #
  33. # Reset the modem to nonvolatile profile. 
  34. # Allow 3 sec. for response, as some modems are slow to reset.
  35. #
  36. initmodem:
  37.     count
  38.     ifgtr    cantinit    4
  39.     send    ATZ\r
  40.     timeout    initmodem    3000
  41.     expect    setupmodem    OK
  42. #
  43. # No response from modem
  44. #
  45. cantinit:
  46.     logerr    Can't wake modem
  47.     failed
  48. #
  49. # Send the stuff needed to initialize the modem to the modes
  50. # needed for the particular modem flavor. The string below
  51. # is provided as a vanilla example. Allow 2 sec. for the
  52. # modem to respond to this command.
  53. #
  54. setupmodem:
  55.     sleep    1000
  56.     send    ATM0S7=90S11=120\r
  57.     timeout    setupfail    2000
  58.     expect    setupfail    ERROR
  59.     expect    dialnumber    OK
  60. #
  61. # Modem barfed or died on setup command.
  62. #
  63. setupfail:
  64.     logerr    Error in modem setup string
  65.     failed
  66. #
  67. # Dial the supplied number. Handle the various errors that
  68. # can come back from the modem by logging the error.
  69. #
  70. dialnumber:
  71.     sleep    1000
  72.     send    ATDT
  73.     dial
  74.     send    \r
  75.     flush
  76.     timeout    timeout        90000
  77.     expect    connected    CONNECT
  78.     expect    busy        BUSY
  79.     expect    nocarrier    NO CARRIER
  80.     expect    noanswer    NO ANSWER
  81.     expect    nodialtone    NO DIALTONE
  82. #
  83. # Success!
  84. #
  85. connected:
  86.     success
  87. #
  88. # Handle modem dial failures
  89. #
  90. timeout:
  91.     logerr    Modem or carrier timeout.
  92.     failed
  93. busy:
  94.     logerr    BUSY
  95.     failed
  96. nocarrier:
  97.     logerr    NO CARRIER
  98.     failed
  99. noanswer:
  100.     logerr    NO ANSWER
  101.     failed
  102. nodialtone:
  103.     logerr    NO DIALTONE
  104.     failed
  105. #
  106. # end
  107. #
  108.  
  109.