import torrus 1.0.9
[freeside.git] / FS / FS / cdr / sansay.pm
1 package FS::cdr::sansay;
2
3 use strict;
4 use base qw( FS::cdr );
5 use vars qw( %info );
6 use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
7
8 %info = (
9   'name'          => 'Sansay VSX',
10   'weight'        => 135,
11   'header'        => 0,     #0 default, set to 1 to ignore the first line, or
12                             # to higher numbers to ignore that number of lines
13   'type'          => 'csv', #csv (default), fixedlength or xls
14   'sep_char'      => ';',   #for csv, defaults to ,
15   'disabled'      => 0,     #0 default, set to 1 to disable
16
17
18   #listref of what to do with each field from the CDR, in order
19   'import_fields' => [
20
21     # "Header" (I do not think this means what you think it means)
22     #002452502;V1.10;R;
23
24     # Record Sequence Number 9 Unique identification of this record
25     'uniqueid',
26
27     '', #Version Number         5 Format version number of records to follow
28         #                         "V1.10"
29     '', #Record Type            1 Type of CDR being generated
30         #                         R ­ Normal CDR record, A - Audit
31
32     # "Body"
33     #WithMedia;181-1071459514@192.188.0.28;0001;Mon Dec 15 11:38:34 2003;Mon Dec 15 11:38:41 2003;Mon Dec 15 11:38:48 2003;480;EndedByRemoteUser;3;T;000200;H323;;192.188.0.38;9001;192.188.0.28;f0faff54-2e6c-11d8-8c4b-bd4d562c2265;192.188.0.38;18044;192.188.0.28;10756;G.729b;240;460;6066;14060;0;0;0;000200;H323;;192.188.0.28;8811;192.188.0.38;e83af3d3-1d2d-d811-9f98-003048424934;192.188.0.38;19236;192.188.0.28;10758;G.729b;460;240;14060;6066;0;0;0;F;9001;305;2;15;305000;00000011 44934567 45231267 2300BCC0;8587542200;
34
35     '',         #ConnectionType      16 Type of connection : Media or No Media
36     '',         #SessionID           32 Unique ID assigned to the call by
37                 #                       SSM subsystem
38     '', #XXX    #Release Cause       4  2.4 Internal process Release Cause
39
40                     #Cause Code Descriptions
41                     #01         Normal answered call
42                     #02         No Answer, tear down by originator
43                     #03         No answer, tear down by the termination
44                     #04         NORMAL_NO_ANSWER, tear down by
45                     #           system
46                     #402        Service Not Available
47                     #403        Termination capability un-compatible
48                     #404        Outbound digit translation failed
49                     #405        Termination reject for some other reasons
50                     #406        Termination Route is blocked
51                     #500        Originator is not in the Authorized list
52                     #           (source verification failed)
53                     #501        Origination digit translation failed
54                     #502        Origination direction is not bi-directional or
55                     #           inbound
56                     #503        Origination is not in service state
57                     #600        Max system call handling reached
58                     #601        System reject call
59                     #602        System outbound digit translation error
60                     #           (maybe invalid configuration)
61                     #603        System inbound digit translation error
62                     #           (Maybe invalid configuration)
63
64
65     #Start Time of Date  32 Indicates Time of Date when the call
66     #                       entered the system
67     _cdr_date_parser_maker('startdate'), 
68
69     #Answer Time of Date 32 Indicates TOD when the call was
70     #                       answered
71     _cdr_date_parser_maker('answerdate'), 
72
73     #Release TOD             32  Indicates the TOD when the call was
74     #                            disconnected
75     _cdr_date_parser_maker('enddate'), 
76
77     #Minutes West of         32  Minutes West of Greenwich Mean
78     #Greenwich Mean Time         Time. Used to calculate the time
79     #                            zone.
80     '', #XXX use this
81
82     #Release Cause from      32  Release cause string from either H323
83     #Protocol Stack              or SIP protocol stack
84     #4. Release Cause String (Field #8 in CDR)
85     #- a string of text further identifying the teardown circumstance from terminating protocol message.
86     '',
87
88     #Binary Value of Release 4   Binary value of the protocol release
89     #Cause from Protocol         cause
90     #stack
91     #
92     #3. Release Cause from Stack ( Field # 9 in CDR)
93     #- an integer value based on the releasing dialogues protocol.
94     #   a.   For a H.323 call leg originated release it will be the real Q.931 value received from the far
95     #                side.
96     #Some of the Q.931 release causes;
97     #3: No route to destination
98     #16; Normal Clearing
99     #17: User Busy
100     #19: NO Answer from User
101     #21; Call Rejected
102     #28: Address Incomplete
103     #34: No Circuit Channel Available
104     #....
105     #   b.   For a SIP call leg originated release, it's a RFC 3261 release cause value received from the
106     #                far side.
107     #The following is the list that VSX generated if certain event happen:
108     #"400 Parse Failed"                     -      Malformed Message
109     #"405 Method Not Allowed"               -      Unsupported Method
110     #"480 Temporarily Unavailable"                 -       Overload Throttle Rejection, Max Sessions
111     #Exceeded, Demo License Expired, Capacity Exceeded on Route, Radius Server Timeout
112     #"415 No valid codec"                   -      No valid codec could be supported between origination and
113     #term call legs.
114     #"481   Transaction Does Not Exist"     -       Unknown Transaction or Dialog
115     #"487   Transaction Terminated"                 -      Origination Cancel
116     #"488   ReInvite Rejected"              -       Relay of ReInvite was Rejected
117     #"504   Server Time-out"                        -      Internal VSX Failure
118     #"500   Sequence Out of Order"                  -      CSeq counter violation
119     #  c.    For a VSX system originated release, it an internal release cause for teardown.
120     #If the VSX initiates a call teardown, the following cause values and strings are written into the CDR:
121     #999,    "Demo Licence Expired!"
122     #999,    "VSX Capacity Exceeded"
123     #999,    "VSX Operator Reset"
124     #999,    "Route Rejected"
125     #999,    "Radius Rejected"
126     #999,    "Radius Access Timeout"
127     #999,    "Gatekeeper Reject"
128     #999,    "Enum Server Reject"
129     #999,    "Enum Server Timeout"
130     #999,    "DNS Server Reject"
131     #999,    "DNS/GK Timeout"
132     #999,    "Could not allocate media"
133     #999,    "No Response to INVITE"
134     #999,    "Ring No Answer Timeout"
135     #999,    "200 OK Timeout"
136     #999,    "Maximum Duration Exceeded"
137     #987,    "Termination Capacity Exceeded"
138     #987,    "Origination Capacity Exceeded"
139     #987,    "Term CPS Capacity Exceeded"
140     #987,    "Orig CPS Capacity Exceeded"
141     #987,    "Max H323 Legs Exceeded"
142     '',
143
144     #1st release dialogue    1   O: origination, T: termination
145     #2. 1st Release Dialogue ( Field #10 in CDR)
146     #- one character value identifying the side of the call that i
147     #        ,,O ­ origination initiated the teardown.
148     #        ,,T ­ termination initiated the teardown.
149     #        ,,N ­ the VSX internally initiated the teardown.
150     '',
151
152     #Trunk ID -- Origination 6   TrunkID for origination GW(resources)
153     'accountcode', # right? # use cdr-charged_party-accountcode
154
155     #VoIP Protocol - Origination    6   VoIP protocol for origination dialogue
156     '',
157
158     #Origination Source Number     128 Source Number in Origination Dialogue
159     'src',
160
161     #Origination Source Host Name 128 FQDN or IP address for Source GW in Origination Dialogue
162     'channel',
163
164     #Origination Destination Number 128 Destination Number in Origination
165     #Dialogue
166     'dst',
167
168     #Origination Destination Host Name 128 FQDN or IP address for Destination
169     #GW in Origination Dialogue
170     'dstchannel',
171
172     #Origination Call ID     128 Unique ID for the origination dialogue(leg)
173     '', #'clid', #? that's not really the same call ID
174
175     #Origination Remote      16  Remote Payload IP address for
176     #         Payload IP         origination dialogue
177     #         Address
178     '',
179
180     #Origination Remote      6   Remote Payload UDP address for
181     #         Payload UDP        origination dialogue
182     #         Address
183     '',
184
185     #Origination Local       16  Local(SG) Payload IP address for
186     #         Payload IP         origination dialogue
187     #         Address
188     '',
189
190     #Origination Local       6   Local(SG) Payload UDP address for
191     #         Payload UDP        origination dialogue
192     #         Address
193     '',
194
195     #Origination Codec List  128 Supported Codec list( separated by
196     #                            comma) for origination dialogue
197     '',
198
199     #Origination Ingress     10  Number of Ingress( into Sansay
200     #         Packets            system) payload packets in
201     #                            origination dialogue
202     '',
203
204     #Origination Egress      10  Number of Egress( out from Sansay
205     #         Packets            system) payload packets in
206     #                            origination dialogue
207     '',
208
209     #Origination Ingress     10  Number of Ingress( into Sansay
210     #         Octets             system) payload octets in origination
211     #                            dialogue
212     '',
213
214     #Origination Egress      10  Number of Egress( out from Sansay
215     #        Octets              system) payload octets in origination
216     #                            dialogue
217     '',
218
219     #Origination Ingress     10  Number of Ingress( into Sansay
220     #        Packet Loss         system) payload packet loss in
221     #                            origination dialogue
222     '',
223
224     #Origination Ingress     10  Average Ingress( into Sansay system)
225     #        Delay               payload packets delay ( in ms) in
226     #                            origination dialogue
227     '',
228
229     #Origination Ingress     10  Average of Ingress( into Sansay
230     #        Packet Jitter       system) payload packet Jitter ( in ms)
231     #                            in origination dialogue
232     '',
233
234     #Trunk ID -- Termination 6   Trunk ID for termination GW(resources)
235     'carrierid',
236
237     #VoIP Protocol -         6   VoIP protocol from termination GW
238     #        Termination
239     '',
240
241     #Termination Source      128 Source Number in Termination
242     #        Number              Dialogue
243     '',
244
245     #Termination Source Host 128 FQDN or IP address for Source GW
246     #        Name                in Termination Dialogue
247     '',
248
249     #Termination Destination 128 Destination Number in Termination
250     #        Number              Dialogue
251     '',
252
253     #Termination Destination 128 FQDN or IP address for Destination
254     #        Host Name           GW in Termination Dialogue
255     '',
256
257     #Termination Call ID     128 Unique ID for the termination
258     #                            dialogue(leg)
259     '',
260
261     #Termination Remote      16  Remote Payload IP address for
262     #        Payload IP          termination dialogue
263     #        Address
264     '',
265
266     #Termination Remote      6   Remote Payload UDP address for
267     #        Payload UDP         termination dialogue
268     #        Address
269     '',
270
271     #Termination Local       16  Local(SG) Payload IP address for
272     #        Payload IP          termination dialogue
273     #        Address
274     '',
275
276     #Termination Local       6   Local(SG) Payload UDP address for
277     #        Payload UDP         termination dialogue
278     #        Address
279     '',
280
281     #Termination Codec List  128 Supported Codec list( separated by
282     #                            comma) for termination dialogue
283     '',
284
285     #Termination Ingress     10  Number of Ingress( into Sansay
286     #        Packets             system) payload packets in
287     #                            termination dialogue
288     '',
289
290     #Termination Egress      10  Number of Egress( out from Sansay
291     #        Packets             system) payload packets in
292     #                            termination dialogue
293     '',
294
295     #Termination Ingress     10  Number of Ingress( into Sansay
296     #        Octets              system) payload octets in
297     #                           termination dialogue
298     '',
299
300     #Termination Egress      10 Number of Egress( out from Sansay
301     #        Octets             system) payload octets in
302     #                           termination dialogue
303     '',
304
305     #Termination Ingress     10 Number of Ingress( into Sansay
306     #        Packet Loss        system) payload packet loss in
307     #                           termination dialogue
308     '',
309
310     #Termination Ingress     10 Average Ingress( into Sansay system)
311     #        Delay              payload packets delay ( in ms) in
312     #                           termination dialogue
313     '',
314
315     #Termination Ingress     10 Average of Ingress( into Sansay
316     #        Packet Jitter      system) payload packet Jitter ( in ms)
317     #                           in termination dialogue
318     '',
319
320     #Final Route Indication  1  F: Final Route Selection,
321     #                           I: Intermediate Route Attempts
322     '',
323
324     #Routing Digits          64 Routing Digit (Digit after Inbound
325     #                           translation, before Outbound
326     #                           Translation). This may also be the
327     #                           LRN if LNP feature is enabled
328     '',
329
330     #Call Duration in Second 6  Call Duration in Seconds. 0 if this is
331     #                           failed call
332     'billsec',
333
334     #Post Dial Delay in      6  Post dial delay (from call attempt to
335     #        Seconds            ring). 0 if this is failed call
336     '',
337
338     #Ring Time in Second     6  Ring Time in Seconds. 0 if this is
339     #                           failed call
340     '',
341
342     #Duration in milliseconds      10 Call duration in milliseconds.
343     '',
344
345     #Conf ID                 36 Unique Conference ID for this call in
346     #                           Cisco format
347     '',
348
349     #RPID/ANI                32 Inbound Remote Party ID line or
350     #                           Proxy Asserted Identity if provided
351     'clid', #?
352
353   ],
354
355 );
356
357 1;
358
359 __END__
360
361 list of freeside CDR fields, useful ones marked with *
362
363 N/A       acctid - primary key
364 FILLED_IN *[1]   calldate - Call timestamp (SQL timestamp)
365 DONE       clid - Caller*ID with text
366 DONE *      src - Caller*ID number / Source number
367 DONE *      dst - Destination extension
368        dcontext - Destination context
369 DONE       channel - Channel used
370 DONE       dstchannel - Destination channel if appropriate
371        lastapp - Last application if appropriate
372        lastdata - Last application data
373 DONE *      startdate - Start of call (UNIX-style integer timestamp)
374 DONE        answerdate - Answer time of call (UNIX-style integer timestamp)
375 DONE *      enddate - End time of call (UNIX-style integer timestamp)
376 *      duration - Total time in system, in seconds
377 DONE *      billsec - Total time call is up, in seconds
378 *[2]   disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
379        amaflags - What flags to use: BILL, IGNORE etc, specified on a per
380        channel basis like accountcode.
381 DONE *[3]   accountcode - CDR account number to use: account
382        uniqueid - Unique channel identifier
383        userfield - CDR user-defined field
384        cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
385 FILLED_IN *[4]   charged_party - Service number to be billed
386        upstream_currency - Wholesale currency from upstream
387 *[5]   upstream_price - Wholesale price from upstream
388        upstream_rateplanid - Upstream rate plan ID
389        rated_price - Rated (or re-rated) price
390        distance - km (need units field?)
391        islocal - Local - 1, Non Local = 0
392 *[6]   calltypenum - Type of call - see FS::cdr_calltype
393        description - Description (cdr_type 7&8 only) (used for
394        cust_bill_pkg.itemdesc)
395        quantity - Number of items (cdr_type 7&8 only)
396 DONE       carrierid - Upstream Carrier ID (see FS::cdr_carrier)
397        upstream_rateid - Upstream Rate ID
398        svcnum - Link to customer service (see FS::cust_svc)
399        freesidestatus - NULL, done (or something)
400
401 [1] Auto-populated from startdate if not present
402 [2] Package options available to ignore calls without a specific disposition
403 [3] When using 'cdr-charged_party-accountcode' config
404 [4] Auto-populated from src (normal calls) or dst (toll free calls) if not present
405 [5] When using 'upstream_simple' rating method.
406 [6] Set to usage class classnum when using pre-rated CDRs and usage class-based
407     taxation (local/intrastate/interstate/international)
408