[freeside-commits] freeside/FS/FS/cdr kannel.pm,1.3,1.4
Erik Levinson
levinse at wavetail.420.am
Wed Jun 22 15:25:37 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/cdr
In directory wavetail.420.am:/tmp/cvs-serv11637/FS/FS/cdr
Modified Files:
kannel.pm
Log Message:
cdr/kannel.pm: change row parse format, RT10991
Index: kannel.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr/kannel.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- kannel.pm 22 Jun 2011 21:30:04 -0000 1.3
+++ kannel.pm 22 Jun 2011 22:25:35 -0000 1.4
@@ -14,16 +14,30 @@
'row_callback' => sub { my $row = shift;
return ' ' if $row =~ /.*Log (begins|ends)$/;
die "invalid row format for '$row'" unless
- $row =~ /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([A-Za-z ]+) (\[SMSC:\w+\] \[SVC:\w*\] \[ACT:\w*\] \[BINF:\w*\] \[FID:\w*\]) \[from:(\s|)(|\+)(\d+)\] \[to:(|\+)(\d+)\] (\[flags:.*?\]) \[msg:(\d+):(.*?)\] (\[udh:.*?\])$/;
- $row = "$1,$2,$3,$6,$8,$9,$10,$12";
+ $row =~ /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([A-Za-z ]+) (\[SMSC:\w+\] \[SVC:\w*\] \[ACT:\w*\] \[BINF:\w*\] \[FID:\w*\]) \[from:(.*?)\] \[to:(.*?)\] (\[flags:.*?\]) \[msg:(\d+):.*?\] (\[udh:.*?\])$/;
+ $row = "$1,$2,$3,$4,$5,$6,$7,$8";
$row;
},
'import_fields' => [
_cdr_date_parser_maker('startdate'),
'disposition',
'userfield', # [SMSC: ... FID...], five fields
- 'src',
- 'dst',
+
+ sub {
+ my($cdr, $src) = @_;
+ $src =~ s/[^\+\d]//g;
+ $src =~ /^(\+|)(\d+)$/
+ or die "unparsable number: $src"; #maybe we shouldn't die...
+ $cdr->src("$1$2");
+ },
+
+ sub {
+ my($cdr, $dst) = @_;
+ $dst =~ s/[^\+\d]//g;
+ $dst =~ /^(\+|)(\d+)$/
+ or die "unparsable number: $dst"; #maybe we shouldn't die...
+ $cdr->dst("$1$2");
+ },
sub { my($cdr, $flags) = @_;
$cdr->userfield($cdr->userfield." $flags");
More information about the freeside-commits
mailing list