4 use Date::Parse 'str2time';
7 FS::cdr::Import->dbi_import(
9 'database' => 'TEL_DATA',
11 'primary_key' => 'BILLING_ID',
12 'status_table' => 'FREESIDE_BILLING',
13 'column_map' => { #freeside => IVR
14 'cdrid' => 'BILLING_ID', #Primary key
15 #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID)
16 'uniqueid' => 'CALL_ID', #
17 #'' => 'ENTRY_TYPE', #
18 'accountcode' => 'ACCOUNT_ID', #
20 #'' => 'ACCOUNT_GROUP', #
21 'startdate' => sub { str2time(shift->{'START_DATE_TIME'}); },
22 'answerdate' => sub { str2time(shift->{'CONNECT_DATE_TIME'}); },
23 'enddate' => sub { str2time(shift->{'DISCONNECT_DATE_TIME'}); },
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', #
32 #'dst' => sub { $_[0]->{COUNTRY_CODE}. $_[0]->{NPA}.
33 # $_[0]->{NXX}. $_[0]->{LOCAL_NUMBER};
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' => 'ACTUAL_DURATION', #
41 'billsec' => sub { int( shift->{'QUANTITY'} * 60 + .49 ); }, #
42 'upstream_price' => 'AMOUNT', #
43 #'' => 'PACKAGED_BALANCE_INDEX', #
44 'upstream_currency' => 'CURRENCY', #
45 #'' => 'CONVERSION_RATE', #
46 'lastapp' => 'MODULE_NAME', #
47 'src' => 'ANI', # 'clid' => 'ANI', #
48 'dst' => sub { $_[0]->{'DNIS'} =~ /^011/
52 #'' => 'SALES_GROUP', #
54 'userfield' => 'USER_1', #
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