This commit was generated by cvs2svn to compensate for changes in r2523,
[freeside.git] / rt / docs / design_docs / CARS
1 Conditional Automated Request Shuffler 
2 Initial Design.                 <jesse@fsck.com> 9 Nov 99
3
4 #Try to find out what queue the incoming ticket is in
5 #Try to find out the default action for this invocation
6 #Read the ticket from STDIN
7 #Obtain the actor
8 #Obtain the serial # if we have one
9 #If the ticket has a ticket-id
10         #if this is a 'comment'
11                 #add the current mime objects as a 'comment'
12
13         #if this is 'correspondence'
14                 #add the current mime object as 'correspondence'
15
16
17 #if this ticket does not yet have a ticket id
18
19   #For now:
20         #Create a new ticket
21
22   #In the distant future
23
24         #load the regexp table matching this queue
25         #check the message agains the regexp table, ordered by precedence
26                 #when we get a match
27                         #get the ruleset for that regexp from the actions table
28                         #evaluate the ruleset in order of precedence.
29                            #if we get an 'exit' stop proccesing ALL rulesets
30 wpw                        #if we get a 'forward,' forward it to 'value'.
31
32                            #if we get a 'create,' create a request in 'value'
33                            #elseif we get a 'map', add this as additional correspondence on ticket 'value'
34
35     
36                            #if we get an 'associate', associate the ticket number returned from the 
37                            'create' or 'map' with the master ticket from 'value'
38
39                            #if we get a 'reply', 
40                                 #load the reply template with id 'value'      
41                                 #replace strings in the template
42                                 #send the template
43
44
45
46
47 CREATE TABLE Rules {
48 ID int AUTO_INCREMENT,
49 Desc varchar(120),
50 Regexp varchar(80),
51 Precedence int,
52 MatchField varchar(20), #Can be a headername or 'any' all header names
53                         #end in :
54
55
56 CREATE TABLE Actions {
57 Rule int,
58 Action varchar(20), # Create, Forward, Squelch, Owner, Area, Associate
59 Value varchar(20), #queue or email address
60 Desc varchar(120)
61 }
62
63 CREATE TABLE Autoreplies {
64 ID int AUTO_INCREMENT,
65 Content text
66 );