[freeside-commits] branch FREESIDE_4_BRANCH updated. 25066e634afc8601b5ddd48023bfbdea10e2b04b
Ivan
ivan at 420.am
Mon Mar 20 10:30:59 PDT 2017
The branch, FREESIDE_4_BRANCH has been updated
via 25066e634afc8601b5ddd48023bfbdea10e2b04b (commit)
from 68a521bb43e58806109ce1b11d627ea3d6026a06 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 25066e634afc8601b5ddd48023bfbdea10e2b04b
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Mar 20 10:30:58 2017 -0700
asterisk v12 CDRs, RT#71704
diff --git a/FS/bin/freeside-cdr-asterisk_sql b/FS/bin/freeside-cdr-asterisk_sql
index b0f2020..6e63ff0 100755
--- a/FS/bin/freeside-cdr-asterisk_sql
+++ b/FS/bin/freeside-cdr-asterisk_sql
@@ -43,8 +43,8 @@ if ( $engine =~ /^mysql/ ) {
}
my @cols = ();
-if ( $opt{V} > 12 ) {
- push @cols, qw( start answer end );
+if ( $opt{V} >= 12 ) {
+ push @cols, qw( id start answer end );
} else {
push @cols, qw( calldate );
}
@@ -85,11 +85,12 @@ while ( my $row = $sth->fetchrow_hashref ) {
my $cdr = FS::cdr->new($row);
- if ( $opt{V} > 12 ) {
+ if ( $opt{V} >= 12 ) {
$cdr->calldate($cdr->start);
$cdr->startdate(str2time($cdr->start));
$cdr->answerdate(str2time($cdr->answer));
$cdr->enddate(str2time($cdr->end));
+ $cdr->cdrid($cdr->id);
} else {
$cdr->startdate(str2time($cdr->calldate));
}
@@ -100,19 +101,25 @@ while ( my $row = $sth->fetchrow_hashref ) {
if ($error) {
warn "failed import: $error\n";
} else {
+
$imports++;
- if( $dbi->do("UPDATE cdr SET freesidestatus = 'done'
- WHERE calldate = ? AND src = ? AND dst = ?",
- undef,
- $row->{'calldate'},
- $row->{'src'},
- $row->{'dst'},
-
- ) ) {
- $updates++;
+
+ my $where = '';
+ my @args = ();
+ if ( $opt{V} >= 12 ) {
+ $where = 'id = '. $row->{'id'};
+ @args = ( undef );
+ } else {
+ $where = 'calldate = ? AND src = ? AND dst = ?';
+ @args = ( undef, $row->{'calldate'}, $row->{'src'}, $row->{'dst'}, );
+ }
+
+ if ( $dbi->do("UPDATE $table SET freesidestatus = 'done' $where", @args) ) {
+ $updates++;
} else {
warn "failed to set status: ".$dbi->errstr."\n";
}
+
}
}
-----------------------------------------------------------------------
Summary of changes:
FS/bin/freeside-cdr-asterisk_sql | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
More information about the freeside-commits
mailing list