FinchSmarts.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, August 7, 1986 2:00:17 pm PDT
Polle Zellweger (PTZ) October 24, 1985 4:56:34 pm PDT
DIRECTORY
BasicTime USING [ GMT ],
LarkFeepRpcControl USING [ InterfaceRecord ],
MBQueue USING [ Queue ],
RefID USING [ ID ],
RefQ USING [ Queue ],
Rope USING [ ROPE ],
RPC USING [ EncryptionKey ],
ThParty USING [ PartyInfo ],
Thrush USING
[ ActionReport, ConversationID, ConvEventBody, EncryptionKey, InterfaceSpec, KeyTable, NB, nullConvID, nullID, nullKey, PartyID, Reason, ROPE, SHHH, SmartsID, StateInConv ],
ThSmartsRpcControl,
VoiceTemp USING [ IntervalSpec, IntervalSpecs, VoiceTime ],
VoiceTempRpcControl USING [ InterfaceRecord ]
;
FinchSmarts: CEDAR DEFINITIONS = {
Types
ConversationID: TYPE = Thrush.ConversationID;
nullConvID: ConversationID = Thrush.nullConvID;
NB: TYPE = Thrush.NB;
nullID: RefID.ID = Thrush.nullID;
WhoOriginated: TYPE = { unknown, us, them };
PartyID: TYPE = Thrush.PartyID;
Reason: TYPE = Thrush.Reason;
ROPE: TYPE = Thrush.ROPE;
SHHH: TYPE = Thrush.SHHH;
FinchInfo: TYPE = REF FinchInfoBody;
FinchInfoBody: TYPE = MONITORED RECORD [
smartsID: Thrush.SmartsID←nullID,
partyID: PartyID ← nullID,
shh: SHHHNIL,
conversations: RefQ.Queue -- of ConvDescs --,
requests: MBQueue.Queue,
visitors: LIST OF Rope.ROPENIL,
stateChange: CONDITION,
myName: ThSmartsRpcControl.InterfaceName ← [],
myRName: ROPENIL,
myPassword: RPC.EncryptionKey ← NULL,
voiceTemp: VoiceTempRpcControl.InterfaceRecord,
Call backs
ReportSystemState: PROC[ on: BOOL ],
ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPENIL ],
ReportRequestState: PROC[actionReport: Thrush.ActionReport, actionRequest: REF]
FinchSmarts implementation will locate the relevant action request (e.g., an IntervalSpec) and pass it on with the action request.
];
ConvDesc: TYPE = REF ConvDescBody;
ConvDescBody: TYPE = RECORD [
Switching data
situation: Thrush.ConvEventBody, -- amalgam of useful info from last-reported event
Data of use to clients, maintained by FinchSmarts
whoOriginated: WhoOriginated ← unknown,
ultimateState: Thrush.StateInConv ← idle, -- last state reached (except for idle)
Maintained by SmartsImpl:
For calls that were completed, this will be active
For attempted outgoing calls, this is perhaps maybe
For incoming calls that were not answered, this is perhaps ringing
startTime: BasicTime.GMTNULL,
subject: ROPENIL,
numParties: NAT𡤀,
numActive: NAT𡤀,
numIdle: NAT𡤀,
partyInfo: ThParty.PartyInfo←NIL, -- Complete description as of some recent time
feepInterfaceSpec: Thrush.InterfaceSpec,
feepInterface: LarkFeepRpcControl.InterfaceRecord,
Playing and recording
pendingIntervals: VoiceTemp.IntervalSpecs ← NIL, -- requested, ~ finished or abandoned
voiceTempID: RefID.ID ← nullID, -- serviceID; see FinchInfo for the interface
keyTable: Thrush.KeyTable←NIL,
keysMightBeDistributed: CONDITION, -- for waiting for keys to distribute, see ..Impl
keysDistributed: BOOLFALSE,
Client-maintained data
clientData: REFNIL,
ReportConversationState implementation can store client-dependent pointers here;
but this field is cleared once the ConvDesc leaves the FinchInfo.conversations Queue.
originatorRecorded: BOOLFALSE,
reportComplete: BOOLFALSE
];
Initialization
InitFinchSmarts: PROC [
thrushInstance: Thrush.ROPENIL,
ReportSystemState: PROC[ on: BOOL ],
Whenever a toggle occurs, so does this procedure.
ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPENIL ],
Client-relevant changes in conversation state are reported in gory detail; FinchSmarts is allowed to invent parts of it (e.g., reason and remark fields)
ReportRequestState: PROC[ actionReport: Thrush.ActionReport, actionRequest: REF ]
ThSmarts.ReportAction was called; we are willing to pass the report on to this routine.
];
Expect ReportSystemState, followed by some number of ReportConversationStates, soon.
No more than one client should call this procedure, at present.
FinchIsRunning: PROC RETURNS [finchIsRunning: BOOL];
UninitFinchSmarts: PROC[problem: Thrush.ROPENIL, nb: Thrush.NBNIL]; 
Call Management
PlaceCall: PROC [
convID: Thrush.ConversationID ← nullConvID,
rName: ROPENIL,
number: ROPE←NIL,
useNumber: BOOLFALSE];
Uses specified conversation, creates a new one or uses one that's in a sufficiently idle state.
Interpretation of rName and number -- evaluate until action can be taken:
rName exists in switching system (has an Etherphone, usually) and ~use#: call that party.
number#NIL: rName is simply a description; call by number
rName=NIL or use#: invalid parameters
rName exists in obsolete directory and ~use#: use the resulting number
all tests fail: no such party.
AnswerCall: PROC[convID: ConversationID];
DisconnectCall: PROC[
convID: ConversationID,
reason: Thrush.Reason←$terminating,
comment: ROPENIL
];
If the other party is willing to do it (trunk parties only, at present), generate touchtones corresponding to the characters in feepString. For talking to feep-controlled services.
Alphabetic characters in feepString are translated to their corresponding digits, based ont he mapping found on most telephone touchpads and dials.
Feep: PROC[convID: ConversationID, feepString: ROPE];
Management of services
PlaybackTuneProc: TYPE = PROC [
convID: Thrush.ConversationID,
intervalSpec: VoiceTemp.IntervalSpec,
key: Thrush.EncryptionKey,
queueIt: BOOLTRUE,
failOK: BOOLFALSE -- playing is optional; leave connection open if tune doesn't exist.
] RETURNS [ started: BOOLFALSE, newConvID: Thrush.ConversationID ];
convID if non-null is a hint of a conversation that used to work. newConvID is the one used for this recording. It may well be gone by the time you can use it for anything, but it won't hurt anything either. If the conversation is still active the next time you call for playback, you'd better use it!
PlaybackTune: PlaybackTuneProc;
RecordReason: TYPE = { ok, abandoned, failed, hopeless };
ok: something was recorded
abandoned: user or client program asked to abandon the recording (supported?)
failed: something went wrong, but may not next time.
hopeless: will continue to fail until somebody does something creative.
RecordTuneProc: TYPE = PROC[
convID: Thrush.ConversationID,
useIntervalSpec: VoiceTemp.IntervalSpec←NIL, -- if supplied, it's a request to extend and includes key index
useKey: Thrush.EncryptionKey ← Thrush.nullKey, -- useful only if useIntervalSpec#NI
queueIt: BOOLFALSE
]
RETURNS[
nb: NB,
intervalSpec: VoiceTemp.IntervalSpec,
key: Thrush.EncryptionKey,
newConvID: Thrush.ConversationID
];
This procedure waits until the recording is complete. While it is running, calls to the registered procedures may occur to inform the user of what's happening. Client is responsible for arranging process structures so that there is a process available to call StopTune while a call to RecordTune is still pending.
convID if non-null is a hint of a conversation that used to work. newConvID is the one used for this recording. It may well be gone by the time you can use it for anything, but it won't hurt anything either. If the conversation is still active the next time you call for playback, you'd better use it!
RecordTune: RecordTuneProc;
StopTuneProc: TYPE = PROC[ convID: Thrush.ConversationID ];
Terminates recording or playback of tune, if any. Causes any pending RecordTune to terminate and return.
StopTune: StopTuneProc;
DescribeIntervalProc: TYPE = PROC[
intervalSpec: VoiceTemp.IntervalSpec, -- if supplied, it's a request to extend and includes key index
minSilence: VoiceTemp.VoiceTime𡤁
]
RETURNS[
nb: NB,
length: INT,
intervals: VoiceTemp.IntervalSpecs
];
DescribeInterval: DescribeIntervalProc;
Visiting: no authentication because reliable authentication is not readily available anyway.
IdentifyVisitor: PROC[visitor: Rope.ROPE];
ReleaseVisitor: PROC[visitor: Rope.ROPE];
Registration
This is like the WalnutRegistry. Finch registers its procedures here, and clients of Finch obtain and use them. FinchRegistryImpl implements these procedures. Finch runs FinchRegistryImpl if it's not already running, and so do its applications. Multiple instances of FinchRegistryImpl produce multiple registrations, though, so be careful with configs.
Unlike WalnutRegistry, this one is presently set up to deal with only one set of registered procs at a time.
Created for use by WalnutVoice, which wants to be able to run with or without Finch running.
FinchState: TYPE = { unknown, running, stopped };
Procs: TYPE = REF ProcsRecord;
ProcsRecord: TYPE = RECORD [
playbackTune: PlaybackTuneProc,
recordTune: RecordTuneProc,
stopTune: StopTuneProc,
describeInterval: DescribeIntervalProc,
finchIsRunning: PROC RETURNS [isRunning: BOOL]
];
Register: PROC [finchSmartsProcs: Procs];
Register a set of procedures to be invoked when the appropriate database changes occur. Return a registration that can be used to name the set
GetProcs: PROC RETURNS [Procs];
Get the current registered set, or NIL
CurrentFinchState: PROC RETURNS [finchState: FinchState];
a quick and safe way to find out if Finch has been loaded and if it is active or not
}.
Swinehart, July 18, 1985 3:31:34 pm PDT
Created FinchSmarts.Register and friends -- easier for WalnutVoice to deal with Finch.
changes to: InitFinchSmarts, RecordTuneProc, RecordTune, StopTuneProc, StopTune, PlaybackTuneProc, PlaybackTune, PlayNoiseProc, PlayNoise, Feep, FinchState, Procs, CurrentFinchState, Procs, Register, FinchIsRunning, UninitFinchSmarts, GetProcs
Polle Zellweger (PTZ) July 13, 1985 5:20:26 pm PDT
adding Text-to-Speech server
Changes to: DIRECTORY, FinchInfoBody, ConvDescBody
Added: TextToSpeech, StopSpeech
Swinehart, August 6, 1985 4:19:33 pm PDT
Merge PTZ Prose changes
changes to: DIRECTORY, FinchInfoBody, ConvDescBody, PlayNoise, TextToSpeech, StopSpeechProc, StopSpeech, ProcsRecord
Polle Zellweger (PTZ) August 29, 1985 5:06:29 pm PDT
changes to: TextToSpeechProc, ProseTranslateProc, TextToSpeech, StopSpeechProc, StopSpeech, ResetProse, ProcsRecord
Polle Zellweger (PTZ) September 3, 1985 6:17:21 pm PDT
Allow registration of proseTranslateProc.
changes to: ProseTranslateProc, TextToSpeech, RegisterTranslateProcType, RegisterTranslateProc, ProcsRecord
Polle Zellweger (PTZ) October 24, 1985 4:56:25 pm PDT
Move bluejayConnection and proseConnection from FinchInfo to ConvDesc.
changes to: FinchInfoBody, ConvDescBody