RT# 81961 Repair broken links in POD documentation
[freeside.git] / FS / bin / freeside-cdr-freeswitch
1 #!/usr/bin/perl
2
3 use strict;
4 use Date::Parse 'str2time';
5 use FS::cdr::Import;
6
7 FS::cdr::Import->dbi_import(
8   'dbd'                 => 'Pg',
9   'database'            => 'fusionpbx',
10   'table'               => 'v_xml_cdr',
11   'status_column'       => 'freesidestatus',
12   'primary_key'         => 'uuid',
13   'column_map'          => { #freeside => fusionpbx
14     #'cdrid'             => 'uuid', #Primary key
15     #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID)
16     'uniqueid'          => 'uuid', #
17     #'' => 'ENTRY_TYPE', #
18     'accountcode'       => 'accountcode', #
19     #'' => 'ACCOUNT', #
20     #'' => 'ACCOUNT_GROUP', #
21     'startdate'         => sub { str2time(shift->{'start_stamp'}); },
22     'answerdate'        => sub { str2time(shift->{'answer_stamp'}); },
23     'enddate'           => sub { str2time(shift->{'end_stamp'}); },
24     #'' => 'PARENT_ACCOUNT_ID', #
25     #'' => 'PARENT_ACCOUNT', #
26     #'' => 'LOGIN_NAME', #
27     #varchars not ints 'upstream_rateid' => 'RATE_SCHEDULE', #
28     #varchars not ints 'upstream_rateplanid' => 'RATE_PLAN', #
29     'channel' => 'NODE', #
30     #'' => 'NODE_TYPE', #
31     #'' => 'ORIGIN', #
32     #'dst'               => sub { $_[0]->{COUNTRY_CODE}. $_[0]->{NPA}.
33     #                             $_[0]->{NXX}. $_[0]->{LOCAL_NUMBER};
34     #                           },
35     #'description'       => 'DESCRIPTION', # or upstream_dst_regionname ?
36     #'' => 'PER_CALL_CHARGE', #
37     #'' => 'PER_MINUTE_CHARGE', #
38     #'' => 'PER_CALL_SURCHARGE', #
39     #'' => 'PER_MINUTE_SURCHARGE', #
40     'duration'          => 'duration', #
41     'billsec'           => sub { int( shift->{'billsec'} * 60 + .49 ); }, #
42     #'upstream_price'    => 'AMOUNT', #
43     #'' => 'PACKAGED_BALANCE_INDEX', #
44     #'upstream_currency' => 'CURRENCY', #
45     #'' => 'CONVERSION_RATE', #
46     'lastapp'           => 'last_app', #
47     #'src'               => 'ANI', # 'clid' => 'ANI', #
48     'dst'               => sub { $_[0]->{'COUNTRY_CODE'} !~ /^1/
49                                    ? "011". $_[0]->{'DETAIL'}
50                                    : $_[0]->{'DETAIL'};
51                                },
52     #'' => 'SALES_GROUP', #
53     #'' => 'TAX_GROUP', #
54     #'userfield'         => 'USER_1', #
55     #'' => 'USER_2', #
56     #'' => 'USER_3', #
57     #'' => 'USER_4', #
58     #'' => 'USER_5', #
59     #'' => 'USER_6', #
60     #'' => 'USER_7', #
61     #'' => 'USER_8', #
62     #'' => 'USER_9', #
63     #'' => 'USER_10', #
64     #'' => 'INFO_DIGITS', # VARCHAR(3) Info digits from the inbound leg, if applicable
65     #'' => 'RATE_INTERVAL', # TINYINT Rate interval used to bill the call (default: 60 seconds) ... create a new "upstream_granularity" field if we need this
66     #'' => 'DISCONNECT_CHARGE', # DECIMAL(15,4) The disconnect charge billed for the call
67     #'' => 'BILLING_DELAY', # SMALLINT Billing delay associated with the call
68     #'' => 'GRACE_PERIOD', # SMALLINT Grace period associated with the call
69     #'' => 'ACCOUNT_TYPE', # Account type from ACCOUNT_TYPES table
70   },
71   'batch_name' => 'fusionpbx',
72 );
73
74 1;