From 0c759132a02d9403f391c6a997cbe754a4dba407 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 21 Sep 2015 20:40:36 -0700 Subject: [PATCH] import a2billing username as charged_party, RT#32909 --- .../bin/freeside-cdr-a2billing-import | 60 +++++++++++++++++++--- 1 file changed, 52 insertions(+), 8 deletions(-) rename bin/cdr-a2billing.import => FS/bin/freeside-cdr-a2billing-import (83%) diff --git a/bin/cdr-a2billing.import b/FS/bin/freeside-cdr-a2billing-import similarity index 83% rename from bin/cdr-a2billing.import rename to FS/bin/freeside-cdr-a2billing-import index 6677fa0a0..923f5fbb1 100755 --- a/bin/cdr-a2billing.import +++ b/FS/bin/freeside-cdr-a2billing-import @@ -90,13 +90,15 @@ my %disposition = ( 9 => 'INVALIDARGS', ); -my @cols = ( qw( - id sessionid - starttime stoptime sessiontime real_sessiontime - terminatecauseid - calledstation src - id_tariffplan id_ratecard sessionbill -) ); +my @cols = ( + 'cc_call.id as id', 'cc_card.username as username', + qw( sessionid + starttime stoptime sessiontime real_sessiontime + terminatecauseid + calledstation src + id_tariffplan id_ratecard sessionbill + ) +); my $sql = 'SELECT '.join(',', @cols). " FROM $table". ' WHERE freesidestatus IS NULL' . @@ -128,6 +130,7 @@ while ( $row = $sth->fetchrow_hashref ) { billsec => $row->{real_sessiontime}, dst => $row->{calledstation}, src => $row->{src}, + charged_party => $row->{username}, upstream_rateplanid => $row->{id_tariffplan}, upstream_rateid => $row->{id_ratecard}, # I think? upstream_price => $row->{sessionbill}, @@ -153,7 +156,7 @@ $mysql->disconnect; sub usage { "Usage: - cdr-a2billing.import + freeside-cdr-a2billing-import [ -H host ] -D database -U user @@ -162,3 +165,44 @@ sub usage { freesideuser "; } + +=head1 NAME + +freeside-cdr-a2billing-import - Download CDRs from an A2Billing MySQL database + +=head1 SYNOPSIS + + freeside-cdr-a2billing-import [ -H host ] -D database -U user -P password + [ -T tablename ] + [ -s start ] [ -e end ] [ -c cdrtypenum ] + freesideuser + +-H: database hostname + +-D: database name + +-U: database username + +-P: database password + +-T: table to import, defaults to cc_call + +-s: start date, e.g. 4/20/2015 + +-e: end date, e.g. 12/25/2015 + +-c: cdrtypenum to set, defaults to none + +freesideuser: freeside username + +=head1 DESCRIPTION + +=head1 BUGS + +=head1 SEE ALSO + +L + +=cut + +1; -- 2.11.0