home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-19 | 36.2 KB | 1,319 lines |
- /* TITLE: avm:rexx/maintenancemode.avm */
- /* we want results! Otherwise, we wouldn't get anything from RESULT */
- options results
-
- /* Need to make sure that stdtail.avm is also included */
- signal on halt
- signal on novalue
- signal on syntax
- signal on break_c
-
- /* needed for some of the functions we use */
- call addlib("rexxsupport.library", 0, -30, 0)
-
- /* a higher than normal priority since calls are important to us :) */
- call pragma('priority', 1)
-
-
- parse arg mailbox .
-
- call loadMailbox(mailbox)
- good = getPassword(mailbox.password)
- if good = 0 then signal answerVoiceDone
-
- logsthis = words(showdir(logFile(mailbox, '')))
- logsanonymous = words(showdir(logFile('anonymous', '')))
- if upper(mailbox) = 'ANONYMOUS' then logsanonymous = 0
-
- if logsthis > 0 then call sayCountEntries(logsthis, 0)
- if logsanonymous > 0 then call sayCountEntries(logsanonymous, 1)
-
- maintenanceModeAgain:
- call aapresentmenu('avm:voices/maintenancemode', '01234567#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal maintenanceModeAgain
- else if a_='=1' then do;call retrievemessages(mailbox);end
- else if a_='=2' then do;call recordMessage(voiceFile(mailbox, 'Personal'));end
- else if a_='=3' then do;call changeintrooptions();end
- else if a_='=4' then do;call changepassword();end
- else if a_='=5' then do;call sendMessageTo('Outgoing', mailbox, '', makeUniqueFile(), 'Voice', voiceFile(mailbox, 'Introduction'), '', '');end
- else if a_='=6' then do;call changeautooptions(mailbox);end
- else if a_='=7' then do;call aaretrievemessages('Outgoing', 1, mailbox);end
- else if a_='=#' then do;return 1;end
- else if a_='=*' then signal answervoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal maintenanceModeAgain
-
- retrievemessages:
- procedure
- parse arg mailbox .
- call aaretrievemessages(mailbox, 0, mailbox)
-
- if upper(mailbox) = 'ANONYMOUS' then return
-
- 'playvoice' 'avm:voices/retrieveanonymous'
- call stdPlayXX(rc)
-
- call aaretrievemessages('Anonymous', 0, mailbox)
-
- 'playvoice' 'avm:voices/backhome'
- call stdPlayXX(rc)
- return
-
- changepassword:
- number = getNumber()
- if number ~= '' then do
- mailbox.password = number
- call saveMailbox(mailbox)
- end
- return
-
- sayCountEntries:
- parse arg count, inAnon
- if count = 1 & inAnon then signal say1Anon
- else if count = 1 & inAnon = 0 then signal say1This
-
- sayCountMultiple:
- 'playvoice' 'avm:voices/ThereAre'
- call stdPlayXX(rc)
-
- call playddnumber(count)
- if inAnon then signal sayCountAnon
- else signal sayCountThis
-
- sayCountAnon:
- 'playvoice' 'avm:voices/InAnonMailbox'
- call stdPlayXX(rc)
- return
-
- sayCountThis:
- 'playvoice' 'avm:voices/InThisMailbox'
- call stdPlayXX(rc)
- return
-
- say1Anon:
- 'playvoice' 'avm:voices/OneInAnonMailbox'
- call stdPlayXX(rc)
- return
-
- say1This:
- 'playvoice' 'avm:voices/OneInThisMailbox'
- call stdPlayXX(rc)
- return
-
- changeintrooptions:
- call aapresentmenu('avm:voices/changeintrooptions', '012345#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal changeintrooptions
- else if a_='=1' then do;call setclip('AVMIntroductionType', 'DAYOFWEEK');end
- else if a_='=2' then do;call setclip('AVMIntroductionType', 'TIMEOFDAY');end
- else if a_='=3' then do;call setclip('AVMIntroductionType', 'RANDOM');end
- else if a_='=4' then do;call changetomanual();end
- else if a_='=5' then do;call recordintro();end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answervoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal changeintrooptions
-
- changetomanual:
- call aapresentmenu('avm:voices/selectmanualintro', '01234567#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal changetomanual
- else if a_='=1' then do;call setclip('AVMIntroductionType', '1');end
- else if a_='=2' then do;call setclip('AVMIntroductionType', '2');end
- else if a_='=3' then do;call setclip('AVMIntroductionType', '3');end
- else if a_='=4' then do;call setclip('AVMIntroductionType', '4');end
- else if a_='=5' then do;call setclip('AVMIntroductionType', '5');end
- else if a_='=6' then do;call setclip('AVMIntroductionType', '6');end
- else if a_='=7' then do;call setclip('AVMIntroductionType', '7');end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answervoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal changetomanual
-
- recordintro:
- call aapresentmenu('avm:voices/recordintro', '01234567#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal recordintro
- else if a_='=1' then do;call recordmessage('avm:voices/intro1');end
- else if a_='=2' then do;call recordmessage('avm:voices/intro2');end
- else if a_='=3' then do;call recordmessage('avm:voices/intro3');end
- else if a_='=4' then do;call recordmessage('avm:voices/intro4');end
- else if a_='=5' then do;call recordmessage('avm:voices/intro5');end
- else if a_='=6' then do;call recordmessage('avm:voices/intro6');end
- else if a_='=7' then do;call recordmessage('avm:voices/intro7');end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answervoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal recordintro
-
- changeautooptions:
- procedure
- parse arg mailbox .
- call loadMailbox(mailbox)
-
- changeautomenu:
- call aapresentmenu('avm:voices/ChangeAutoOptions', '0123#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal changeautomenu
- else if a_='=1' then do;call editautooptions('AUTOFORWARDB', 'AUTOFORWARDONDEMAND', 'AUTOFORWARD', 'AUTOFORWARDANNOUNCE');end
- else if a_='=2' then do;call editautooptions('AUTOFAXFORWARDB', '', 'AUTOFAXFORWARD', '');end
- else if a_='=3' then do;call editautooptions('AUTOPAGEB', 'AUTOPAGEONDEMAND', 'AUTOPAGE', '');end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answerVoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal changeautomenu
-
- editautooptions:
- procedure expose mailbox. mailbox
- parse arg isOn, onDemand, telNumber, announce
- call showAutoOptions
-
- editautomenu:
- call aapresentmenu('avm:voices/AutoOptions', '01234567#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal editautomenu
- else if a_='=1' then do;mailbox.isOn = 1; call saveMailbox(mailbox);end
- else if a_='=2' then do;mailbox.isOn = 0; call saveMailbox(mailbox);end
- else if a_='=3' then do;mailbox.telNumber = getNumber(); call saveMailbox(mailbox);end
- else if a_='=4' then do;if onDemand ~= '' then do; mailbox.onDemand = getNumber(); call saveMailbox(mailbox); end;end
- else if a_='=5' then do;if announce ~= '' then do; mailbox.announce = 1; call saveMailbox(mailbox); end;end
- else if a_='=6' then do;if announce ~= '' then do; mailbox.announce = 0; call saveMailbox(mailbox); end;end
- else if a_='=7' then do;call showAutoOptions();end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answerVoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal editautomenu
-
- showautooptions:
- if mailbox.isOn = 1 then call autoIsOn(); else call autoIsOff()
- if onDemand ~= '' then call autoOnDemand(mailbox.onDemand)
- call autoTelNumber(mailbox.telNumber)
- if announce ~= '' then
- if mailbox.announce = 1 then call announceIsOn(); else call announceIsOff()
- return
-
- autoIsOn:
- 'playvoice' 'avm:voices/AutoIsOn'
- call stdPlayXX(rc)
-
- 'flushphonebuffer'
- return
-
- autoIsOff:
- 'playvoice' 'avm:voices/autoIsOff'
- call stdPlayXX(rc)
-
- 'flushphonebuffer'
- return
-
- announceIsOn:
- 'playvoice' 'avm:voices/AnnounceIsOn'
- call stdPlayXX(rc)
-
- 'flushphonebuffer'
- return
-
- announceIsOff:
- 'playvoice' 'avm:voices/AnnounceIsOff'
- call stdPlayXX(rc)
-
- 'flushphonebuffer'
- return
-
- autoOnDemand:
- procedure
- parse arg number
-
- 'playvoice' 'avm:voices/AutoOnDemand'
- call stdPlayXX(rc)
-
- call playNumber(number)
-
- 'flushphonebuffer'
- return
-
- autoTelNumber:
- procedure
- parse arg number
-
- 'playvoice' 'avm:voices/AutoTelNumber'
- call stdPlayXX(rc)
-
- call playNumber(number)
-
- 'flushphonebuffer'
- return
-
- answerVoiceDone:
- 'playvoice' 'avm:voices/Goodbye'
- call stdPlayXX(rc)
- exit
-
- /* TITLE: avm:rexx/retrievemessages.avm */
- aaretrievemessages:
- procedure
- parse arg mailbox, isOutgoing, whichMailbox
-
- logs = showdir(logFile(mailbox, ''))
- numlogs = words(logs)
- currentlog = 1
-
- retrievemessagesnext:
- if currentlog > numlogs then signal retrievemessagesdone
- currentHandle = word(logs, currentLog)
- call loadLogEntry(mailbox, currentHandle)
- if (isOutgoing & ( log.returnRetry = '' | log.returnRetry = 0 | (upper(log.origMailbox) ~= upper(whichMailbox) & upper(log.origMailbox) ~= 'ANONYMOUS'))) then do
- currentLog = currentLog + 1
- signal retrieveMessagesNext
- end
-
- retrievemessagesagain:
- logtype = upper(log.type)
- if logtype = 'FAX' then signal isfax
- else if logtype = 'VOICE' then signal isvoice
- else signal isunknown
-
- isfax:
- 'playvoice' 'avm:voices/FaxMessage'
- call stdPlayXX(rc)
- signal aftertype
-
- isvoice:
- 'playbeep' '3000' '0' '4'
- a_=rc
- if 0 then nop
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
-
- 'playvoice' voiceFile(mailbox, log.filename)
- a_=rc
- if 0 then nop
- else if a_=12 then signal stdabort
-
- 'flushphonebuffer'
-
- 'playbeep' '3000' '0' '4'
- a_=rc
- if 0 then nop
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal aftertype
-
- isunknown:
- 'playvoice' 'avm:voices/UnknownMessage'
- call stdPlayXX(rc)
- signal aftertype
-
- aftertype:
- call aapresentmenu('avm:voices/RetrieveMessages', '012345678#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal aftertype
- else if a_='=1' then signal retrievemessagesagain
- else if a_='=2' then do;call playtimedate();end
- else if a_='=3' then do;call playtelcidnumber();end
- else if a_='=4' then signal processNextMessage
- else if a_='=5' then do;address rexx 'delete' mailbox currentHandle; signal processNextMessage;end
- else if a_='=6' then do;if isOutgoing = 0 then address rexx 'archive' mailbox currentHandle; else address rexx 'archiveoutgoing' mailbox currentHandle; signal processNextMessage;end
- else if a_='=7' then do;call forwardmessage(mailbox, currentHandle);end
- else if a_='=8' then do;call replymessage(mailbox, currentHandle);end
- else if a_='=#' then do;return;end
- else if a_='=*' then signal answervoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- signal aftertype
-
- processNextMessage:
- currentLog = currentLog + 1
- signal retrievemessagesnext
-
- playtimedate:
- actualTime = convertToTime(log.time)
- actualDate = convertToDate(log.time)
- call playTime(actualTime)
- actualDate = date('s', actualDate) /* convert to sorted */
- call playDate(actualDate)
-
- 'flushphonebuffer'
-
- return
-
- playtelcidnumber:
- 'playvoice' 'avm:voices/cidnumber'
- call stdPlayXX(rc)
-
- if symbol('log.cidnumber') = 'VAR' then
- call playNumber(log.cidnumber)
-
- 'flushphonebuffer'
-
- 'playvoice' 'avm:voices/returnnumber'
- call stdPlayXX(rc)
-
- if symbol('log.returnnumber') = 'VAR' then
- call playNumber(log.returnnumber)
-
- 'flushphonebuffer'
- return
-
- retrievemessagesdone:
- 'playvoice' 'avm:voices/NoMoreMessages'
- call stdPlayXX(rc)
- return
-
- replyMessage:
- procedure
- parse arg mailbox, magicCookie
- call loadLogEntry(mailbox, magicCookie)
- number = log.returnNumber
- if number = '' then number = log.cidNumber
- handle = makeUniqueFile()
- sent = sendMessageTo('Outgoing', mailbox, number, handle, 'Voice', voiceFile(mailbox, 'Introduction'), log.cidNumber, log.cidName)
-
- return
-
- forwardMessage:
- procedure
- parse arg mailbox, magicCookie
- call loadLogEntry(mailbox, magicCookie)
-
- if verify(log.fileName, '/:', 'M') = 0 then
- address command 'copy >nil: <nil:' voiceFile(mailbox, log.fileName) || '#?' voiceFile('Outgoing', '')
- sent = sendMessageTo('Outgoing', mailbox, '', log.fileName, log.type, voiceFile(mailbox, 'Introduction'), log.cidName, log.cidNumber)
- return
-
- /* TITLE: avm:rexx/sendmessageto.avm */
- sendMessageTo:
- procedure
- parse arg mailbox, originMailbox, number, actualFilename, fileType, introFileName, acidName, acidNumber
- handle = makeUniqueFile()
- call initLogEntry()
- log.returnNumber = number
- log.filename = actualFilename
- log.type = fileType; log.returnSendFunc = 'DefaultSender'
- log.returnRetry = 3; log.returnInterval = 5
- log.origMailbox = originMailbox
- log.altFileName = introFileName; log.cidName = acidName; log.cidNumber = acidNumber
-
- if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then call smNeedToRecordOut
- if ~exists(voiceFile(mailbox, log.altFileName)) then call smNeedToRecordIntro
- if log.returnNumber = '' then do; call smNeedToEnterTel(); signal sendMessageToMenu; end
-
- 'playvoice' 'avm:voices/numberToSendTo'
- a_=rc
- if 0 then nop
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
-
- call playNumber(log.returnNumber)
-
- 'flushphonebuffer'
-
- sendMessageToMenu:
- call aapresentmenu('avm:voices/editSendMessage', '01234#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal sendMessageToMenu
- else if a_='=1' then do;call playNumber(log.returnNumber); log.returnNumber = getNumber(); signal sendMessageToMenu;end
- else if a_='=2' then do;if upper(log.type) = 'VOICE' then call recordMessage(voiceFile(mailbox, log.filename)); signal sendMessageToMenu;end
- else if a_='=3' then do;call editIntro(); signal sendMessageToMenu;end
- else if a_='=4' then do;if smCanSend() then do; call saveLogEntry(mailbox, handle); return 1; end; else signal sendMessageToMenu;end
- else if a_='=#' then do;call cleanSendMessageTo(); return 0;end
- else if a_='=*' then do;call cleanSendMessageTo(); signal answerVoiceDone;end
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=10 then do;call cleanSendMessageTo(); signal answerVoiceDone;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
- call cleanSendMessageTo(); return 0
-
- cleanSendMessageTo:
- if verify(log.fileName, '/:', 'M') = 0 then
- address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.fileName) || '#?'
- if verify(log.altFileName, '/:', 'M') = 0 then
- address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.altFileName) || '#?'
- return
-
- smNeedToRecordOut:
- 'playvoice' 'avm:voices/NeedToRecordOutgoing'
- a_=rc
- if 0 then nop
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
-
- 'flushphonebuffer'
- return
-
- smNeedToRecordIntro:
- 'playvoice' 'avm:voices/NeedToRecordIntro'
- a_=rc
- if 0 then nop
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
-
- 'flushphonebuffer'
- return
-
- smNeedToEnterTel:
- 'playvoice' 'avm:voices/NeedToEnterTel'
- a_=rc
- if 0 then nop
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
-
- 'flushphonebuffer'
- return
-
- editIntro:
- call aapresentmenu('avm:voices/EditIntro', '0123#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal editIntro
- else if a_='=1' then do;log.altFileName = voiceFile(log.origMailbox, 'Introduction');end
- else if a_='=2' then do;log.altFileName = makeUniqueFile();end
- else if a_='=3' then do;call recordMessage(voiceFile(mailbox, log.altFileName));end
- else if a_='=#' then do;return;end
- else if a_='=*' then do;call cleanSendMessageTo(); signal answerVoiceDone;end
- else if a_=4 then do;call cleanSendMessageTo(); signal stdfax;end
- else if a_=5 then do;call cleanSendMessageTo(); signal stddata;end
- else if a_=8 then do;call cleanSendMessageTo(); signal stdbusy;end
- else if a_=10 then do;call cleanSendMessageTo(); signal answerVoiceDone;end
- else if a_=12 then do;call cleanSendMessageTo(); signal stdabort;end
- else if a_=14 then do;call cleanSendMessageTo(); signal stderror;end
- else if a_=16 then do;call cleanSendMessageTo(); signal stderror;end
- signal editIntro
-
- smCanSend:
- if log.returnNumber = '' then do; call smNeedToEnterTel(); return 0; end
- if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then do; call smNeedToRecordOut(); return 0; end
- return 1
-
-
-
- /* TITLE: avm:rexx/simplestdtail.avm */
- /* This is the standard tail */
- exit
-
- exit
-
- mailboxDir: procedure
- parse arg mailbox
-
- return 'avmmbox:' || mailbox || '/'
-
- logFile: procedure
- parse arg mailbox, magiccookie
-
- return 'avmmbox:' || mailbox || '/logs/' || magiccookie
-
- voiceFile: procedure
- parse arg mailbox, magiccookie
-
- if (verify(magiccookie, '/:', 'M') = 0) then
- return 'avmmbox:' || mailbox || '/voices/' || magiccookie
- else
- return magiccookie
-
- makeUniqueFile: procedure
- if arg() ~= 0 then do
- rc = "makeUniqueFile: bad args"
- signal error
- end
- return address() || '.' || date('i') || '.' || time('s') || '.' || random(1, 999, time('s'))
-
- convertToDate: procedure
- if arg() ~= 1 then do
- rc = "convertToDate: bad args"
- signal error
- end
- parse arg timeInC
-
- actualTime = (timeInC - (2922)*86400) // (86400)
- actualDate = (timeInC - actualTime - 2922*86400) % 86400
-
- return actualDate /* returning it in 'internal' format */
-
- convertToTime: procedure
- if arg() ~= 1 then do
- rc = "convertToTime: bad args"
- signal error
- end
- parse arg timeInC
-
- actualTime = (timeInC - (2922)*86400) // (86400)
-
- return actualTime
-
- cTime: procedure
- /* 2922 = 8*365 + 2 */
- /* 86400 = 24*60*60 */
- return (date('i')+2922)*86400 + time('s')
-
- /* this returns a handle that you must use after initializing log. */
- initLogEntry: procedure expose log.
- if arg() ~= 0 then do
- rc = "initLogEntry: bad args"
- signal error
- end
-
- drop log.
- log. = ''
-
- acidname = getclip(address() || 'CIDNAME')
- acidnumber = getclip(address() || 'CIDNUMBER')
-
- /* 2922 = 8*365 + 2 */
- /* 86400 = 24*60*60 */
- log.time = (date('i')+2922)*86400 + time('s')
- log.cidname = acidname
- log.cidnumber = acidnumber
-
- return
-
- loadLogEntry: procedure expose log.
- if arg() ~= 2 then do
- rc = "loadLogEntry: bad args"
- signal error
- end
- parse arg mailbox, handle
-
- drop log.
- log. = ''
-
- if ~exists(mailboxDir(mailbox)) then do
- call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
- return
- end
-
- opened = open(handle, logFile(mailbox, handle), 'r')
- if opened then do
- call showDebugger('Loading entry' logFile(mailbox, handle))
- do while ~eof(handle)
- line = readln(handle)
- parse upper var line variable '=' value
- log.variable = value
- end
- call close(handle)
- end; else call showDebugger('Could not load' logFile(mailbox, handle))
- return
-
- /* pass a handle here */
- saveLogEntry: procedure expose log.
- if arg() ~= 2 then do
- rc = "saveLogEntry: bad args"
- signal error
- end
- parse arg mailbox, handle
-
- if ~exists(mailboxDir(mailbox)) then do
- call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
- return
- end
-
- opened = open(handle, logFile(mailbox, handle), 'w')
-
- if opened then do
- call showDebugger('Saving entry' logFile(mailbox, handle))
- call writeln(handle, 'TYPE=' || log.type)
- call writeln(handle, 'TIME=' || log.time)
- call writeln(handle, 'LENGTH=' || log.length)
-
- call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
-
- call writeln(handle, 'CIDNAME=' || log.cidname)
- call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
-
- call writeln(handle, 'COMMENT=' || log.comment)
-
- call writeln(handle, 'FILENAME=' || log.filename)
- call writeln(handle, 'ALTFILENAME=' || log.altfilename)
-
- call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
- call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
- call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
-
- call writeln(handle, 'RETURNRETRY=' || log.returnretry)
- call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
-
- call close(handle)
- address rexx 'broadcast' 'addtomailbox' mailbox handle
- end; else call showDebugger('Could not save' logFile(mailbox, handle))
-
- return
-
- /* pass a handle here */
- updateLogEntry: procedure expose log.
- if arg() ~= 2 then do
- rc = "updateLogEntry: bad args"
- signal error
- end
- parse arg mailbox, handle
-
- if ~exists(mailboxDir(mailbox)) then do
- call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
- return
- end
-
- if ~exists(logFile(mailbox, handle)) then do
- call showDebugger('Unable to update non-existent' logFile(mailbox, handle))
- return
- end
- opened = open(handle, logFile(mailbox, handle), 'w')
-
- if opened then do
- call showDebugger('Updating entry' logFile(mailbox, handle))
- call writeln(handle, 'TYPE=' || log.type)
- call writeln(handle, 'TIME=' || log.time)
- call writeln(handle, 'LENGTH=' || log.length)
-
- call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
-
- call writeln(handle, 'CIDNAME=' || log.cidname)
- call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
-
- call writeln(handle, 'COMMENT=' || log.comment)
-
- call writeln(handle, 'FILENAME=' || log.filename)
- call writeln(handle, 'ALTFILENAME=' || log.altfilename)
-
- call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
- call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
- call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
-
- call writeln(handle, 'RETURNRETRY=' || log.returnretry)
- call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
-
- call close(handle)
- address rexx 'broadcast' 'refreshmailboxentry' mailbox handle
- end; else call showDebugger('Could not update' logFile(mailbox, handle))
-
- return
-
-
-
- showDebugger: procedure
- if arg() ~= 1 then do
- say "showDebugger: ERROR"
- exit 20
- end
-
- parse arg debuggerInfo
-
- firstLine = sourceline(1)
- parse var firstLine '/*' 'TITLE:' title '*/'
- if showlist('p', 'AVMLOGGER') then
- address 'AVMLOGGER' 'add' title ':' debuggerInfo
- else
- say title ':' debuggerInfo
-
- return
-
- /*-----------------------------------------------------------------------*/
- /* signal processing */
-
- arexxerror:
- error:
- call showDebugger("Error" rc "at line" sigl)
- exit 20
-
- break_c:
- halt:
- call showDebugger("Halt/Break_C at line" sigl)
- exit 20
-
- novalue:
- call showDebugger("No value at line" sigl)
- exit 20
-
- syntax:
- call showDebugger("Syntax error" rc "at line" sigl)
- exit 20
-
- /* TITLE: avm:rexx/stdplayvoice.avm */
- stdPlayXX:
- procedure
- parse arg ret
-
- rs.normal = 0
- rs.keydetected = 1
- rs.quietdetected = 2
- rs.silencedetected = 3
- rs.faxdetected = 4
- rs.datadetected = 5
- rs.busydetected = 8
- rs.timedout = 10
- rs.signaldetected = 12
- rs.overflow = 14
- rs.error = 16
- /* CB 0000 */
-
- select
- when ret=rs.faxdetected then signal stdfax
- when ret=rs.datadetected then signal stddata
- when ret=rs.busydetected then signal stdbusy
- when ret=rs.signaldetected then signal stdabort
- when ret=rs.overflow then signal stderror
- when ret=rs.error then signal stderror
- otherwise nop
- end
- return
-
-
- aapresentmenu:
- /* TITLE: avm:rexx/presentmenu.avm */
- procedure expose pmRetries pmTimesAround
- parse arg filename, valid, retries
- timesaround = retries
- pmTimesAround = timesaround
- pmRetries = retries
-
- rs.normal = 0
- rs.keydetected = 1
- rs.quietdetected = 2
- rs.silencedetected = 3
- rs.faxdetected = 4
- rs.datadetected = 5
- rs.busydetected = 8
- rs.timedout = 10
- rs.signaldetected = 12
- rs.overflow = 14
- rs.error = 16
- /* CB 0000 */
-
- aapresentmenuloop:
- 'playvoice' filename
- a_=rc
- if 0 then nop
- else if a_=4 then do;return rs.faxdetected;end
- else if a_=5 then do;return rs.datadetected;end
- else if a_=8 then do;return rs.busydetected;end
- else if a_=12 then do;return rs.signaldetected;end
- else if a_=14 then do;return rs.error;end
- else if a_=16 then do;return rs.error;end
-
- 'readnkeys' '1' '5'
- a_=rc
- if a_=0 then value=result
- if 0 then nop
- else if a_=0 then signal aapresentmenuvalue
- else if a_=4 then do;return rs.faxdetected;end
- else if a_=5 then do;return rs.datadetected;end
- else if a_=8 then do;return rs.busydetected;end
- else if a_=10 then signal aapresentmenutimeout
- else if a_=12 then do;return rs.signaldetected;end
- else if a_=14 then do;return rs.error;end
- else if a_=16 then do;return rs.error;end
- return rs.error
-
- aapresentmenutimeout:
- 'flushphonebuffer'
-
- 'playvoice' 'avm:voices/TimedOut'
- a_=rc
- if 0 then nop
- else if a_=4 then do;return rs.faxdetected;end
- else if a_=5 then do;return rs.datadetected;end
- else if a_=8 then do;return rs.busydetected;end
- else if a_=12 then do;return rs.signaldetected;end
- else if a_=14 then do;return rs.error;end
- else if a_=16 then do;return rs.error;end
-
- timesaround = timesaround - 1; pmTimesAround = timesaround
- if timesaround <= 0 then return rs.timedout
- signal aapresentmenuloop
-
- aapresentmenuvalue:
- if pos(value, valid) = 0 then signal aainvalid
- return '=' || value
-
- aainvalid:
- 'flushphonebuffer'
-
- 'playvoice' 'avm:voices/BadChoice'
- a_=rc
- if 0 then nop
- else if a_=4 then do;return rs.faxdetected;end
- else if a_=5 then do;return rs.datadetected;end
- else if a_=8 then do;return rs.busydetected;end
- else if a_=12 then do;return rs.signaldetected;end
- else if a_=14 then do;return rs.error;end
- else if a_=16 then do;return rs.error;end
-
- timesaround = timesaround - 1; pmTimesAround = timesaround
- if timesaround <= 0 then return rs.timedout
- signal aapresentmenuloop
-
-
- stdabort:
- exit
-
- stdbusy:
- exit
-
- stderror:
- exit
-
- stdtimedout:
- exit
-
- stdfaxinstruct:
- 'playvoice' 'avm:voices/FaxStarting'
- a_=rc
- if 0 then nop
- else if a_=1 then do;call checkifabort;end
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
-
- stdfax:
- faxscript = getclip(address() || 'FAXSCRIPT')
- if faxscript = '' then faxscript = 'handlefax'
- if symbol('mailbox') = 'VAR' then address rexx faxscript address() mailbox
- else address rexx faxscript address() 'anonymous'
- exit
-
- stddatainstruct:
- 'playvoice' 'avm:voices/DataStarting'
- a_=rc
- if 0 then nop
- else if a_=1 then do;call checkifabort;end
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
-
- stddata:
- datascript = getclip(address() || 'DATASCRIPT')
- if datascript = '' then datascript = 'handledata'
- if symbol('mailbox') = 'VAR' then address rexx datascript address() mailbox
- else address rexx datascript address()
- exit
-
- checkifabort:
- 'readnkeys' '1' '3'
- a_=rc
- if a_=0 then value=result
- if 0 then nop
- else if a_=0 then do;if value = '*' then signal stdabort;end
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- return
-
-
- /* TITLE: avm:rexx/maintenancemodetail.avm */
- /* TITLE: avm:rexx/getnumber.avm */
- getnumber:
- procedure
-
- aagetnumberagain:
- 'playvoice' 'avm:voices/GetNumber'
- call stdPlayXX(rc)
-
- 'readkeysuntil' '#' '15' '7'
- a_=rc
- if a_=0 then value=result
- if 0 then nop
- else if a_=0 then do;number = value;end
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then do;number = '';end
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
-
- 'playvoice' 'avm:voices/NumberEntered'
- call stdPlayXX(rc)
-
- call playNumber(number)
-
- aagetnumbermenu:
- call aapresentmenu('avm:voices/numbercorrect', '02#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal aagetnumbermenu
- else if a_='=2' then signal aagetnumberagain
- else if a_='=#' then signal aagetnumberdone
- else if a_='=*' then signal answerVoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then do;number = ''; signal aagetnumberdone;end
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
-
- aagetnumberdone:
- /* We're done. Number is in 'number' */
-
- return number
-
-
- /* TITLE: avm:rexx/playnumber.avm */
- playnumber:
- /* Cycle through value and play each symbol */
-
- procedure
- parse arg number
-
- do i = 1 to length(number)
- if pos(substr(number, i, 1), '0123456789') > 0 then
- call playAVoice('avm:voices/number0'||substr(number, i, 1))
- else if substr(number, i, 1) = '#' then
- call playAVoice('avm:voices/numberpound')
- else if substr(number, i, 1) = '*' then
- call playAVoice('avm:voices/numberstar')
- end
- return
-
- playAVoice:
- procedure
- parse arg filename
-
- 'playvoice' filename
- call stdPlayXX(rc)
- return
-
-
- /* TITLE: avm:rexx/playddnumber.avm */
- playddnumber:
- /* We're going to play a double digit number */
-
- procedure
- parse arg number
- directdd = getclip('AVMDirectDDNumber')
- if upper(directdd) = 'YES' then signal playdirectdd
-
- if number > 9 & number < 20 then
- call playANumber(number)
- else if number >= 20 & number < 60 then do
- units = number // 10
- tens = number - units
- call playANumber(tens)
- if units > 0 then call playnumber(units)
- end; else
- call playnumber(number+0)
- return
-
- playdirectdd:
- if number < 10 then call playnumber(number+0)
- else call playANumber(number)
- return
-
- playANumber:
- procedure
- parse arg number
- numToPlay = 'avm:voices/number' || number
-
- 'playvoice' numToPlay
- call stdPlayXX(rc)
- return
-
-
- /* TITLE: avm:rexx/playtime.avm */
- playtime:
- procedure
- parse arg secs
- hours = secs % (60*60)
- minutes = (secs - (hours * 60 * 60)) % 60
- if hours < 12 then pm = 0
- else do; pm = 1; hours = hours - 12; end
- if hours = 0 then hours = 12
- timeformat = getclip('AVMTimeFormat')
- if timeformat = "" then timeformat = '%hours12 %minutes %pm'
-
- do i = 1 to words(timeformat)
- if upper(word(timeformat, i)) = '%HOURS12' then
- call playddnumber(hours)
- else if upper(word(timeformat, i)) = '%HOURS24' then
- call playddnumber(hours + (pm * 12))
- else if upper(word(timeformat, i)) = '%MINUTES' then
- call playddnumber(minutes)
- else if upper(word(timeformat, i)) = '%PM' then
- do
-
- if pm then call playAVoice('avm:voices/timepm')
- else call playAVoice('avm:voices/timeam')
- end
- else
- call playAVoice(word(timeformat, i))
- end
-
- /* We're done */
- return
-
-
- /* TITLE: avm:rexx/playdate.avm */
- playdate:
- /* We're going to play the month and day */
-
- procedure
- parse arg actualDate
-
- dateformat = getclip('AVMDateFormat')
- if dateformat = "" then dateformat = "%month %day"
- else if upper(dateformat) = "NONE" then dateformat = ""
-
- do i = 1 to words(dateformat)
- if upper(word(dateformat, i)) = "%MONTH" then
- call playAVoice('avm:voices/month'||numberToMonth(substr(actualDate, 5, 2)+0))
- else if upper(word(dateformat, i)) = "%DAY" then
- call playddnumber(substr(actualDate, 7, 2))
- else
- call playAVoice(word(dateformat, i))
- end
-
- /* We're done */
- return
-
- numberToMonth:
- procedure
- parse arg m
- m_.1='january';m_.2='february';m_.3='march'
- m_.4='april';m_.5='may';m_.6='june'
- m_.7='july';m_.8='august';m_.9='september'
- m_.10='october';m_.11='november';m_.12='december'
- return m_.m
-
-
- /* TITLE: avm:rexx/recordmessage.avm */
- recordmessage:
- procedure
- parse arg filename
-
- recordmessagesagain:
- call aapresentmenu('avm:voices/RecordMessage', '0123#*', '3')
- a_=result
- if 0 then nop
- else if a_='=0' then signal recordmessageagain
- else if a_='=1' then signal recordmessagesplay
- else if a_='=2' then signal recordmessagesrecord
- else if a_='=3' then signal recordmessagesdelete
- else if a_='=#' then do;nop;end
- else if a_='=*' then signal answerVoiceDone
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=10 then signal answerVoiceDone
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
- return
-
- recordmessagesplay:
- 'playbeep' '3000' '0' '4'
- call stdPlayXX(rc)
-
- 'playvoice' filename
- a_=rc
- if 0 then nop
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
-
- 'flushphonebuffer'
-
- 'playbeep' '3000' '0' '4'
- call stdPlayXX(rc)
- signal recordmessagesagain
-
- recordmessagesrecord:
- 'playvoice' 'avm:voices/RecordMessagesRecord'
- call stdPlayXX(rc)
-
- 'playbeep' '3000' '0' '4'
- call stdPlayXX(rc)
-
- 'recordvoice' '0' '-1' '30' filename
- a_=rc
- if 0 then nop
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
-
- 'flushphonebuffer'
-
- 'playbeep' '3000' '0' '4'
- call stdPlayXX(rc)
- signal recordmessagesagain
-
- recordmessagesdelete:
- address command 'delete >nil: <nil: quiet' filename
- signal recordmessagesagain
-
-
-
- exit
-
- /* this requires logfunctions.avm */
-
- loadMailbox: procedure expose mailbox.
- if arg() ~= 1 then do
- rc = "loadMailbox: bad args"
- signal error
- end
-
- mailbox. = ''
- parse arg mailbox
-
- handle = 'mailboxconfig'
- opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'r')
- if opened then do
- do while ~eof(handle)
- line = readln(handle)
- parse upper var line variable '=' value
- mailbox.variable = value
- end
- call close(handle)
- end
- return
-
- /* pass a handle here */
- saveMailbox: procedure expose mailbox.
- if arg() ~= 1 then do
- rc = "saveMailbox: bad args"
- signal error
- end
- parse arg mailbox
-
- handle = 'mailboxconfig'
- opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'w')
-
- if opened then do
- call writeln(handle, 'PASSWORD=' || mailbox.password)
-
- call writeln(handle, 'AUTOFAXFORWARDB=' || mailbox.autofaxforwardb)
- call writeln(handle, 'AUTOFAXFORWARD=' || mailbox.autofaxforward)
- call writeln(handle, 'AUTOFAXFORWARDSCRIPT=' || mailbox.autofaxforwardscript)
-
- call writeln(handle, 'AUTOFORWARDB=' || mailbox.autoforwardb)
- call writeln(handle, 'AUTOFORWARDONDEMAND=' || mailbox.autoforwardondemand)
- call writeln(handle, 'AUTOFORWARD=' || mailbox.autoforward)
- call writeln(handle, 'AUTOFORWARDSCRIPT=' || mailbox.autoforwardscript)
-
- call writeln(handle, 'AUTOPAGEB=' || mailbox.autopageb)
- call writeln(handle, 'AUTOPAGEONDEMAND=' || mailbox.autopageondemand)
- call writeln(handle, 'AUTOPAGE=' || mailbox.autopage)
- call writeln(handle, 'AUTOPAGESCRIPT=' || mailbox.autopagescript)
-
- call writeln(handle, 'AUTOALERTB=' || mailbox.autoalertb)
- call writeln(handle, 'AUTOALERTONDEMAND=' || mailbox.autoalertondemand)
- call writeln(handle, 'AUTOALERTSCRIPT=' || mailbox.autoalertscript)
-
- call close(handle)
- end
-
- return
-
- /* TITLE: avm:rexx/getpassword.avm */
- /* This is a procedure which accepts 1 argument, a password */
-
- getpassword:
- procedure
- parse arg password
- count = 3 /* max of 3 times */
- if password = '' then return 1
-
- getpasswordagain:
- count = count - 1
- if count = 0 then return 0 /* didn't get a good password */
-
- 'playvoice' 'avm:voices/getpassword'
- call stdPlayXX(rc)
-
- 'readkeysuntil' '#' '10' '7'
- a_=rc
- if a_=0 then value=result
- if 0 then nop
- else if a_=0 then signal getpasskeydetected
- else if a_=4 then signal stdfax
- else if a_=5 then signal stddata
- else if a_=8 then signal stdbusy
- else if a_=12 then signal stdabort
- else if a_=14 then signal stderror
- else if a_=16 then signal stderror
-
- 'playvoice' 'avm:voices/passwordtimeout'
- call stdPlayXX(rc)
- signal getpasswordagain
-
- getpasskeydetected:
- if value = password then return 1
-
- 'playvoice' 'avm:voices/passwordbad'
- call stdPlayXX(rc)
- signal getpasswordagain
-
-
-