summaryrefslogtreecommitdiff
path: root/bin/cdr-voipnow.import
diff options
context:
space:
mode:
authormark <mark>2011-01-15 01:20:28 +0000
committermark <mark>2011-01-15 01:20:28 +0000
commit766974c6f23228b8e82cd650134d398d23f76c83 (patch)
treee49a53192bf6a92ca0577f3a81b2b140364c2c35 /bin/cdr-voipnow.import
parentc1cb6d9a3b98cdd6c9066677a87ec9162008c9cf (diff)
VoipNow documentation
Diffstat (limited to 'bin/cdr-voipnow.import')
-rwxr-xr-xbin/cdr-voipnow.import40
1 files changed, 36 insertions, 4 deletions
diff --git a/bin/cdr-voipnow.import b/bin/cdr-voipnow.import
index d9dbd0013..eb36010af 100755
--- a/bin/cdr-voipnow.import
+++ b/bin/cdr-voipnow.import
@@ -83,9 +83,6 @@ while ( $row = $sth->fetchrow_hashref ) {
}
);
print $row->{id},"\n" if $opt{v};
- # Since we're finding these records by ID range instead of flagging them
- # individually, we can't leave gaps. So rollback and die on any errors
- # except for duplicate cdrid.
if ( $row->{flow} eq 'out' ) {
$cdr->src($row->{'extension_number'});
$cdr->dst($row->{'partyid'});
@@ -114,6 +111,41 @@ print "Skipped $skipped duplicates.\n" if $skipped;
$mysql->disconnect;
sub usage {
- "Usage: \n cdr-mysql.import\n\t[ -v ]\n\t[ -H host ]\n\t-D database\n\t-U user\n\t-P password\n\tfreesideuser\n";
+ "Usage: \n cdr-voipnow.import\n\t[ -H host ]\n\t-D database\n\t-U user\n\t-P password\n\t[ -v ] [ -s start ] [ -e end ]\n\tfreesideuser\n";
}
+=head1 NAME
+
+cdr-voipnow.import - Import call data records (CDRs) from a 4psa VoipNow system
+
+=head1 SYNOPSIS
+
+ cdr-voipnow.import [ -H host ] -D database -U user -P password
+ [ -v ] [ -s start ] [ -e end ] freesideuser
+
+=head1 DESCRIPTION
+
+Connects to a MySQL database and downloads CDRs from the "call_history" table.
+The "id" field maps to "cdrid" in Freeside. Other than that, the following
+fields are imported: channel, duration, billsec, startdate, answerdate,
+disposition, src, dst. src and dst are inferred from the "extension_number"
+and "partyid" fields, with the value of the "flow" field (in or out) deciding
+which is the source number and which is the destination.
+
+Any import errors (except duplicates) will abort and roll back the
+transaction.
+
+=head1 OPTIONS
+
+-H, -D, -U, -P: parameters to connect to the database: host, database name
+user, password. Required, except -H, which defaults to localhost.
+
+-s: set the lowest CDR id to import. By default, the script will find
+the highest existing cdrid and import all CDRs with ids greater than that.
+-s overrides this and turns on duplicate checking.
+
+-e: set the highest CDR id to import. By default, this is unlimited.
+
+-v: report all CDR ids as they are imported.
+
+=cut