home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Tele / I-L / LineShare Demo2.0.sit / LineShare Demo2.0 / LineShare Files / LineShare Scripts / EXAR Fax&ARA&TeleFinder < prev    next >
Encoding:
Text File  |  1993-07-12  |  6.1 KB  |  293 lines  |  [TEXT/sLiN]

  1. !$ Use with EXAR-based (GVC, Best, etc) fax-modems.
  2. !$ This script supports: Fax, ARA, and TeleFinder.
  3.  
  4. !$ Set the TeleFinder "Host Options":
  5. !$ "Adjust BPS" - Off, "Hardware handshake" - On, "Use Break Reset" - On.
  6.  
  7. !$ This script disables MNP for incoming data calls, but V.42 is supported.
  8.  
  9. !$ Version 1.5
  10.  
  11. ^2 Speaker On:        = Enum("Never" = "0" ,  "When Connecting" = "1", "Always"="2") "1"
  12. ^3 Speaker Volume:    = Enum("Low"="1","Medium"="2","High"="3") "2"
  13. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  14. ^5 Fax Identifier:    = Text "Stalker_GmbH"
  15.  
  16. ! ------------------------------------------
  17. ! Resetting the modem:
  18. ! ------------------------------------------
  19. @Hangup
  20.   SetTries 2
  21.   Flush
  22.   HsReset 0,0,17,19,0,0
  23. !
  24. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  25. ! to enter the command mode
  26. !
  27. @Label 1
  28.   matchclr
  29.   matchstr 1 2 "OK\r\n"
  30.   write "ATH0&F\r"
  31.   matchread 20
  32.   Write "+++"
  33.   DtrClear
  34.   pause 10
  35.   DtrSet
  36. !
  37.   DecTries
  38.   IfTries 0 1
  39. !
  40. ! OSErr -6019 "Modem error - the modem is not responding"
  41. !
  42.   exit -6019
  43. @Label 2
  44.   write "AT+FCLASS=0\r"
  45.   Jsr 100
  46.   write "AT+FAA=0\r"
  47.   Jsr 100
  48.   exit 0
  49. ! ------------------------------------------
  50. !    Receiving incoming calls
  51. ! ------------------------------------------
  52. @ANSWER
  53. @Label 10
  54.   SerReset 19200,0,8,1
  55.   Jsr 80
  56. !
  57. ! Set the common options
  58.   Jsr 70
  59. !
  60. ! Set the communication options:
  61. ! • X4:  Extended response set
  62. ! • \N5: V42bis/Normal connection (but not MNP!)
  63. ! • \Q2: Uni-directional hardware flow control
  64. ! • \JO: Disable bps adjust
  65. ! • \V1: Enable enhanced CONNECT messages
  66. !
  67. @Label 11
  68.   Write "ATX4\\N5\\Q3\\J0\\V1\r"
  69.   Jsr 100
  70. !
  71. ! Set Fax parameters: LID, DCC,BOR
  72. !
  73.   Write "AT+FCLASS=2\r"
  74.   Jsr 100
  75.   Write "AT+FLID=\"^5\"\r"
  76.   Pause 10
  77.   Flush
  78.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  79.   Jsr 100
  80.   Write "AT+FBOR=1\r"
  81.   Jsr 100
  82. !
  83. ! Allow modem to receive fax messages
  84. !
  85.   Write "AT+FCR=1\r"
  86.   Jsr 100
  87. !
  88. ! Tell the modem to determine the type of the incoming call
  89. ! Fetch the tube after ^4 rings
  90. !
  91.   Write "ATS0=^4+FAA=1\r"
  92.   Jsr 100
  93.   Note "Waiting for Fax/ARA/TeleFinder calls…"
  94. !
  95. ! Everything is ready - let's sit and wait for a call
  96. ! We'll wait for 2 minutes, then reinitiate the modem
  97. !
  98. @Label 12
  99.   MatchClr
  100.   matchstr 1 13 "RING\r\n"
  101.   matchstr 2 21 "\r\nCONNECT ^$/V"
  102.   matchstr 3 15 "\r\nCONNECT ^$\r\n"
  103.   matchstr 9 40 "\r\n+FCON"
  104.   matchstr 10 10 "\r\nNO "
  105.   matchstr 11 10 "\r\nBUSY"
  106.   Matchread 1200
  107.   Jump 10
  108. @Label 13
  109.   Note "Ring…"
  110.   Jump 12
  111. !
  112. ! Data connection has been established (we read "CONNECT XXX\r\n")
  113. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  114. ! if it was an incoming call, put the "RING" before the "CONNECT"
  115. !
  116. @Label 15
  117.   SetVar A "^$"
  118.   Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
  119.   MatchClr
  120.   MatchStr 1 20 "\r"
  121.   MatchStr 2 30 "\08\01\03\14\04\03\00\08\250\16\03"
  122.   MatchRead 40
  123.  
  124. @Label 20
  125.   Note "Non-ARA call"
  126.   Flush
  127.   Jump 24
  128. !
  129. ! V.42 call detected
  130. !
  131. @Label 21
  132.   SetVar A "^$"
  133.   Note "V.42 Call at ^A bps"
  134.   MatchClr
  135.   MatchStr 1 24 "\r\n"
  136.   MatchRead 5
  137. @Label 24
  138.   QueueInput "\r\27CONNECT ^A\r\27"
  139. @Label 25
  140.   Attach "TF" (DTR,Break,Escape,TimeLimit=0)
  141.  
  142. !
  143. ! The ARA (MNP 4) frame detected
  144. !
  145. @Label 30
  146.   Note "ARA call at ^A bps."
  147.   Flush
  148.   QueueInput "\r\nRING\r\n\r\nCARRIER ^A\r\n"
  149. @Label 32
  150.   Attach "ARA" (DTR,Escape,TimeLimit=0)
  151.  
  152. !
  153. ! Fax connection has been established (we read "+FCON")
  154. ! Put the +FCON back to the buffer,
  155. ! if it was an incoming call, put the "RING" before the "+FCON"
  156. ! Attach the "Fax" subPort
  157. !
  158. @Label 40
  159.   QueueInput "\r\n+FCON"
  160.   ifOriginate 41
  161.   QueueInput "\r\nRING\r\n"
  162. @Label 41
  163.   Attach "Fax" (DTR,Reset,Escape,IdleLimit=30)
  164.  
  165. ! ------------------------------------------
  166. ! Originating a call through the "ARA" subport
  167. ! ------------------------------------------
  168. @ORIGINATE "ARA"
  169.   SerReset 19200,0,8,1
  170.   Jsr 80
  171. !
  172. ! Set the common options
  173. !
  174.   Jsr 70
  175. !
  176. ! Set the Data mode:
  177. ! • X4:  Extended response set
  178. ! • \N0: Normal connection (no compression, no correction, speed buffering - for ARA)
  179. ! • \Q2: Unidirectional Hardware handshake
  180. ! • \J0: Don't adjust the speed
  181. ! • S7:  time-out (90 sec) for long-distance call (if you use them)
  182. !
  183.   Write "ATX4\\N0\\Q2\\J0S7=90\r"
  184.   Jsr 100
  185. !
  186. ! Prepare to receive all error result codes
  187. !
  188.   Jsr 90
  189.   MatchStr 1 45 "\r\nCONNECT "
  190.   MatchRead 900
  191.   Write "\r"
  192.   Exit -6019
  193.  
  194. @Label 45
  195.   QueueInput "\r\nCARRIER "
  196.   Jump 32
  197.  
  198.  
  199. ! ------------------------------------------
  200. ! Originating a call through the "Fax" subPort
  201. ! ------------------------------------------
  202. @ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
  203.   SerReset 19200,0,8,1
  204.   Jsr 80
  205. !
  206. ! Set the common options
  207. !
  208.   Jsr 70
  209. !
  210. ! Set the Fax mode
  211. !
  212.   Write "AT+FCLASS=2\r"
  213.   Jsr 100
  214. !
  215. ! Now emit all commands that the application has sent to that port,
  216. ! Prepare to receive all error result codes
  217. !
  218.   Jsr 60
  219.   Jsr 90
  220.   MatchStr 1 40 "\r\n+FCON"
  221.   MatchRead 700
  222.   Write "\r"
  223.   Exit -6019
  224.  
  225. !
  226. ! This section emits all modem commands sent from the client application
  227. ! For each set of commands the "OK" answer is awaited
  228. !
  229. @Label 60
  230.   EmitStart
  231. @Label 61
  232.   EmitCommand 62
  233.   Jsr 100
  234.   Jump 61
  235. @Label 62
  236.   return
  237. !
  238. ! This section initiates the modem before ANSWER and ORIGINATEs:
  239. ! factory settings + speaker control +
  240. ! ignore Dtr drop + DCD valid
  241. ! Verbal responses mode, no echo
  242. ! Disable extended codes
  243. !
  244. @Label 70
  245.   Write "ATM^2L^3&D0&C1V1E0\\V0\r"
  246.   Jsr 100
  247.   return 
  248. !
  249. ! This section syncronize the modem after the serial port speed switching
  250. !
  251. @Label 80
  252.   ChrDelay 1
  253.   Write "AT\r"
  254.   ChrDelay 0
  255.   Jsr 100
  256.   return
  257. !
  258. ! Prepare to receive error result codes
  259. !
  260. @Label 90
  261.   MatchClr
  262.   MatchStr 2 91 "NO DIALTONE\r\n"
  263.   MatchStr 3 92 "BUSY\r\n"
  264.   MatchStr 4 93 "NO CARRIER\r\n"
  265.   MatchStr 5 94 "NO ANSWER\r\n"
  266.   Write "ATD^1\r"
  267.   HsReset *
  268.   return
  269.  
  270. @Label 91
  271.   exit -6020
  272. @Label 92
  273.   exit -6022
  274. @Label 93
  275.   exit -6021
  276. @Label 94
  277.   exit -6023
  278. !
  279. ! Processing the AT command:
  280. ! OK -> proceed
  281. ! ERROR or TimeOut ->exit -6019
  282. ! It can be called AFTER the "Write" command, since LineShare buffers input
  283. !
  284. @Label 100
  285.   MatchClr
  286.   MatchStr 1 102 "\r\nOK\r\n"
  287.   MatchStr 2 101 "\r\nERROR\r\n"
  288.   MatchRead 20
  289. @Label 101
  290.   Exit -6019
  291. @Label 102
  292.   return
  293.