From: Christopher Burger Date: Tue, 23 May 2017 14:06:26 +0000 (-0400) Subject: RT# 74523 - Moved bin/cdr-fusionpbx.import to FS/bin/freeside-cdr-freeswitch X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=9ae9f5269c0c380d52b00e896a451a42ac81adbd RT# 74523 - Moved bin/cdr-fusionpbx.import to FS/bin/freeside-cdr-freeswitch --- diff --git a/FS/bin/freeside-cdr-freeswitch b/FS/bin/freeside-cdr-freeswitch new file mode 100644 index 000000000..7bac6994e --- /dev/null +++ b/FS/bin/freeside-cdr-freeswitch @@ -0,0 +1,74 @@ +#!/usr/bin/perl + +use strict; +use Date::Parse 'str2time'; +use FS::cdr::Import; + +FS::cdr::Import->dbi_import( + 'dbd' => 'Pg', + 'database' => 'fusionpbx', + 'table' => 'v_xml_cdr', + 'primary_key' => 'uuid', + 'status_table' => 'freeside_billing', + 'column_map' => { #freeside => fusionpbx + #'cdrid' => 'uuid', #Primary key + #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID) + 'uniqueid' => 'uuid', # + #'' => 'ENTRY_TYPE', # + 'accountcode' => 'accountcode', # + #'' => 'ACCOUNT', # + #'' => 'ACCOUNT_GROUP', # + 'startdate' => sub { str2time(shift->{'start_stamp'}); }, + 'answerdate' => sub { str2time(shift->{'answer_stamp'}); }, + 'enddate' => sub { str2time(shift->{'end_stamp'}); }, + #'' => 'PARENT_ACCOUNT_ID', # + #'' => 'PARENT_ACCOUNT', # + #'' => 'LOGIN_NAME', # + #varchars not ints 'upstream_rateid' => 'RATE_SCHEDULE', # + #varchars not ints 'upstream_rateplanid' => 'RATE_PLAN', # + 'channel' => 'NODE', # + #'' => 'NODE_TYPE', # + #'' => 'ORIGIN', # + #'dst' => sub { $_[0]->{COUNTRY_CODE}. $_[0]->{NPA}. + # $_[0]->{NXX}. $_[0]->{LOCAL_NUMBER}; + # }, + #'description' => 'DESCRIPTION', # or upstream_dst_regionname ? + #'' => 'PER_CALL_CHARGE', # + #'' => 'PER_MINUTE_CHARGE', # + #'' => 'PER_CALL_SURCHARGE', # + #'' => 'PER_MINUTE_SURCHARGE', # + 'duration' => 'duration', # + 'billsec' => sub { int( shift->{'billsec'} * 60 + .49 ); }, # + #'upstream_price' => 'AMOUNT', # + #'' => 'PACKAGED_BALANCE_INDEX', # + #'upstream_currency' => 'CURRENCY', # + #'' => 'CONVERSION_RATE', # + 'lastapp' => 'last_app', # + #'src' => 'ANI', # 'clid' => 'ANI', # + 'dst' => sub { $_[0]->{'COUNTRY_CODE'} !~ /^1/ + ? "011". $_[0]->{'DETAIL'} + : $_[0]->{'DETAIL'}; + }, + #'' => 'SALES_GROUP', # + #'' => 'TAX_GROUP', # + #'userfield' => 'USER_1', # + #'' => 'USER_2', # + #'' => 'USER_3', # + #'' => 'USER_4', # + #'' => 'USER_5', # + #'' => 'USER_6', # + #'' => 'USER_7', # + #'' => 'USER_8', # + #'' => 'USER_9', # + #'' => 'USER_10', # + #'' => 'INFO_DIGITS', # VARCHAR(3) Info digits from the inbound leg, if applicable + #'' => 'RATE_INTERVAL', # TINYINT Rate interval used to bill the call (default: 60 seconds) ... create a new "upstream_granularity" field if we need this + #'' => 'DISCONNECT_CHARGE', # DECIMAL(15,4) The disconnect charge billed for the call + #'' => 'BILLING_DELAY', # SMALLINT Billing delay associated with the call + #'' => 'GRACE_PERIOD', # SMALLINT Grace period associated with the call + #'' => 'ACCOUNT_TYPE', # Account type from ACCOUNT_TYPES table + }, + 'batch_name' => 'fusionpbx', +); + +1; \ No newline at end of file diff --git a/bin/cdr-fusionpbx.import b/bin/cdr-fusionpbx.import deleted file mode 100755 index 7bac6994e..000000000 --- a/bin/cdr-fusionpbx.import +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Date::Parse 'str2time'; -use FS::cdr::Import; - -FS::cdr::Import->dbi_import( - 'dbd' => 'Pg', - 'database' => 'fusionpbx', - 'table' => 'v_xml_cdr', - 'primary_key' => 'uuid', - 'status_table' => 'freeside_billing', - 'column_map' => { #freeside => fusionpbx - #'cdrid' => 'uuid', #Primary key - #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID) - 'uniqueid' => 'uuid', # - #'' => 'ENTRY_TYPE', # - 'accountcode' => 'accountcode', # - #'' => 'ACCOUNT', # - #'' => 'ACCOUNT_GROUP', # - 'startdate' => sub { str2time(shift->{'start_stamp'}); }, - 'answerdate' => sub { str2time(shift->{'answer_stamp'}); }, - 'enddate' => sub { str2time(shift->{'end_stamp'}); }, - #'' => 'PARENT_ACCOUNT_ID', # - #'' => 'PARENT_ACCOUNT', # - #'' => 'LOGIN_NAME', # - #varchars not ints 'upstream_rateid' => 'RATE_SCHEDULE', # - #varchars not ints 'upstream_rateplanid' => 'RATE_PLAN', # - 'channel' => 'NODE', # - #'' => 'NODE_TYPE', # - #'' => 'ORIGIN', # - #'dst' => sub { $_[0]->{COUNTRY_CODE}. $_[0]->{NPA}. - # $_[0]->{NXX}. $_[0]->{LOCAL_NUMBER}; - # }, - #'description' => 'DESCRIPTION', # or upstream_dst_regionname ? - #'' => 'PER_CALL_CHARGE', # - #'' => 'PER_MINUTE_CHARGE', # - #'' => 'PER_CALL_SURCHARGE', # - #'' => 'PER_MINUTE_SURCHARGE', # - 'duration' => 'duration', # - 'billsec' => sub { int( shift->{'billsec'} * 60 + .49 ); }, # - #'upstream_price' => 'AMOUNT', # - #'' => 'PACKAGED_BALANCE_INDEX', # - #'upstream_currency' => 'CURRENCY', # - #'' => 'CONVERSION_RATE', # - 'lastapp' => 'last_app', # - #'src' => 'ANI', # 'clid' => 'ANI', # - 'dst' => sub { $_[0]->{'COUNTRY_CODE'} !~ /^1/ - ? "011". $_[0]->{'DETAIL'} - : $_[0]->{'DETAIL'}; - }, - #'' => 'SALES_GROUP', # - #'' => 'TAX_GROUP', # - #'userfield' => 'USER_1', # - #'' => 'USER_2', # - #'' => 'USER_3', # - #'' => 'USER_4', # - #'' => 'USER_5', # - #'' => 'USER_6', # - #'' => 'USER_7', # - #'' => 'USER_8', # - #'' => 'USER_9', # - #'' => 'USER_10', # - #'' => 'INFO_DIGITS', # VARCHAR(3) Info digits from the inbound leg, if applicable - #'' => 'RATE_INTERVAL', # TINYINT Rate interval used to bill the call (default: 60 seconds) ... create a new "upstream_granularity" field if we need this - #'' => 'DISCONNECT_CHARGE', # DECIMAL(15,4) The disconnect charge billed for the call - #'' => 'BILLING_DELAY', # SMALLINT Billing delay associated with the call - #'' => 'GRACE_PERIOD', # SMALLINT Grace period associated with the call - #'' => 'ACCOUNT_TYPE', # Account type from ACCOUNT_TYPES table - }, - 'batch_name' => 'fusionpbx', -); - -1; \ No newline at end of file