Debian Codegraph @

configs/samples/cel_custom.conf.sample

raw
1 ;
2 ; Asterisk Channel Event Logging (CEL) - Custom DSV Backend
3 ;
4 ; This is the configuration file for the customizable DSV backend for CEL
5 ; logging.
6 ;
7 ; DSV?? Delimiter Separated Values because the field delimiter doesn't have
8 ; to be a comma.
9 ;
10 ; Legacy vs Advanced Mappings
11 ;
12 ; Legacy mappings are those that are defined using dialplan functions like
13 ; CALLERID and CSV_QUOTE and require a VERY expensive function replacement
14 ; process at runtime for every record output. In performance testing, 38%
15 ; of the CPU instructions executed to handle a call were executed on behalf
16 ; of legacy CEL logging. That's more than the instructions actually used
17 ; to process the call itself.
18 ;
19 ; Advanced mappings are those that are defined by a list of field names and
20 ; parameters that define the field separator and quote character you want to
21 ; use. This type of mapping is uses significantly less resources at runtime.
22 ; Performance testing showed advanced CEL logging accounting for less than
23 ; 10% of the CPU instructions executed which is well below the instructions
24 ; needed to process the call itself.
25 ;
26 ; There are several "special" variables created by this module that can be used
27 ; in a mapping, both legacy and advanced:
28 ;
29 ; eventtype - The name of the CEL event.
30 ; eventtime - The timestamp of the CEL event.
31 ; eventenum - Like eventtype but is "USER_DEFINED" for a user defined event.
32 ; userdeftype - User defined event type name from CELGenUserEvent().
33 ; eventextra - Extra data included with this CEL event, typically along with
34 ; an event of type USER_DEFINED from CELGenUserEvent().
35 ; BRIDGEPEER - Bridged peer channel name at the time of the CEL event.
36 ; CHANNEL(peer) could also be used.
37 ;
38 ; Legacy Mappings
39 ;
40 ; Within a legacy mapping, use the CALLERID(), CHANNEL() and CSV_QUOTE()
41 ; functions to retrieve values from the CEL event (and pay the price).
42 ;
43 ; NOTE: If your legacy mapping uses commas as field separators and only the
44 ; CSV_QUOTE, CALLERID and CHANNEL dialplan functions or one of the special
45 ; variables, the module will attempt to strip the functions and create a much
46 ; faster advanced mapping for it. However, we urge you to create a real
47 ; advanced mapping and not rely on this process. If the mapping contains
48 ; something not recognized it will go the slower legacy route.
49 ;
50 ; Each entry in the "mappings" category represents a separate output file.
51 ; A filename that starts with a forward-slash '/' will be treated as an absolute
52 ; path name. If it doesn't, it must be a file name with no directory separators
53 ; which will be placed in the /var/log/asterisk/cel-custom directory.
54 ;
55 ;[mappings]
56 ;Master.csv => ${CSV_QUOTE(${eventtype})},${CSV_QUOTE(${eventtime})},${CSV_QUOTE(${CALLERID(name)})},${CSV_QUOTE(${CALLERID(num)})},${CSV_QUOTE(${CALLERID(ANI)})},${CSV_QUOTE(${CALLERID(RDNIS)})},${CSV_QUOTE(${CALLERID(DNID)})},${CSV_QUOTE(${CHANNEL(exten)})},${CSV_QUOTE(${CHANNEL(context)})},${CSV_QUOTE(${CHANNEL(channame)})},${CSV_QUOTE(${CHANNEL(appname)})},${CSV_QUOTE(${CHANNEL(appdata)})},${CSV_QUOTE(${CHANNEL(amaflags)})},${CSV_QUOTE(${CHANNEL(accountcode)})},${CSV_QUOTE(${CHANNEL(uniqueid)})},${CSV_QUOTE(${CHANNEL(linkedid)})},${CSV_QUOTE(${BRIDGEPEER})},${CSV_QUOTE(${CHANNEL(userfield)})},${CSV_QUOTE(${userdeftype})},${CSV_QUOTE(${eventextra})}
57
58 ;
59 ; Advanced Mappings
60 ;
61 ; Each category in this file other than "mappings" represents a separate output file.
62 ; A filename that starts with a forward-slash '/' will be treated as an absolute
63 ; path name. If it doesn't, it must be a file name with no directory separators
64 ; which will be placed in the /var/log/asterisk/cel-custom directory.
65 ;
66 ;[cel_master.csv] ; Output file or path name.
67
68 ;format = dsv ; Advanced mappings can actually have two types
69 ; "dsv" or "json". This example uses "dsv", which
70 ; is the default, but see the example below for more
71 ; info on the json format.
72
73 ;separator_character = , ; The character to use for the field separator,
74 ; It defaults to a comma but you can use any
75 ; character you want. For instance, specify
76 ; \t to separate the fields with a tab.
77
78 ;quote_character = " ; The character to use as the quote character.
79 ; It defaults to the double quote but again, it
80 ; can be any character you want although the
81 ; single-quote is the only other one that makes
82 ; sense.
83
84 ;quote_escape_character = " ; The character to use to escape the quote_character
85 ; should the quote character actually appear in the
86 ; field output. A good example of this is a caller
87 ; id string like "My Name" <1000>. For true CSV
88 ; compatibility, it must be the same as the quote
89 ; character but a backslash might be acceptable for
90 ; other formats.
91
92 ;quoting_method = all ; Nothing says you _have_ to quote anything. The only
93 ; time a field MUST be quoted is if it contains the
94 ; separator character and this is handled automatically.
95 ; Additionally, the following options are available:
96 ; "all": Quote all fields. The default.
97 ; "non_numeric": Quote all non numeric fields.
98 ; "none": Don't quote any field (unless it contains
99 ; a separator character).
100
101 ;fields = EventType,eventenum,userdeftype,"Some Literal",EventTime,Name,Num,ani,rdnis,dnid,Exten,Context,ChanName,AppName,AppData,AMAFlags(amaflags),AccountCode,UniqueID(noquote),LinkedID(noquote),Peer,PeerAccount,UserField,EventExtra,TenantID
102 ; This is the list of fields to include in the record. The field names are the
103 ; same as in the legacy mapping but without any enclosing dialplan functions.
104 ; You can specify literals to be placed in the output record by double-quoting
105 ; them. There is also some special notation available in the form of "qualifiers".
106 ; A qualifier is a list of tags, separated by the '^' character and placed
107 ; directly after the field name and enclosed in parentheses.
108 ;
109 ; All fields can accept the "quote" or "noquote" qualifier when you want to exempt
110 ; a field from the "quoting_method" policy. For example, when quoting_method=all,
111 ; you can force the uniqueid field to not be quoted with `uniqueid(noquote)`. The
112 ; example in fields above shows this.
113 ;
114 ; The default output format for the "EventTime" timestamp field is taken from the
115 ; "dateformat" parameter in cel.conf. If that's not set, the default is
116 ; "<seconds>.<microseconds>" where "<microseconds>" is always 6 digits with
117 ; leading zeros. You can also format the field as an int64 or a double:
118 ; `eventtime(int64)` or `eventtime(double)` or provide your own strftime
119 ; format string: `eventtime(%FT%T%z)`.
120 ;
121 ; Unlike CDRs, the "amaflags" field is output as its numerical value by default
122 ; for historical reasons. You can output it as its friendly string with
123 ; `amaflags(amaflags)`. This will print "DOCUMENTATION" instead of "3" for instance.
124 ;
125 ; If you need to combine flags, use the caret '^' symbol: `eventtime(int64^noquote)`
126 ;
127 ; Final notes about "fields":
128 ; Field names and qualifiers aren't case sensitive.
129 ; You MUST use the comma to separate the fields, not the "separator_character".
130 ; You MUST use the double-quote to indicate literal fields, not the "quote_character".
131 ; Whitespace in "fields" is ignored except in literals.
132
133 ;
134 ; An Advanced JSON example:
135 ;
136 ;[cdr_master.json]
137 ;format = json
138 ;fields = EventType,eventenum,userdeftype,"My: Literal",EventTime(float),Name,Num,ani,rdnis,dnid,Exten,Context,ChanName,AppName,AppData,AMAFlags(amaflags),AccountCode,UniqueID,LinkedID,Peer,PeerAccount,UserField,EventExtra,TenantID
139 ;
140 ; In order to ensure valid JSON, the following settings are forced:
141 ; The separator character is always the comma.
142 ; The quote character is always the double-quote.
143 ; The quote escape character is always the backslash.
144 ; The quoting method is always "non_numeric".
145 ;
146 ; Since JSON requires both a name and value, the name is always
147 ; the field name. For literals however you must specify the literal
148 ; as a "name: value" pair as demonstrated above. The output record
149 ; would then look something like:
150 ; {"eventtype":"HANGUP","eventenum":"HANGUP","userdeftype":"","My":"Literal","eventtime":1771359872.0, ...}
151
152
153
154
155
156
157
158
159
160
161 ;
162 ; Advanced Mappings
163 ;
164 ; Advanced mappings use SIGNIFICANTLY less resources than legacy mappings
165 ; because we don't need to use dialplan function replacement.
166 ;
167 ;[cel_master_advanced.csv] ; The destination file name.
168 ; Can be a name relative to ASTLOGDIR or an
169 ; absolute path.
170
171 ;format = csv ; Sets the output format. The default is "csv"
172 ; but here "csv" really means "character-separated-values"
173 ; because the separator doesn't have to be a comma.
174 ; The other alternative is "json" (see example below).
175
176 ;separator_character = , ; Set the character to use between fields.
177 ; Defaults to a comma but other characters
178 ; can be used. For example, if you want
179 ; tab-separated fields, use \t as the separator.
180
181 ;quote_character = " ; Set the quoting character.
182 ; Defaults to double-quote (") but any character
183 ; can be used although only the double and single
184 ; quote (') characters make sense.
185
186 ;quote_escape_character = " ; Sets the character used to escape quotes that
187 ; may be in the field values. The default is the
188 ; same character as the quote_character so an
189 ; embedded JSON blob would look like this:
190 ; "{""extra"":""somextratext""}"
191 ; You could also use a backslash (\) in which case
192 ; the blob would look like this:
193 ; "{\"extra\":\"somextratext\"}"
194
195 ;quoting_method = all ; Sets what/when to quote.
196 ; all - Quote all fields. (the default)
197 ; minimal - Only quote fields that have the
198 ; separator character in them.
199 ; non_numeric - Quote all non-numeric fields.
200 ; none - Don't quote anything.
201 ; Probably not a good idea but could
202 ; be useful in special circumstances.
203
204 ; The fields to output. These names correspond to the internal CEL event
205 ; field names which is how some of the performance gains are realized.
206 ; Anything not recognized as a field name will be printed as a literal in
207 ; the output.
208 ;
209 ; CEL Event Field Names:
210 ;
211 ; eventtype - Could be a standard event name or a user event name
212 ; eventenum - Will always be a standard event name or 'USER_DEFINED'
213 ; eventtime - Uses the dateformat set in cel.conf.
214 ; usereventname - Will be the user event name if set.
215 ; cidname
216 ; cidnum
217 ; exten
218 ; context
219 ; channame
220 ; appname
221 ; appdata
222 ; amaflags
223 ; acctcode
224 ; uniqueid
225 ; userfield
226 ; cidani
227 ; cidrdnis
228 ; ciddnid
229 ; peer
230 ; linkedid
231 ; peeracct
232 ; extra
233 ; tenantid
234 ;
235 ; You MUST use the comma and double-quote here, not the separator or
236 ; or quote characters specified above. The names are case-insensitive.
237 ;
238 ;fields = EventType,EventEnum,"My Literal",EventTime,UserEventName,CIDName,CIDNum,Exten,Context,ChanName,AppName,AppData,AMAFlags,AcctCode,UniqueID,UserField,CIDani,CIDrdnis,CIDdnid,Peer,LinkedID,PeerAcct,Extra,TenantID
239
240 ;
241 ; A tab-separated-value example:
242 ;
243 ;[cel_master.tsv]
244 ;separator_character = \t
245 ;fields = EventType,EventEnum,"My Literal",EventTime,UserEventName,CIDName,CIDNum,Exten,Context,ChanName,AppName,AppData,AMAFlags,AcctCode,UniqueID,UserField,CIDani,CIDrdnis,CIDdnid,Peer,LinkedID,PeerAcct,Extra,TenantID
246
247 ;
248 ; A JSON example:
249 ;
250 ; The separator and quoting options don't apply to JSON.
251 ; Literals must be specified as a "name: value" pair or they'll be ignored.
252 ;
253 ;[cel_master.json]
254 ;format = json
255 ;fields = EventType,eventenum,userdeftype,"My: Literal",EventTime,CIDName,CIDNum,CIDani,CIDrdnis,CIDdnid,Exten,Context,ChanName,AppName,AppData,AMAFlags,AcctCode,UniqueID,LinkedID,Peer,PeerAcct,UserField,Extra,TenantID