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

  1. /* TITLE: avm:rexx/maintenancemode.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.  
  18. parse arg mailbox .
  19.  
  20. call loadMailbox(mailbox)
  21. good = getPassword(mailbox.password)
  22. if good = 0 then signal answerVoiceDone
  23.  
  24. logsthis = words(showdir(logFile(mailbox, '')))
  25. logsanonymous = words(showdir(logFile('anonymous', '')))
  26. if upper(mailbox) = 'ANONYMOUS' then logsanonymous = 0
  27.  
  28. if logsthis > 0 then call sayCountEntries(logsthis, 0)
  29. if logsanonymous > 0 then call sayCountEntries(logsanonymous, 1)
  30.  
  31. maintenanceModeAgain:
  32. call aapresentmenu('avm:voices/maintenancemode', '01234567#*', '3')
  33. a_=result
  34. if 0 then nop
  35. else if a_='=0' then signal maintenanceModeAgain
  36. else if a_='=1' then do;call retrievemessages(mailbox);end
  37. else if a_='=2' then do;call recordMessage(voiceFile(mailbox, 'Personal'));end
  38. else if a_='=3' then do;call changeintrooptions();end
  39. else if a_='=4' then do;call changepassword();end
  40. else if a_='=5' then do;call sendMessageTo('Outgoing', mailbox, '', makeUniqueFile(), 'Voice', voiceFile(mailbox, 'Introduction'), '', '');end
  41. else if a_='=6' then do;call changeautooptions(mailbox);end
  42. else if a_='=7' then do;call aaretrievemessages('Outgoing', 1, mailbox);end
  43. else if a_='=#' then do;return 1;end
  44. else if a_='=*' then signal answervoiceDone
  45. else if a_=4 then signal stdfax
  46. else if a_=5 then signal stddata
  47. else if a_=8 then signal stdbusy
  48. else if a_=10 then signal answerVoiceDone
  49. else if a_=12 then signal stdabort
  50. else if a_=14 then signal stderror
  51. else if a_=16 then signal stderror
  52. signal maintenanceModeAgain
  53.  
  54. retrievemessages:
  55. procedure
  56. parse arg mailbox .
  57. call aaretrievemessages(mailbox, 0, mailbox)
  58.  
  59. if upper(mailbox) = 'ANONYMOUS' then return
  60.  
  61. 'playvoice' 'avm:voices/retrieveanonymous'
  62. call stdPlayXX(rc)
  63.  
  64. call aaretrievemessages('Anonymous', 0, mailbox)
  65.  
  66. 'playvoice' 'avm:voices/backhome'
  67. call stdPlayXX(rc)
  68. return
  69.  
  70. changepassword:
  71. number = getNumber()
  72. if number ~= '' then do
  73.   mailbox.password = number
  74.   call saveMailbox(mailbox)
  75. end
  76. return
  77.  
  78. sayCountEntries:
  79. parse arg count, inAnon
  80. if count = 1 & inAnon then signal say1Anon
  81. else if count = 1 & inAnon = 0 then signal say1This
  82.  
  83. sayCountMultiple:
  84. 'playvoice' 'avm:voices/ThereAre'
  85. call stdPlayXX(rc)
  86.  
  87. call playddnumber(count)
  88. if inAnon then signal sayCountAnon
  89. else signal sayCountThis
  90.  
  91. sayCountAnon:
  92. 'playvoice' 'avm:voices/InAnonMailbox'
  93. call stdPlayXX(rc)
  94. return
  95.  
  96. sayCountThis:
  97. 'playvoice' 'avm:voices/InThisMailbox'
  98. call stdPlayXX(rc)
  99. return
  100.  
  101. say1Anon:
  102. 'playvoice' 'avm:voices/OneInAnonMailbox'
  103. call stdPlayXX(rc)
  104. return
  105.  
  106. say1This:
  107. 'playvoice' 'avm:voices/OneInThisMailbox'
  108. call stdPlayXX(rc)
  109. return
  110.  
  111. changeintrooptions:
  112. call aapresentmenu('avm:voices/changeintrooptions', '012345#*', '3')
  113. a_=result
  114. if 0 then nop
  115. else if a_='=0' then signal changeintrooptions
  116. else if a_='=1' then do;call setclip('AVMIntroductionType', 'DAYOFWEEK');end
  117. else if a_='=2' then do;call setclip('AVMIntroductionType', 'TIMEOFDAY');end
  118. else if a_='=3' then do;call setclip('AVMIntroductionType', 'RANDOM');end
  119. else if a_='=4' then do;call changetomanual();end
  120. else if a_='=5' then do;call recordintro();end
  121. else if a_='=#' then do;return;end
  122. else if a_='=*' then signal answervoiceDone
  123. else if a_=4 then signal stdfax
  124. else if a_=5 then signal stddata
  125. else if a_=8 then signal stdbusy
  126. else if a_=10 then signal answerVoiceDone
  127. else if a_=12 then signal stdabort
  128. else if a_=14 then signal stderror
  129. else if a_=16 then signal stderror
  130. signal changeintrooptions
  131.  
  132. changetomanual:
  133. call aapresentmenu('avm:voices/selectmanualintro', '01234567#*', '3')
  134. a_=result
  135. if 0 then nop
  136. else if a_='=0' then signal changetomanual
  137. else if a_='=1' then do;call setclip('AVMIntroductionType', '1');end
  138. else if a_='=2' then do;call setclip('AVMIntroductionType', '2');end
  139. else if a_='=3' then do;call setclip('AVMIntroductionType', '3');end
  140. else if a_='=4' then do;call setclip('AVMIntroductionType', '4');end
  141. else if a_='=5' then do;call setclip('AVMIntroductionType', '5');end
  142. else if a_='=6' then do;call setclip('AVMIntroductionType', '6');end
  143. else if a_='=7' then do;call setclip('AVMIntroductionType', '7');end
  144. else if a_='=#' then do;return;end
  145. else if a_='=*' then signal answervoiceDone
  146. else if a_=4 then signal stdfax
  147. else if a_=5 then signal stddata
  148. else if a_=8 then signal stdbusy
  149. else if a_=10 then signal answerVoiceDone
  150. else if a_=12 then signal stdabort
  151. else if a_=14 then signal stderror
  152. else if a_=16 then signal stderror
  153. signal changetomanual
  154.  
  155. recordintro:
  156. call aapresentmenu('avm:voices/recordintro', '01234567#*', '3')
  157. a_=result
  158. if 0 then nop
  159. else if a_='=0' then signal recordintro
  160. else if a_='=1' then do;call recordmessage('avm:voices/intro1');end
  161. else if a_='=2' then do;call recordmessage('avm:voices/intro2');end
  162. else if a_='=3' then do;call recordmessage('avm:voices/intro3');end
  163. else if a_='=4' then do;call recordmessage('avm:voices/intro4');end
  164. else if a_='=5' then do;call recordmessage('avm:voices/intro5');end
  165. else if a_='=6' then do;call recordmessage('avm:voices/intro6');end
  166. else if a_='=7' then do;call recordmessage('avm:voices/intro7');end
  167. else if a_='=#' then do;return;end
  168. else if a_='=*' then signal answervoiceDone
  169. else if a_=4 then signal stdfax
  170. else if a_=5 then signal stddata
  171. else if a_=8 then signal stdbusy
  172. else if a_=10 then signal answerVoiceDone
  173. else if a_=12 then signal stdabort
  174. else if a_=14 then signal stderror
  175. else if a_=16 then signal stderror
  176. signal recordintro
  177.  
  178. changeautooptions:
  179. procedure
  180. parse arg mailbox .
  181. call loadMailbox(mailbox)
  182.  
  183. changeautomenu:
  184. call aapresentmenu('avm:voices/ChangeAutoOptions', '0123#*', '3')
  185. a_=result
  186. if 0 then nop
  187. else if a_='=0' then signal changeautomenu
  188. else if a_='=1' then do;call editautooptions('AUTOFORWARDB', 'AUTOFORWARDONDEMAND', 'AUTOFORWARD', 'AUTOFORWARDANNOUNCE');end
  189. else if a_='=2' then do;call editautooptions('AUTOFAXFORWARDB', '', 'AUTOFAXFORWARD', '');end
  190. else if a_='=3' then do;call editautooptions('AUTOPAGEB', 'AUTOPAGEONDEMAND', 'AUTOPAGE', '');end
  191. else if a_='=#' then do;return;end
  192. else if a_='=*' then signal answerVoiceDone
  193. else if a_=4 then signal stdfax
  194. else if a_=5 then signal stddata
  195. else if a_=8 then signal stdbusy
  196. else if a_=10 then signal answerVoiceDone
  197. else if a_=12 then signal stdabort
  198. else if a_=14 then signal stderror
  199. else if a_=16 then signal stderror
  200. signal changeautomenu
  201.  
  202. editautooptions:
  203. procedure expose mailbox. mailbox
  204. parse arg isOn, onDemand, telNumber, announce
  205. call showAutoOptions
  206.  
  207. editautomenu:
  208. call aapresentmenu('avm:voices/AutoOptions', '01234567#*', '3')
  209. a_=result
  210. if 0 then nop
  211. else if a_='=0' then signal editautomenu
  212. else if a_='=1' then do;mailbox.isOn = 1; call saveMailbox(mailbox);end
  213. else if a_='=2' then do;mailbox.isOn = 0; call saveMailbox(mailbox);end
  214. else if a_='=3' then do;mailbox.telNumber = getNumber(); call saveMailbox(mailbox);end
  215. else if a_='=4' then do;if onDemand ~= '' then do; mailbox.onDemand = getNumber(); call saveMailbox(mailbox); end;end
  216. else if a_='=5' then do;if announce ~= '' then do; mailbox.announce = 1; call saveMailbox(mailbox); end;end
  217. else if a_='=6' then do;if announce ~= '' then do; mailbox.announce = 0; call saveMailbox(mailbox); end;end
  218. else if a_='=7' then do;call showAutoOptions();end
  219. else if a_='=#' then do;return;end
  220. else if a_='=*' then signal answerVoiceDone
  221. else if a_=4 then signal stdfax
  222. else if a_=5 then signal stddata
  223. else if a_=8 then signal stdbusy
  224. else if a_=10 then signal answerVoiceDone
  225. else if a_=12 then signal stdabort
  226. else if a_=14 then signal stderror
  227. else if a_=16 then signal stderror
  228. signal editautomenu
  229.  
  230. showautooptions:
  231. if mailbox.isOn = 1 then call autoIsOn(); else call autoIsOff()
  232. if onDemand ~= '' then call autoOnDemand(mailbox.onDemand)
  233. call autoTelNumber(mailbox.telNumber)
  234. if announce ~= '' then
  235.   if mailbox.announce = 1 then call announceIsOn(); else call announceIsOff()
  236. return
  237.  
  238. autoIsOn:
  239. 'playvoice' 'avm:voices/AutoIsOn'
  240. call stdPlayXX(rc)
  241.  
  242. 'flushphonebuffer'
  243. return
  244.  
  245. autoIsOff:
  246. 'playvoice' 'avm:voices/autoIsOff'
  247. call stdPlayXX(rc)
  248.  
  249. 'flushphonebuffer'
  250. return
  251.  
  252. announceIsOn:
  253. 'playvoice' 'avm:voices/AnnounceIsOn'
  254. call stdPlayXX(rc)
  255.  
  256. 'flushphonebuffer'
  257. return
  258.  
  259. announceIsOff:
  260. 'playvoice' 'avm:voices/AnnounceIsOff'
  261. call stdPlayXX(rc)
  262.  
  263. 'flushphonebuffer'
  264. return
  265.  
  266. autoOnDemand:
  267. procedure
  268. parse arg number
  269.  
  270. 'playvoice' 'avm:voices/AutoOnDemand'
  271. call stdPlayXX(rc)
  272.  
  273. call playNumber(number)
  274.  
  275. 'flushphonebuffer'
  276. return
  277.  
  278. autoTelNumber:
  279. procedure
  280. parse arg number
  281.  
  282. 'playvoice' 'avm:voices/AutoTelNumber'
  283. call stdPlayXX(rc)
  284.  
  285. call playNumber(number)
  286.  
  287. 'flushphonebuffer'
  288. return
  289.  
  290. answerVoiceDone:
  291. 'playvoice' 'avm:voices/Goodbye'
  292. call stdPlayXX(rc)
  293. exit
  294.  
  295. /* TITLE: avm:rexx/retrievemessages.avm */
  296. aaretrievemessages:
  297. procedure
  298. parse arg mailbox, isOutgoing, whichMailbox
  299.  
  300. logs = showdir(logFile(mailbox, ''))
  301. numlogs = words(logs)
  302. currentlog = 1
  303.  
  304. retrievemessagesnext:
  305. if currentlog > numlogs then signal retrievemessagesdone
  306. currentHandle = word(logs, currentLog)
  307. call loadLogEntry(mailbox, currentHandle)
  308. if (isOutgoing & ( log.returnRetry = '' | log.returnRetry = 0 | (upper(log.origMailbox) ~= upper(whichMailbox) & upper(log.origMailbox) ~= 'ANONYMOUS'))) then do
  309.   currentLog = currentLog + 1
  310.   signal retrieveMessagesNext
  311. end
  312.  
  313. retrievemessagesagain:
  314. logtype = upper(log.type)
  315. if logtype = 'FAX' then signal isfax
  316. else if logtype = 'VOICE' then signal isvoice
  317. else signal isunknown
  318.  
  319. isfax:
  320. 'playvoice' 'avm:voices/FaxMessage'
  321. call stdPlayXX(rc)
  322. signal aftertype
  323.  
  324. isvoice:
  325. 'playbeep' '3000' '0' '4'
  326. a_=rc
  327. if 0 then nop
  328. else if a_=12 then signal stdabort
  329. else if a_=14 then signal stderror
  330. else if a_=16 then signal stderror
  331.  
  332. 'playvoice' voiceFile(mailbox, log.filename)
  333. a_=rc
  334. if 0 then nop
  335. else if a_=12 then signal stdabort
  336.  
  337. 'flushphonebuffer'
  338.  
  339. 'playbeep' '3000' '0' '4'
  340. a_=rc
  341. if 0 then nop
  342. else if a_=12 then signal stdabort
  343. else if a_=14 then signal stderror
  344. else if a_=16 then signal stderror
  345. signal aftertype
  346.  
  347. isunknown:
  348. 'playvoice' 'avm:voices/UnknownMessage'
  349. call stdPlayXX(rc)
  350. signal aftertype
  351.  
  352. aftertype:
  353. call aapresentmenu('avm:voices/RetrieveMessages', '012345678#*', '3')
  354. a_=result
  355. if 0 then nop
  356. else if a_='=0' then signal aftertype
  357. else if a_='=1' then signal retrievemessagesagain
  358. else if a_='=2' then do;call playtimedate();end
  359. else if a_='=3' then do;call playtelcidnumber();end
  360. else if a_='=4' then signal processNextMessage
  361. else if a_='=5' then do;address rexx 'delete' mailbox currentHandle; signal processNextMessage;end
  362. else if a_='=6' then do;if isOutgoing = 0 then address rexx 'archive' mailbox currentHandle; else address rexx 'archiveoutgoing' mailbox currentHandle; signal processNextMessage;end
  363. else if a_='=7' then do;call forwardmessage(mailbox, currentHandle);end
  364. else if a_='=8' then do;call replymessage(mailbox, currentHandle);end
  365. else if a_='=#' then do;return;end
  366. else if a_='=*' then signal answervoiceDone
  367. else if a_=4 then signal stdfax
  368. else if a_=5 then signal stddata
  369. else if a_=8 then signal stdbusy
  370. else if a_=10 then signal answerVoiceDone
  371. else if a_=12 then signal stdabort
  372. else if a_=14 then signal stderror
  373. else if a_=16 then signal stderror
  374. signal aftertype
  375.  
  376. processNextMessage:
  377. currentLog = currentLog + 1
  378. signal retrievemessagesnext
  379.  
  380. playtimedate:
  381. actualTime = convertToTime(log.time)
  382. actualDate = convertToDate(log.time)
  383. call playTime(actualTime)
  384. actualDate = date('s', actualDate) /* convert to sorted */
  385. call playDate(actualDate)
  386.  
  387. 'flushphonebuffer'
  388.  
  389. return
  390.  
  391. playtelcidnumber:
  392. 'playvoice' 'avm:voices/cidnumber'
  393. call stdPlayXX(rc)
  394.  
  395. if symbol('log.cidnumber') = 'VAR' then
  396.   call playNumber(log.cidnumber)
  397.  
  398. 'flushphonebuffer'
  399.  
  400. 'playvoice' 'avm:voices/returnnumber'
  401. call stdPlayXX(rc)
  402.  
  403. if symbol('log.returnnumber') = 'VAR' then
  404.   call playNumber(log.returnnumber)
  405.  
  406. 'flushphonebuffer'
  407. return
  408.  
  409. retrievemessagesdone:
  410. 'playvoice' 'avm:voices/NoMoreMessages'
  411. call stdPlayXX(rc)
  412. return
  413.  
  414. replyMessage:
  415. procedure
  416. parse arg mailbox, magicCookie
  417. call loadLogEntry(mailbox, magicCookie)
  418. number = log.returnNumber
  419. if number = '' then number = log.cidNumber
  420. handle = makeUniqueFile()
  421. sent = sendMessageTo('Outgoing', mailbox, number, handle, 'Voice', voiceFile(mailbox, 'Introduction'), log.cidNumber, log.cidName)
  422.  
  423. return
  424.  
  425. forwardMessage:
  426. procedure
  427. parse arg mailbox, magicCookie
  428. call loadLogEntry(mailbox, magicCookie)
  429.  
  430. if verify(log.fileName, '/:', 'M') = 0 then
  431.   address command 'copy >nil: <nil:' voiceFile(mailbox, log.fileName) || '#?' voiceFile('Outgoing', '')
  432. sent = sendMessageTo('Outgoing', mailbox, '', log.fileName, log.type, voiceFile(mailbox, 'Introduction'), log.cidName, log.cidNumber)
  433. return
  434.  
  435. /* TITLE: avm:rexx/sendmessageto.avm */
  436. sendMessageTo:
  437. procedure
  438. parse arg mailbox, originMailbox, number, actualFilename, fileType, introFileName, acidName, acidNumber
  439. handle = makeUniqueFile()
  440. call initLogEntry()
  441. log.returnNumber = number
  442. log.filename = actualFilename
  443. log.type = fileType; log.returnSendFunc = 'DefaultSender'
  444. log.returnRetry = 3; log.returnInterval = 5
  445. log.origMailbox = originMailbox
  446. log.altFileName = introFileName; log.cidName = acidName; log.cidNumber = acidNumber
  447.  
  448. if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then call smNeedToRecordOut
  449. if ~exists(voiceFile(mailbox, log.altFileName)) then call smNeedToRecordIntro
  450. if log.returnNumber = '' then do; call smNeedToEnterTel(); signal sendMessageToMenu; end
  451.  
  452. 'playvoice' 'avm:voices/numberToSendTo'
  453. a_=rc
  454. if 0 then nop
  455. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  456. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  457. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  458. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  459. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  460. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  461.  
  462. call playNumber(log.returnNumber)
  463.  
  464. 'flushphonebuffer'
  465.  
  466. sendMessageToMenu:
  467. call aapresentmenu('avm:voices/editSendMessage', '01234#*', '3')
  468. a_=result
  469. if 0 then nop
  470. else if a_='=0' then signal sendMessageToMenu
  471. else if a_='=1' then do;call playNumber(log.returnNumber); log.returnNumber = getNumber(); signal sendMessageToMenu;end
  472. else if a_='=2' then do;if upper(log.type) = 'VOICE' then call recordMessage(voiceFile(mailbox, log.filename)); signal sendMessageToMenu;end
  473. else if a_='=3' then do;call editIntro(); signal sendMessageToMenu;end
  474. else if a_='=4' then do;if smCanSend() then do; call saveLogEntry(mailbox, handle); return 1; end; else signal sendMessageToMenu;end
  475. else if a_='=#' then do;call cleanSendMessageTo(); return 0;end
  476. else if a_='=*' then do;call cleanSendMessageTo(); signal answerVoiceDone;end
  477. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  478. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  479. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  480. else if a_=10 then do;call cleanSendMessageTo(); signal answerVoiceDone;end
  481. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  482. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  483. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  484. call cleanSendMessageTo(); return 0
  485.  
  486. cleanSendMessageTo:
  487. if verify(log.fileName, '/:', 'M') = 0 then
  488.   address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.fileName) || '#?'
  489. if verify(log.altFileName, '/:', 'M') = 0 then
  490.   address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.altFileName) || '#?'
  491. return
  492.  
  493. smNeedToRecordOut:
  494. 'playvoice' 'avm:voices/NeedToRecordOutgoing'
  495. a_=rc
  496. if 0 then nop
  497. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  498. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  499. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  500. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  501. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  502. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  503.  
  504. 'flushphonebuffer'
  505. return
  506.  
  507. smNeedToRecordIntro:
  508. 'playvoice' 'avm:voices/NeedToRecordIntro'
  509. a_=rc
  510. if 0 then nop
  511. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  512. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  513. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  514. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  515. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  516. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  517.  
  518. 'flushphonebuffer'
  519. return
  520.  
  521. smNeedToEnterTel:
  522. 'playvoice' 'avm:voices/NeedToEnterTel'
  523. a_=rc
  524. if 0 then nop
  525. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  526. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  527. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  528. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  529. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  530. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  531.  
  532. 'flushphonebuffer'
  533. return
  534.  
  535. editIntro:
  536. call aapresentmenu('avm:voices/EditIntro', '0123#*', '3')
  537. a_=result
  538. if 0 then nop
  539. else if a_='=0' then signal editIntro
  540. else if a_='=1' then do;log.altFileName = voiceFile(log.origMailbox, 'Introduction');end
  541. else if a_='=2' then do;log.altFileName = makeUniqueFile();end
  542. else if a_='=3' then do;call recordMessage(voiceFile(mailbox, log.altFileName));end
  543. else if a_='=#' then do;return;end
  544. else if a_='=*' then do;call cleanSendMessageTo(); signal answerVoiceDone;end
  545. else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
  546. else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
  547. else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
  548. else if a_=10 then do;call cleanSendMessageTo(); signal answerVoiceDone;end
  549. else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
  550. else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
  551. else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
  552. signal editIntro
  553.  
  554. smCanSend:
  555. if log.returnNumber = '' then do; call smNeedToEnterTel(); return 0; end
  556. if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then do; call smNeedToRecordOut(); return 0; end
  557. return 1
  558.  
  559.  
  560.  
  561. /* TITLE: avm:rexx/simplestdtail.avm */
  562. /* This is the standard tail */
  563. exit
  564.  
  565. exit
  566.  
  567. mailboxDir: procedure
  568.     parse arg mailbox
  569.  
  570.     return 'avmmbox:' || mailbox || '/'
  571.  
  572. logFile: procedure
  573.     parse arg mailbox, magiccookie
  574.  
  575.     return 'avmmbox:' || mailbox || '/logs/' || magiccookie
  576.  
  577. voiceFile: procedure
  578.     parse arg mailbox, magiccookie
  579.  
  580.         if (verify(magiccookie, '/:', 'M') = 0) then
  581.           return 'avmmbox:' || mailbox || '/voices/' || magiccookie
  582.         else
  583.           return magiccookie
  584.  
  585. makeUniqueFile: procedure
  586.     if arg() ~= 0 then do
  587.         rc = "makeUniqueFile: bad args"
  588.         signal error
  589.     end
  590.     return address() || '.' || date('i') || '.' || time('s') || '.' || random(1, 999, time('s'))
  591.  
  592. convertToDate: procedure
  593.     if arg() ~= 1 then do
  594.         rc = "convertToDate: bad args"
  595.         signal error
  596.     end
  597.     parse arg timeInC
  598.  
  599.     actualTime = (timeInC - (2922)*86400) // (86400)
  600.     actualDate = (timeInC - actualTime - 2922*86400) % 86400
  601.  
  602.     return actualDate /* returning it in 'internal' format */
  603.  
  604. convertToTime: procedure
  605.     if arg() ~= 1 then do
  606.         rc = "convertToTime: bad args"
  607.         signal error
  608.     end
  609.     parse arg timeInC
  610.     
  611.     actualTime = (timeInC - (2922)*86400) // (86400)
  612.  
  613.     return actualTime
  614.  
  615. cTime: procedure
  616.     /* 2922 = 8*365 + 2 */
  617.     /* 86400 = 24*60*60 */
  618.     return (date('i')+2922)*86400 + time('s')
  619.  
  620. /* this returns a handle that you must use after initializing log. */
  621. initLogEntry: procedure expose log.
  622.     if arg() ~= 0 then do
  623.         rc = "initLogEntry: bad args"
  624.         signal error
  625.     end
  626.     
  627.     drop log.
  628.         log. = ''
  629.  
  630.         acidname = getclip(address() || 'CIDNAME')
  631.         acidnumber = getclip(address() || 'CIDNUMBER')
  632.  
  633.     /* 2922 = 8*365 + 2 */
  634.     /* 86400 = 24*60*60 */
  635.     log.time = (date('i')+2922)*86400 + time('s')
  636.     log.cidname = acidname
  637.     log.cidnumber = acidnumber
  638.  
  639.     return
  640.  
  641. loadLogEntry: procedure expose log.
  642.     if arg() ~= 2 then do
  643.         rc = "loadLogEntry: bad args"
  644.         signal error
  645.     end
  646.     parse arg mailbox, handle
  647.  
  648.         drop log.
  649.         log. = ''
  650.  
  651.     if ~exists(mailboxDir(mailbox)) then do
  652.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  653.         return
  654.     end
  655.  
  656.     opened = open(handle, logFile(mailbox, handle), 'r')
  657.         if opened then do
  658.         call showDebugger('Loading entry' logFile(mailbox, handle))
  659.         do while ~eof(handle)
  660.             line = readln(handle)
  661.             parse upper var line variable '=' value
  662.             log.variable = value
  663.         end
  664.         call close(handle)
  665.     end; else call showDebugger('Could not load' logFile(mailbox, handle))
  666.     return
  667.  
  668. /* pass a handle here */
  669. saveLogEntry: procedure expose log.
  670.     if arg() ~= 2 then do
  671.         rc = "saveLogEntry: bad args"
  672.         signal error
  673.     end
  674.     parse arg mailbox, handle
  675.  
  676.     if ~exists(mailboxDir(mailbox)) then do
  677.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  678.         return
  679.     end
  680.  
  681.     opened = open(handle, logFile(mailbox, handle), 'w')
  682.  
  683.     if opened then do
  684.         call showDebugger('Saving entry' logFile(mailbox, handle))
  685.         call writeln(handle, 'TYPE=' || log.type)
  686.         call writeln(handle, 'TIME=' || log.time)
  687.         call writeln(handle, 'LENGTH=' || log.length)
  688.  
  689.         call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
  690.  
  691.         call writeln(handle, 'CIDNAME=' || log.cidname)
  692.         call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
  693.  
  694.         call writeln(handle, 'COMMENT=' || log.comment)
  695.  
  696.         call writeln(handle, 'FILENAME=' || log.filename)
  697.         call writeln(handle, 'ALTFILENAME=' || log.altfilename)
  698.  
  699.         call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
  700.         call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
  701.         call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
  702.  
  703.         call writeln(handle, 'RETURNRETRY=' || log.returnretry)
  704.         call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
  705.  
  706.         call close(handle)
  707.         address rexx 'broadcast' 'addtomailbox' mailbox handle
  708.     end; else call showDebugger('Could not save' logFile(mailbox, handle))
  709.  
  710.     return
  711.  
  712. /* pass a handle here */
  713. updateLogEntry: procedure expose log.
  714.     if arg() ~= 2 then do
  715.         rc = "updateLogEntry: bad args"
  716.         signal error
  717.     end
  718.     parse arg mailbox, handle
  719.  
  720.     if ~exists(mailboxDir(mailbox)) then do
  721.         call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
  722.         return
  723.     end
  724.  
  725.     if ~exists(logFile(mailbox, handle)) then do
  726.         call showDebugger('Unable to update non-existent' logFile(mailbox, handle))
  727.         return
  728.     end
  729.     opened = open(handle, logFile(mailbox, handle), 'w')
  730.  
  731.     if opened then do
  732.         call showDebugger('Updating entry' logFile(mailbox, handle))
  733.         call writeln(handle, 'TYPE=' || log.type)
  734.         call writeln(handle, 'TIME=' || log.time)
  735.         call writeln(handle, 'LENGTH=' || log.length)
  736.  
  737.         call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
  738.  
  739.         call writeln(handle, 'CIDNAME=' || log.cidname)
  740.         call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
  741.  
  742.         call writeln(handle, 'COMMENT=' || log.comment)
  743.  
  744.         call writeln(handle, 'FILENAME=' || log.filename)
  745.         call writeln(handle, 'ALTFILENAME=' || log.altfilename)
  746.  
  747.         call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
  748.         call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
  749.         call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
  750.  
  751.         call writeln(handle, 'RETURNRETRY=' || log.returnretry)
  752.         call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
  753.  
  754.         call close(handle)
  755.         address rexx 'broadcast' 'refreshmailboxentry' mailbox handle
  756.     end; else call showDebugger('Could not update' logFile(mailbox, handle))
  757.  
  758.     return
  759.  
  760.  
  761.  
  762. showDebugger: procedure
  763.     if arg() ~= 1 then do
  764.         say "showDebugger: ERROR"
  765.         exit 20
  766.     end
  767.  
  768.     parse arg debuggerInfo
  769.     
  770.     firstLine = sourceline(1)
  771.     parse var firstLine '/*' 'TITLE:' title '*/'
  772.     if showlist('p', 'AVMLOGGER') then
  773.         address 'AVMLOGGER' 'add' title ':' debuggerInfo
  774.     else
  775.         say title ':' debuggerInfo
  776.  
  777.     return 
  778.  
  779. /*-----------------------------------------------------------------------*/
  780. /*                         signal processing                             */
  781.  
  782. arexxerror:
  783. error:
  784.     call showDebugger("Error" rc "at line" sigl)
  785.     exit 20
  786.  
  787. break_c:
  788. halt:
  789.     call showDebugger("Halt/Break_C at line" sigl)
  790.     exit 20
  791.  
  792. novalue:
  793.     call showDebugger("No value at line" sigl)
  794.     exit 20
  795.  
  796. syntax:
  797.     call showDebugger("Syntax error" rc "at line" sigl)
  798.     exit 20
  799.  
  800. /* TITLE: avm:rexx/stdplayvoice.avm */
  801. stdPlayXX:
  802. procedure
  803. parse arg ret
  804.  
  805. rs.normal = 0
  806. rs.keydetected = 1
  807. rs.quietdetected = 2
  808. rs.silencedetected = 3
  809. rs.faxdetected = 4
  810. rs.datadetected = 5
  811. rs.busydetected = 8
  812. rs.timedout = 10
  813. rs.signaldetected = 12
  814. rs.overflow = 14
  815. rs.error = 16
  816. /* CB 0000 */
  817.  
  818. select
  819.   when ret=rs.faxdetected then signal stdfax
  820.   when ret=rs.datadetected then signal stddata
  821.   when ret=rs.busydetected then signal stdbusy
  822.   when ret=rs.signaldetected then signal stdabort
  823.   when ret=rs.overflow then signal stderror
  824.   when ret=rs.error then signal stderror
  825.   otherwise nop
  826. end
  827. return
  828.  
  829.  
  830. aapresentmenu:
  831. /* TITLE: avm:rexx/presentmenu.avm */
  832. procedure expose pmRetries pmTimesAround
  833. parse arg filename, valid, retries
  834. timesaround = retries
  835. pmTimesAround = timesaround
  836. pmRetries = retries
  837.  
  838. rs.normal = 0
  839. rs.keydetected = 1
  840. rs.quietdetected = 2
  841. rs.silencedetected = 3
  842. rs.faxdetected = 4
  843. rs.datadetected = 5
  844. rs.busydetected = 8
  845. rs.timedout = 10
  846. rs.signaldetected = 12
  847. rs.overflow = 14
  848. rs.error = 16
  849. /* CB 0000 */
  850.  
  851. aapresentmenuloop:
  852. 'playvoice' filename
  853. a_=rc
  854. if 0 then nop
  855. else if a_=4 then do;return rs.faxdetected;end
  856. else if a_=5 then do;return rs.datadetected;end
  857. else if a_=8 then do;return rs.busydetected;end
  858. else if a_=12 then do;return rs.signaldetected;end
  859. else if a_=14 then do;return rs.error;end
  860. else if a_=16 then do;return rs.error;end
  861.  
  862. 'readnkeys' '1' '5'
  863. a_=rc
  864. if a_=0 then value=result
  865. if 0 then nop
  866. else if a_=0 then signal aapresentmenuvalue
  867. else if a_=4 then do;return rs.faxdetected;end
  868. else if a_=5 then do;return rs.datadetected;end
  869. else if a_=8 then do;return rs.busydetected;end
  870. else if a_=10 then signal aapresentmenutimeout
  871. else if a_=12 then do;return rs.signaldetected;end
  872. else if a_=14 then do;return rs.error;end
  873. else if a_=16 then do;return rs.error;end
  874. return rs.error
  875.  
  876. aapresentmenutimeout:
  877. 'flushphonebuffer'
  878.  
  879. 'playvoice' 'avm:voices/TimedOut'
  880. a_=rc
  881. if 0 then nop
  882. else if a_=4 then do;return rs.faxdetected;end
  883. else if a_=5 then do;return rs.datadetected;end
  884. else if a_=8 then do;return rs.busydetected;end
  885. else if a_=12 then do;return rs.signaldetected;end
  886. else if a_=14 then do;return rs.error;end
  887. else if a_=16 then do;return rs.error;end
  888.  
  889. timesaround = timesaround - 1; pmTimesAround = timesaround
  890. if timesaround <= 0 then return rs.timedout
  891. signal aapresentmenuloop
  892.  
  893. aapresentmenuvalue:
  894. if pos(value, valid) = 0 then signal aainvalid
  895. return '=' || value
  896.  
  897. aainvalid:
  898. 'flushphonebuffer'
  899.  
  900. 'playvoice' 'avm:voices/BadChoice'
  901. a_=rc
  902. if 0 then nop
  903. else if a_=4 then do;return rs.faxdetected;end
  904. else if a_=5 then do;return rs.datadetected;end
  905. else if a_=8 then do;return rs.busydetected;end
  906. else if a_=12 then do;return rs.signaldetected;end
  907. else if a_=14 then do;return rs.error;end
  908. else if a_=16 then do;return rs.error;end
  909.  
  910. timesaround = timesaround - 1; pmTimesAround = timesaround
  911. if timesaround <= 0 then return rs.timedout
  912. signal aapresentmenuloop
  913.  
  914.  
  915. stdabort:
  916. exit
  917.  
  918. stdbusy:
  919. exit
  920.  
  921. stderror:
  922. exit
  923.  
  924. stdtimedout:
  925. exit
  926.  
  927. stdfaxinstruct:
  928. 'playvoice' 'avm:voices/FaxStarting'
  929. a_=rc
  930. if 0 then nop
  931. else if a_=1 then do;call checkifabort;end
  932. else if a_=8 then signal stdbusy
  933. else if a_=12 then signal stdabort
  934.  
  935. stdfax:
  936. faxscript = getclip(address() || 'FAXSCRIPT')
  937. if faxscript = '' then faxscript = 'handlefax'
  938. if symbol('mailbox') = 'VAR' then address rexx faxscript address() mailbox
  939. else address rexx faxscript address() 'anonymous'
  940. exit
  941.  
  942. stddatainstruct:
  943. 'playvoice' 'avm:voices/DataStarting'
  944. a_=rc
  945. if 0 then nop
  946. else if a_=1 then do;call checkifabort;end
  947. else if a_=8 then signal stdbusy
  948. else if a_=12 then signal stdabort
  949.  
  950. stddata:
  951. datascript = getclip(address() || 'DATASCRIPT')
  952. if datascript = '' then datascript = 'handledata'
  953. if symbol('mailbox') = 'VAR' then address rexx datascript address() mailbox
  954. else address rexx datascript address()
  955. exit
  956.  
  957. checkifabort:
  958. 'readnkeys' '1' '3'
  959. a_=rc
  960. if a_=0 then value=result
  961. if 0 then nop
  962. else if a_=0 then do;if value = '*' then signal stdabort;end
  963. else if a_=8 then signal stdbusy
  964. else if a_=12 then signal stdabort
  965. else if a_=14 then signal stderror
  966. else if a_=16 then signal stderror
  967. return
  968.  
  969.  
  970. /* TITLE: avm:rexx/maintenancemodetail.avm */
  971. /* TITLE: avm:rexx/getnumber.avm */
  972. getnumber:
  973. procedure
  974.  
  975. aagetnumberagain:
  976. 'playvoice' 'avm:voices/GetNumber'
  977. call stdPlayXX(rc)
  978.  
  979. 'readkeysuntil' '#' '15' '7'
  980. a_=rc
  981. if a_=0 then value=result
  982. if 0 then nop
  983. else if a_=0 then do;number = value;end
  984. else if a_=4 then signal stdfax
  985. else if a_=5 then signal stddata
  986. else if a_=8 then signal stdbusy
  987. else if a_=10 then do;number = '';end
  988. else if a_=12 then signal stdabort
  989. else if a_=14 then signal stderror
  990. else if a_=16 then signal stderror
  991.  
  992. 'playvoice' 'avm:voices/NumberEntered'
  993. call stdPlayXX(rc)
  994.  
  995. call playNumber(number)
  996.  
  997. aagetnumbermenu:
  998. call aapresentmenu('avm:voices/numbercorrect', '02#*', '3')
  999. a_=result
  1000. if 0 then nop
  1001. else if a_='=0' then signal aagetnumbermenu
  1002. else if a_='=2' then signal aagetnumberagain
  1003. else if a_='=#' then signal aagetnumberdone
  1004. else if a_='=*' then signal answerVoiceDone
  1005. else if a_=4 then signal stdfax
  1006. else if a_=5 then signal stddata
  1007. else if a_=8 then signal stdbusy
  1008. else if a_=10 then do;number = ''; signal aagetnumberdone;end
  1009. else if a_=12 then signal stdabort
  1010. else if a_=14 then signal stderror
  1011. else if a_=16 then signal stderror
  1012.  
  1013. aagetnumberdone:
  1014. /* We're done.  Number is in 'number' */
  1015.  
  1016. return number
  1017.  
  1018.  
  1019. /* TITLE: avm:rexx/playnumber.avm */
  1020. playnumber:
  1021. /* Cycle through value and play each symbol */
  1022.  
  1023. procedure
  1024. parse arg number
  1025.  
  1026. do i = 1 to length(number)
  1027.   if pos(substr(number, i, 1), '0123456789') > 0 then
  1028.     call playAVoice('avm:voices/number0'||substr(number, i, 1))
  1029.   else if substr(number, i, 1) = '#' then
  1030.     call playAVoice('avm:voices/numberpound')
  1031.   else if substr(number, i, 1) = '*' then
  1032.     call playAVoice('avm:voices/numberstar')
  1033. end
  1034. return
  1035.  
  1036. playAVoice:
  1037. procedure
  1038. parse arg filename
  1039.  
  1040. 'playvoice' filename
  1041. call stdPlayXX(rc)
  1042. return
  1043.  
  1044.  
  1045. /* TITLE: avm:rexx/playddnumber.avm */
  1046. playddnumber:
  1047. /* We're going to play a double digit number */
  1048.  
  1049. procedure
  1050. parse arg number
  1051. directdd = getclip('AVMDirectDDNumber')
  1052. if upper(directdd) = 'YES' then signal playdirectdd
  1053.  
  1054. if number > 9 & number < 20 then
  1055.   call playANumber(number)
  1056. else if number >= 20 & number < 60 then do
  1057.   units = number // 10
  1058.   tens = number - units
  1059.   call playANumber(tens)
  1060.   if units > 0 then call playnumber(units)
  1061. end; else
  1062.   call playnumber(number+0)
  1063. return
  1064.  
  1065. playdirectdd:
  1066. if number < 10 then call playnumber(number+0)
  1067. else call playANumber(number)
  1068. return
  1069.  
  1070. playANumber:
  1071. procedure
  1072. parse arg number
  1073. numToPlay = 'avm:voices/number' || number
  1074.  
  1075. 'playvoice' numToPlay
  1076. call stdPlayXX(rc)
  1077. return
  1078.  
  1079.  
  1080. /* TITLE: avm:rexx/playtime.avm */
  1081. playtime:
  1082. procedure
  1083. parse arg secs
  1084. hours = secs % (60*60)
  1085. minutes = (secs - (hours * 60 * 60)) % 60
  1086. if hours < 12 then pm = 0
  1087. else do; pm = 1; hours = hours - 12; end
  1088. if hours = 0 then hours = 12
  1089. timeformat = getclip('AVMTimeFormat')
  1090. if timeformat = "" then timeformat = '%hours12 %minutes %pm'
  1091.  
  1092. do i = 1 to words(timeformat)
  1093.   if upper(word(timeformat, i)) = '%HOURS12' then
  1094.     call playddnumber(hours)
  1095.   else if upper(word(timeformat, i)) = '%HOURS24' then
  1096.     call playddnumber(hours + (pm * 12))
  1097.   else if upper(word(timeformat, i)) = '%MINUTES' then
  1098.     call playddnumber(minutes)
  1099.   else if upper(word(timeformat, i)) = '%PM' then
  1100.     do
  1101.  
  1102.       if pm then call playAVoice('avm:voices/timepm')
  1103.       else call playAVoice('avm:voices/timeam')
  1104.     end
  1105.   else
  1106.     call playAVoice(word(timeformat, i))
  1107. end
  1108.  
  1109. /* We're done */
  1110. return
  1111.  
  1112.  
  1113. /* TITLE: avm:rexx/playdate.avm */
  1114. playdate:
  1115. /* We're going to play the month and day */
  1116.  
  1117. procedure
  1118. parse arg actualDate
  1119.  
  1120. dateformat = getclip('AVMDateFormat')
  1121. if dateformat = "" then dateformat = "%month %day"
  1122. else if upper(dateformat) = "NONE" then dateformat = ""
  1123.  
  1124. do i = 1 to words(dateformat)
  1125.   if upper(word(dateformat, i)) = "%MONTH" then
  1126.     call playAVoice('avm:voices/month'||numberToMonth(substr(actualDate, 5, 2)+0))
  1127.   else if upper(word(dateformat, i)) = "%DAY" then
  1128.     call playddnumber(substr(actualDate, 7, 2))
  1129.   else
  1130.     call playAVoice(word(dateformat, i))
  1131. end
  1132.  
  1133. /* We're done */
  1134. return
  1135.  
  1136. numberToMonth:
  1137. procedure
  1138. parse arg m
  1139. m_.1='january';m_.2='february';m_.3='march'
  1140. m_.4='april';m_.5='may';m_.6='june'
  1141. m_.7='july';m_.8='august';m_.9='september'
  1142. m_.10='october';m_.11='november';m_.12='december'
  1143. return m_.m
  1144.  
  1145.  
  1146. /* TITLE: avm:rexx/recordmessage.avm */
  1147. recordmessage:
  1148. procedure
  1149. parse arg filename
  1150.  
  1151. recordmessagesagain:
  1152. call aapresentmenu('avm:voices/RecordMessage', '0123#*', '3')
  1153. a_=result
  1154. if 0 then nop
  1155. else if a_='=0' then signal recordmessageagain
  1156. else if a_='=1' then signal recordmessagesplay
  1157. else if a_='=2' then signal recordmessagesrecord
  1158. else if a_='=3' then signal recordmessagesdelete
  1159. else if a_='=#' then do;nop;end
  1160. else if a_='=*' then signal answerVoiceDone
  1161. else if a_=4 then signal stdfax
  1162. else if a_=5 then signal stddata
  1163. else if a_=8 then signal stdbusy
  1164. else if a_=10 then signal answerVoiceDone
  1165. else if a_=12 then signal stdabort
  1166. else if a_=14 then signal stderror
  1167. else if a_=16 then signal stderror
  1168. return
  1169.  
  1170. recordmessagesplay:
  1171. 'playbeep' '3000' '0' '4'
  1172. call stdPlayXX(rc)
  1173.  
  1174. 'playvoice' filename
  1175. a_=rc
  1176. if 0 then nop
  1177. else if a_=4 then signal stdfax
  1178. else if a_=5 then signal stddata
  1179. else if a_=8 then signal stdbusy
  1180. else if a_=12 then signal stdabort
  1181.  
  1182. 'flushphonebuffer'
  1183.  
  1184. 'playbeep' '3000' '0' '4'
  1185. call stdPlayXX(rc)
  1186. signal recordmessagesagain
  1187.  
  1188. recordmessagesrecord:
  1189. 'playvoice' 'avm:voices/RecordMessagesRecord'
  1190. call stdPlayXX(rc)
  1191.  
  1192. 'playbeep' '3000' '0' '4'
  1193. call stdPlayXX(rc)
  1194.  
  1195. 'recordvoice' '0' '-1' '30' filename
  1196. a_=rc
  1197. if 0 then nop
  1198. else if a_=4 then signal stdfax
  1199. else if a_=5 then signal stddata
  1200. else if a_=8 then signal stdbusy
  1201. else if a_=12 then signal stdabort
  1202. else if a_=14 then signal stderror
  1203. else if a_=16 then signal stderror
  1204.  
  1205. 'flushphonebuffer'
  1206.  
  1207. 'playbeep' '3000' '0' '4'
  1208. call stdPlayXX(rc)
  1209. signal recordmessagesagain
  1210.  
  1211. recordmessagesdelete:
  1212. address command 'delete >nil: <nil: quiet' filename
  1213. signal recordmessagesagain
  1214.  
  1215.  
  1216.  
  1217. exit
  1218.  
  1219. /* this requires logfunctions.avm */
  1220.  
  1221. loadMailbox: procedure expose mailbox.
  1222.     if arg() ~= 1 then do
  1223.         rc = "loadMailbox: bad args"
  1224.         signal error
  1225.     end
  1226.  
  1227.         mailbox. = ''
  1228.     parse arg mailbox
  1229.  
  1230.     handle = 'mailboxconfig'
  1231.     opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'r')
  1232.     if opened then do
  1233.         do while ~eof(handle)
  1234.             line = readln(handle)
  1235.             parse upper var line variable '=' value
  1236.             mailbox.variable = value
  1237.         end
  1238.         call close(handle)
  1239.     end
  1240.     return
  1241.  
  1242. /* pass a handle here */
  1243. saveMailbox: procedure expose mailbox.
  1244.     if arg() ~= 1 then do
  1245.         rc = "saveMailbox: bad args"
  1246.         signal error
  1247.     end
  1248.     parse arg mailbox
  1249.  
  1250.     handle = 'mailboxconfig'
  1251.     opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'w')
  1252.  
  1253.     if opened then do
  1254.         call writeln(handle, 'PASSWORD=' || mailbox.password)
  1255.  
  1256.         call writeln(handle, 'AUTOFAXFORWARDB=' || mailbox.autofaxforwardb)
  1257.         call writeln(handle, 'AUTOFAXFORWARD=' || mailbox.autofaxforward)
  1258.         call writeln(handle, 'AUTOFAXFORWARDSCRIPT=' || mailbox.autofaxforwardscript)
  1259.  
  1260.         call writeln(handle, 'AUTOFORWARDB=' || mailbox.autoforwardb)
  1261.         call writeln(handle, 'AUTOFORWARDONDEMAND=' || mailbox.autoforwardondemand)
  1262.         call writeln(handle, 'AUTOFORWARD=' || mailbox.autoforward)
  1263.         call writeln(handle, 'AUTOFORWARDSCRIPT=' || mailbox.autoforwardscript)
  1264.  
  1265.         call writeln(handle, 'AUTOPAGEB=' || mailbox.autopageb)
  1266.         call writeln(handle, 'AUTOPAGEONDEMAND=' || mailbox.autopageondemand)
  1267.         call writeln(handle, 'AUTOPAGE=' || mailbox.autopage)
  1268.         call writeln(handle, 'AUTOPAGESCRIPT=' || mailbox.autopagescript)
  1269.  
  1270.         call writeln(handle, 'AUTOALERTB=' || mailbox.autoalertb)
  1271.         call writeln(handle, 'AUTOALERTONDEMAND=' || mailbox.autoalertondemand)
  1272.         call writeln(handle, 'AUTOALERTSCRIPT=' || mailbox.autoalertscript)
  1273.  
  1274.         call close(handle)
  1275.     end
  1276.  
  1277.     return
  1278.  
  1279. /* TITLE: avm:rexx/getpassword.avm */
  1280. /* This is a procedure which accepts 1 argument, a password */
  1281.  
  1282. getpassword:
  1283. procedure
  1284. parse arg password
  1285. count = 3 /* max of 3 times */
  1286. if password = '' then return 1
  1287.  
  1288. getpasswordagain:
  1289. count = count - 1
  1290. if count = 0 then return 0 /* didn't get a good password */
  1291.  
  1292. 'playvoice' 'avm:voices/getpassword'
  1293. call stdPlayXX(rc)
  1294.  
  1295. 'readkeysuntil' '#' '10' '7'
  1296. a_=rc
  1297. if a_=0 then value=result
  1298. if 0 then nop
  1299. else if a_=0 then signal getpasskeydetected
  1300. else if a_=4 then signal stdfax
  1301. else if a_=5 then signal stddata
  1302. else if a_=8 then signal stdbusy
  1303. else if a_=12 then signal stdabort
  1304. else if a_=14 then signal stderror
  1305. else if a_=16 then signal stderror
  1306.  
  1307. 'playvoice' 'avm:voices/passwordtimeout'
  1308. call stdPlayXX(rc)
  1309. signal getpasswordagain
  1310.  
  1311. getpasskeydetected:
  1312. if value = password then return 1
  1313.  
  1314. 'playvoice' 'avm:voices/passwordbad'
  1315. call stdPlayXX(rc)
  1316. signal getpasswordagain
  1317.  
  1318.  
  1319.