home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Fax / AVMN199D.LHA / avminstall / rexx / defaultsender.avm < prev    next >
Encoding:
Text File  |  1995-08-19  |  17.3 KB  |  670 lines

  1. /* TITLE: avm:rexx/defaultsender.avm */
  2. /* we want results! Otherwise, we wouldn't get anything from RESULT */
  3. options results
  4.  
  5. /* Need to make sure that stdtail.avm is also included */
  6. signal on halt
  7. signal on novalue
  8. signal on syntax
  9. signal on break_c
  10.  
  11. /* needed for some of the functions we use */
  12. call addlib("rexxsupport.library", 0, -30, 0)
  13.  
  14. /* a higher than normal priority since calls are important to us :) */
  15. call pragma('priority', 1)
  16.  
  17. /* ensure that commands are directed to the correct server */
  18. parse arg servername .
  19. address value servername
  20.  
  21.  
  22. parse upper arg servername mailbox magiccookie sendType .
  23.  
  24. /* If type is voice, goto sendVoice.  Otherwise, go to sendFax */
  25.  
  26. call loadLogEntry(mailbox, magiccookie)
  27.  
  28. if log.returnNumber = '' & upper(sendType) ~= 'MANUAL' then do
  29.   log.returnStatus = 'No Tel#'
  30.   log.returnRetry = 0
  31.   signal sendVoiceDone
  32. end
  33. if log.filename = '' then do
  34.   log.returnStatus = 'No File'
  35.   log.returnRetry = 0
  36.   signal sendVoiceDone
  37. end
  38.  
  39. if upper(sendType) = 'MANUAL' then numberToDial = 'MAN!'; else numberToDial = log.returnNumber
  40. if upper(log.type) = 'VOICE' then signal sendVoice
  41. else if upper(log.type) = 'FAX' then signal sendFax
  42. log.returnstatus = 'Not Voice/Fax'
  43. log.returnretry = 0
  44. signal sendVoiceDone
  45.  
  46. /* Going to send a voice file */
  47.  
  48. /* Dial up to three times */
  49.  
  50. sendVoice:
  51. numTries = 3
  52.  
  53. sendVoiceRedial:
  54. 'dial' log.returnnumber
  55. a_=rc
  56. if 0 then nop
  57. else if a_=8 then signal sendVoiceAgain
  58. else if a_=10 then signal sendVoiceAgain
  59. else if a_=12 then do;log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone;end
  60. else if a_=14 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  61. else if a_=16 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  62. signal sendVoiceConnected
  63.  
  64. sendVoiceAgain:
  65. 'requiremode' 'Voice'
  66.  
  67. 'delay' 5
  68. a_=rc
  69. if 0 then nop
  70. else if a_=12 then do;log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone;end
  71. else if a_=14 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  72. else if a_=16 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  73.  
  74.  
  75. sendVoiceRetry:
  76. numTries = numTries - 1
  77. if numTries <= 0 then do
  78.   log.returnStatus = 'Busy'
  79.   signal sendVoiceDone
  80. end
  81. signal sendVoiceRedial
  82.  
  83. sendVoiceConnected:
  84. actualFileName = log.fileName
  85. if verify(actualFileName, '/:', 'M') = 0 then
  86.   actualFileName = voiceFile(mailbox, actualFileName)
  87. actualAltFileName = ''
  88. if symbol('log.altFileName') = 'VAR' then actualAltFileName = log.altFileName
  89. actualAltFileName = voiceFile(mailbox, actualAltFileName)
  90.  
  91. numTimes = 5
  92.  
  93. sendVoiceRepeat:
  94. if actualAltFileName = '' then signal sendVoiceSkipIntro
  95.  
  96. 'playvoice' actualAltFileName
  97. a_=rc
  98. if 0 then nop
  99. else if a_=4 then do;log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone;end
  100. else if a_=5 then do;log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone;end
  101. else if a_=8 then do;if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy;end
  102. else if a_=12 then do;log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone;end
  103.  
  104. 'flushphonebuffer'
  105.  
  106. sendVoiceSkipIntro:
  107. 'playvoice' actualFileName
  108. a_=rc
  109. if 0 then nop
  110. else if a_=4 then do;log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone;end
  111. else if a_=5 then do;log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone;end
  112. else if a_=8 then do;if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy;end
  113. else if a_=12 then do;log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone;end
  114. else if a_=14 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  115. else if a_=16 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  116.  
  117. 'flushphonebuffer'
  118.  
  119. sendVoiceMenu:
  120. call aapresentmenu('avm:voices/SendVoice', '019#*', '1')
  121. a_=result
  122. if 0 then nop
  123. else if a_='=0' then signal sendVoiceMenu
  124. else if a_='=1' then signal sendVoiceRepeat
  125. else if a_='=9' then do;log.returnRetry = 0; log.returnStatus = 'Sent+'; call updateLogEntry(mailbox, magicCookie); call 'avmrexxalt:processmailbox'(log.origmailbox); signal answerVoiceDone;end
  126. else if a_='=#' then signal answerVoiceDone
  127. else if a_='=*' then signal sendVoiceOK
  128. else if a_=4 then do;log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone;end
  129. else if a_=5 then do;log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone;end
  130. else if a_=8 then do;if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy;end
  131. else if a_=12 then do;log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone;end
  132. else if a_=14 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  133. else if a_=16 then do;log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone;end
  134.  
  135. numTimes = numTimes - 1
  136. if numTimes <= 0 then do
  137.   signal sendVoiceTimedOut
  138. end
  139. signal sendVoiceRepeat
  140.  
  141. sendVoiceTimedOut:
  142. log.returnStatus = 'Sent-TimedOut'
  143. log.returnRetry = 0
  144. signal sendVoiceDone
  145.  
  146. sendVoiceBusy:
  147. log.returnRetry = 0
  148. log.returnStatus = 'Sent-Busy'
  149. signal sendVoiceDone
  150.  
  151. sendVoiceOK:
  152. log.returnRetry = 0
  153. log.returnStatus = 'Sent+'
  154.  
  155. sendVoiceDone:
  156. if log.returnRetry > 0 then do
  157.   log.returnRetry = log.returnRetry - 1
  158.   log.time = cTime() + log.returnInterval * 60
  159. end
  160. call updateLogEntry(mailbox, magicCookie)
  161. exit
  162.  
  163. startup:
  164. /* Pressing 0 usually gets us here */
  165.  
  166. answerVoiceDone:
  167. /* Pressing * gets us here */
  168. exit
  169.  
  170. /* Going to send a fax file */
  171.  
  172. sendFax:
  173. options failat 50
  174. signal off syntax
  175.  
  176. 'requiremode' 'Command'
  177.  
  178. 'setserial' '19200' '8' 'N' '1' '7Wire'
  179. a_=rc
  180. if 0 then nop
  181.  
  182. 'assumemode' 'Unknown'
  183.  
  184. isTrapFax:
  185. faxprogram = getclip('AVMFaxProgram')
  186. if upper(faxprogram) = 'TRAPFAX' then do
  187.  
  188. mypara = 'File ' || log.filename || ' call ' || log.returnnumber
  189. address command 'TrapFax:TFaxDoor >NIL:' mypara ' noowndev'
  190. sendok = rc
  191. log.returnstatus = 'Error'
  192.  
  193. isGPFax:
  194. end; else if upper(faxprogram) = 'GPFAX' & show('p', 'REXX_GPFAX') then do
  195.  
  196. address rexx_gpfax 'listen'
  197. address rexx_gpfax 'sendfax' log.filename 'to' log.returnnumber
  198. sendok = rc
  199. address rexx_gpfax 'reportlog' 'T' 3
  200. log.returnstatus = result
  201. address rexx_gpfax 'unlisten'
  202.  
  203. isEFax:
  204. end; else if upper(faxprogram) = 'EFAX' then do
  205.  
  206. /* now we need to find all files that match */
  207. toSend = ''
  208. base = upper(voiceFile(mailbox, log.fileName) || '.');
  209. do i = 1 to 999
  210.   if exists(base || right(i, 3, '0')) then
  211.     toSend = toSend base || right(i, 3, '0')
  212.   else break
  213. end
  214.  
  215. address command 'avm:gnu/efax -p' servername '-t' '"' || compress(numberToDial) || '"' toSend
  216. if rc = 0 then sendOK = 0
  217. else sendOK = 10
  218.  
  219. isNeither:
  220. end; else do
  221.   log.returnStatus = 'Fax Prog?'
  222.   log.returnRetry = 0
  223.   call updateLogEntry(mailbox, magiccookie)
  224. end
  225.  
  226. sendFaxDone:
  227. if sendok < 5 then do; log.returnretry = 0; log.returnstatus = 'Sent OK'; end
  228. else do; log.returnRetry = log.returnRetry - 1; log.time = cTime() + log.returnInterval * 60; end
  229. call updateLogEntry(mailbox, magiccookie)
  230.  
  231. 'delay' 5
  232. a_=rc
  233. if 0 then nop
  234. else if a_=12 then signal stdabort
  235. else if a_=14 then signal stderror
  236. else if a_=16 then signal stderror
  237.  
  238. 'writeline' 'AT+FCLASS=0'
  239.  
  240. 'readline' '2'
  241. a_=rc
  242. if a_=0 then value=result
  243. if 0 then nop
  244. else if a_=10 then signal stdtimedout
  245. else if a_=12 then signal stdabort
  246. else if a_=14 then signal stderror
  247. else if a_=16 then signal stderror
  248.  
  249. 'readline' '2'
  250. a_=rc
  251. if a_=0 then value=result
  252. if 0 then nop
  253. else if a_=10 then signal stdtimedout
  254. else if a_=12 then signal stdabort
  255. else if a_=14 then signal stderror
  256. else if a_=16 then signal stderror
  257.  
  258. /* We're done sending a fax */
  259. exit
  260.  
  261. /* TITLE: avm:rexx/simplestdtail.avm */
  262. /* This is the standard tail */
  263. exit
  264.  
  265. exit
  266.  
  267. mailboxDir: procedure
  268.     parse arg mailbox
  269.  
  270.     return 'avmmbox:' || mailbox || '/'
  271.  
  272. logFile: procedure
  273.     parse arg mailbox, magiccookie
  274.  
  275.     return 'avmmbox:' || mailbox || '/logs/' || magiccookie
  276.  
  277. voiceFile: procedure
  278.     parse arg mailbox, magiccookie
  279.  
  280.         if (verify(magiccookie, '/:', 'M') = 0) then
  281.           return 'avmmbox:' || mailbox || '/voices/' || magiccookie
  282.         else
  283.           return magiccookie
  284.  
  285. makeUniqueFile: procedure
  286.     if arg() ~= 0 then do
  287.         rc = "makeUniqueFile: bad args"
  288.         signal error
  289.     end
  290.     return address() || '.' || date('i') || '.' || time('s') || '.' || random(1, 999, time('s'))
  291.  
  292. convertToDate: procedure
  293.     if arg() ~= 1 then do
  294.         rc = "convertToDate: bad args"
  295.         signal error
  296.     end
  297.     parse arg timeInC
  298.  
  299.     actualTime = (timeInC - (2922)*86400) // (86400)
  300.     actualDate = (timeInC - actualTime - 2922*86400) % 86400
  301.  
  302.     return actualDate /* returning it in 'internal' format */
  303.  
  304. convertToTime: procedure
  305.     if arg() ~= 1 then do
  306.         rc = "convertToTime: bad args"
  307.         signal error
  308.     end
  309.     parse arg timeInC
  310.     
  311.     actualTime = (timeInC - (2922)*86400) // (86400)
  312.  
  313.     return actualTime
  314.  
  315. cTime: procedure
  316.     /* 2922 = 8*365 + 2 */
  317.     /* 86400 = 24*60*60 */
  318.     return (date('i')+2922)*86400 + time('s')
  319.  
  320. /* this returns a handle that you must use after initializing log. */
  321. initLogEntry: procedure expose log.
  322.     if arg() ~= 0 then do
  323.         rc = "initLogEntry: bad args"
  324.         signal error
  325.     end
  326.     
  327.     drop log.
  328.         log. = ''
  329.  
  330.         acidname = getclip(address() || 'CIDNAME')
  331.         acidnumber = getclip(address() || 'CIDNUMBER')
  332.  
  333.     /* 2922 = 8*365 + 2 */
  334.     /* 86400 = 24*60*60 */
  335.     log.time = (date('i')+2922)*86400 + time('s')
  336.     log.cidname = acidname
  337.     log.cidnumber = acidnumber
  338.  
  339.     return
  340.  
  341. loadLogEntry: procedure expose log.
  342.     if arg() ~= 2 then do
  343.         rc = "loadLogEntry: bad args"
  344.         signal error
  345.     end
  346.     parse arg mailbox, handle
  347.  
  348.         drop log.
  349.         log. = ''
  350.  
  351.     if ~exists(mailboxDir(mailbox)) then do
  352.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  353.         return
  354.     end
  355.  
  356.     opened = open(handle, logFile(mailbox, handle), 'r')
  357.         if opened then do
  358.         call showDebugger('Loading entry' logFile(mailbox, handle))
  359.         do while ~eof(handle)
  360.             line = readln(handle)
  361.             parse upper var line variable '=' value
  362.             log.variable = value
  363.         end
  364.         call close(handle)
  365.     end; else call showDebugger('Could not load' logFile(mailbox, handle))
  366.     return
  367.  
  368. /* pass a handle here */
  369. saveLogEntry: procedure expose log.
  370.     if arg() ~= 2 then do
  371.         rc = "saveLogEntry: bad args"
  372.         signal error
  373.     end
  374.     parse arg mailbox, handle
  375.  
  376.     if ~exists(mailboxDir(mailbox)) then do
  377.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  378.         return
  379.     end
  380.  
  381.     opened = open(handle, logFile(mailbox, handle), 'w')
  382.  
  383.     if opened then do
  384.         call showDebugger('Saving entry' logFile(mailbox, handle))
  385.         call writeln(handle, 'TYPE=' || log.type)
  386.         call writeln(handle, 'TIME=' || log.time)
  387.         call writeln(handle, 'LENGTH=' || log.length)
  388.  
  389.         call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
  390.  
  391.         call writeln(handle, 'CIDNAME=' || log.cidname)
  392.         call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
  393.  
  394.         call writeln(handle, 'COMMENT=' || log.comment)
  395.  
  396.         call writeln(handle, 'FILENAME=' || log.filename)
  397.         call writeln(handle, 'ALTFILENAME=' || log.altfilename)
  398.  
  399.         call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
  400.         call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
  401.         call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
  402.  
  403.         call writeln(handle, 'RETURNRETRY=' || log.returnretry)
  404.         call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
  405.  
  406.         call close(handle)
  407.         address rexx 'broadcast' 'addtomailbox' mailbox handle
  408.     end; else call showDebugger('Could not save' logFile(mailbox, handle))
  409.  
  410.     return
  411.  
  412. /* pass a handle here */
  413. updateLogEntry: procedure expose log.
  414.     if arg() ~= 2 then do
  415.         rc = "updateLogEntry: bad args"
  416.         signal error
  417.     end
  418.     parse arg mailbox, handle
  419.  
  420.     if ~exists(mailboxDir(mailbox)) then do
  421.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  422.         return
  423.     end
  424.  
  425.     if ~exists(logFile(mailbox, handle)) then do
  426.         call showDebugger('Unable to update non-existent' logFile(mailbox, handle))
  427.         return
  428.     end
  429.     opened = open(handle, logFile(mailbox, handle), 'w')
  430.  
  431.     if opened then do
  432.         call showDebugger('Updating entry' logFile(mailbox, handle))
  433.         call writeln(handle, 'TYPE=' || log.type)
  434.         call writeln(handle, 'TIME=' || log.time)
  435.         call writeln(handle, 'LENGTH=' || log.length)
  436.  
  437.         call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
  438.  
  439.         call writeln(handle, 'CIDNAME=' || log.cidname)
  440.         call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
  441.  
  442.         call writeln(handle, 'COMMENT=' || log.comment)
  443.  
  444.         call writeln(handle, 'FILENAME=' || log.filename)
  445.         call writeln(handle, 'ALTFILENAME=' || log.altfilename)
  446.  
  447.         call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
  448.         call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
  449.         call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
  450.  
  451.         call writeln(handle, 'RETURNRETRY=' || log.returnretry)
  452.         call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
  453.  
  454.         call close(handle)
  455.         address rexx 'broadcast' 'refreshmailboxentry' mailbox handle
  456.     end; else call showDebugger('Could not update' logFile(mailbox, handle))
  457.  
  458.     return
  459.  
  460.  
  461.  
  462. showDebugger: procedure
  463.     if arg() ~= 1 then do
  464.         say "showDebugger: ERROR"
  465.         exit 20
  466.     end
  467.  
  468.     parse arg debuggerInfo
  469.     
  470.     firstLine = sourceline(1)
  471.     parse var firstLine '/*' 'TITLE:' title '*/'
  472.     if showlist('p', 'AVMLOGGER') then
  473.         address 'AVMLOGGER' 'add' title ':' debuggerInfo
  474.     else
  475.         say title ':' debuggerInfo
  476.  
  477.     return 
  478.  
  479. /*-----------------------------------------------------------------------*/
  480. /*                         signal processing                             */
  481.  
  482. arexxerror:
  483. error:
  484.     call showDebugger("Error" rc "at line" sigl)
  485.     exit 20
  486.  
  487. break_c:
  488. halt:
  489.     call showDebugger("Halt/Break_C at line" sigl)
  490.     exit 20
  491.  
  492. novalue:
  493.     call showDebugger("No value at line" sigl)
  494.     exit 20
  495.  
  496. syntax:
  497.     call showDebugger("Syntax error" rc "at line" sigl)
  498.     exit 20
  499.  
  500. /* TITLE: avm:rexx/stdplayvoice.avm */
  501. stdPlayXX:
  502. procedure
  503. parse arg ret
  504.  
  505. rs.normal = 0
  506. rs.keydetected = 1
  507. rs.quietdetected = 2
  508. rs.silencedetected = 3
  509. rs.faxdetected = 4
  510. rs.datadetected = 5
  511. rs.busydetected = 8
  512. rs.timedout = 10
  513. rs.signaldetected = 12
  514. rs.overflow = 14
  515. rs.error = 16
  516. /* CB 0000 */
  517.  
  518. select
  519.   when ret=rs.faxdetected then signal stdfax
  520.   when ret=rs.datadetected then signal stddata
  521.   when ret=rs.busydetected then signal stdbusy
  522.   when ret=rs.signaldetected then signal stdabort
  523.   when ret=rs.overflow then signal stderror
  524.   when ret=rs.error then signal stderror
  525.   otherwise nop
  526. end
  527. return
  528.  
  529.  
  530. aapresentmenu:
  531. /* TITLE: avm:rexx/presentmenu.avm */
  532. procedure expose pmRetries pmTimesAround
  533. parse arg filename, valid, retries
  534. timesaround = retries
  535. pmTimesAround = timesaround
  536. pmRetries = retries
  537.  
  538. rs.normal = 0
  539. rs.keydetected = 1
  540. rs.quietdetected = 2
  541. rs.silencedetected = 3
  542. rs.faxdetected = 4
  543. rs.datadetected = 5
  544. rs.busydetected = 8
  545. rs.timedout = 10
  546. rs.signaldetected = 12
  547. rs.overflow = 14
  548. rs.error = 16
  549. /* CB 0000 */
  550.  
  551. aapresentmenuloop:
  552. 'playvoice' filename
  553. a_=rc
  554. if 0 then nop
  555. else if a_=4 then do;return rs.faxdetected;end
  556. else if a_=5 then do;return rs.datadetected;end
  557. else if a_=8 then do;return rs.busydetected;end
  558. else if a_=12 then do;return rs.signaldetected;end
  559. else if a_=14 then do;return rs.error;end
  560. else if a_=16 then do;return rs.error;end
  561.  
  562. 'readnkeys' '1' '5'
  563. a_=rc
  564. if a_=0 then value=result
  565. if 0 then nop
  566. else if a_=0 then signal aapresentmenuvalue
  567. else if a_=4 then do;return rs.faxdetected;end
  568. else if a_=5 then do;return rs.datadetected;end
  569. else if a_=8 then do;return rs.busydetected;end
  570. else if a_=10 then signal aapresentmenutimeout
  571. else if a_=12 then do;return rs.signaldetected;end
  572. else if a_=14 then do;return rs.error;end
  573. else if a_=16 then do;return rs.error;end
  574. return rs.error
  575.  
  576. aapresentmenutimeout:
  577. 'flushphonebuffer'
  578.  
  579. 'playvoice' 'avm:voices/TimedOut'
  580. a_=rc
  581. if 0 then nop
  582. else if a_=4 then do;return rs.faxdetected;end
  583. else if a_=5 then do;return rs.datadetected;end
  584. else if a_=8 then do;return rs.busydetected;end
  585. else if a_=12 then do;return rs.signaldetected;end
  586. else if a_=14 then do;return rs.error;end
  587. else if a_=16 then do;return rs.error;end
  588.  
  589. timesaround = timesaround - 1; pmTimesAround = timesaround
  590. if timesaround <= 0 then return rs.timedout
  591. signal aapresentmenuloop
  592.  
  593. aapresentmenuvalue:
  594. if pos(value, valid) = 0 then signal aainvalid
  595. return '=' || value
  596.  
  597. aainvalid:
  598. 'flushphonebuffer'
  599.  
  600. 'playvoice' 'avm:voices/BadChoice'
  601. a_=rc
  602. if 0 then nop
  603. else if a_=4 then do;return rs.faxdetected;end
  604. else if a_=5 then do;return rs.datadetected;end
  605. else if a_=8 then do;return rs.busydetected;end
  606. else if a_=12 then do;return rs.signaldetected;end
  607. else if a_=14 then do;return rs.error;end
  608. else if a_=16 then do;return rs.error;end
  609.  
  610. timesaround = timesaround - 1; pmTimesAround = timesaround
  611. if timesaround <= 0 then return rs.timedout
  612. signal aapresentmenuloop
  613.  
  614.  
  615. stdabort:
  616. exit
  617.  
  618. stdbusy:
  619. exit
  620.  
  621. stderror:
  622. exit
  623.  
  624. stdtimedout:
  625. exit
  626.  
  627. stdfaxinstruct:
  628. 'playvoice' 'avm:voices/FaxStarting'
  629. a_=rc
  630. if 0 then nop
  631. else if a_=1 then do;call checkifabort;end
  632. else if a_=8 then signal stdbusy
  633. else if a_=12 then signal stdabort
  634.  
  635. stdfax:
  636. faxscript = getclip(address() || 'FAXSCRIPT')
  637. if faxscript = '' then faxscript = 'handlefax'
  638. if symbol('mailbox') = 'VAR' then address rexx faxscript address() mailbox
  639. else address rexx faxscript address() 'anonymous'
  640. exit
  641.  
  642. stddatainstruct:
  643. 'playvoice' 'avm:voices/DataStarting'
  644. a_=rc
  645. if 0 then nop
  646. else if a_=1 then do;call checkifabort;end
  647. else if a_=8 then signal stdbusy
  648. else if a_=12 then signal stdabort
  649.  
  650. stddata:
  651. datascript = getclip(address() || 'DATASCRIPT')
  652. if datascript = '' then datascript = 'handledata'
  653. if symbol('mailbox') = 'VAR' then address rexx datascript address() mailbox
  654. else address rexx datascript address()
  655. exit
  656.  
  657. checkifabort:
  658. 'readnkeys' '1' '3'
  659. a_=rc
  660. if a_=0 then value=result
  661. if 0 then nop
  662. else if a_=0 then do;if value = '*' then signal stdabort;end
  663. else if a_=8 then signal stdbusy
  664. else if a_=12 then signal stdabort
  665. else if a_=14 then signal stderror
  666. else if a_=16 then signal stderror
  667. return
  668.  
  669.  
  670.