From: mark Date: Wed, 22 Sep 2010 19:35:18 +0000 (+0000) Subject: CIA and Infinite Conferencing cdr formats, RT#8788 X-Git-Tag: TORRUS_1_0_9~282 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=343befcb41d5ab76173645ceb8ac235ca7b92d35 CIA and Infinite Conferencing cdr formats, RT#8788 --- diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index e8be08056..cc25a1716 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -768,8 +768,11 @@ sub _cdr_date_parse { if ( $date =~ /^\s*(\d{4})\D(\d{1,2})\D(\d{1,2})\D+(\d{1,2})\D(\d{1,2})\D(\d{1,2})(\D|$)/ ) { ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 ); - } elsif ( $date =~ /^\s*(\d{1,2})\D(\d{1,2})\D(\d{4})\s+(\d{1,2})\D(\d{1,2})\D(\d{1,2})(\D|$)/ ) { + } elsif ( $date =~ /^\s*(\d{1,2})\D(\d{1,2})\D(\d{4})\s+(\d{1,2})\D(\d{1,2})(?:\D(\d{1,2}))?(\D|$)/ ) { + # 8/26/2010 12:20:01 + # optionally without seconds ($mon, $day, $year, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 ); + $sec = 0 if !defined($sec); } elsif ( $date =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d+\.\d+)(\D|$)/ ) { # broadsoft: 20081223201938.314 ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 ); diff --git a/FS/FS/cdr/cia.pm b/FS/FS/cdr/cia.pm new file mode 100644 index 000000000..61343338a --- /dev/null +++ b/FS/FS/cdr/cia.pm @@ -0,0 +1,39 @@ +package FS::cdr::cia; + +use strict; +use vars qw( @ISA %info ); +use FS::cdr qw(_cdr_date_parser_maker); + +@ISA = qw(FS::cdr); + +%info = ( + 'name' => 'Client Instant Access', + 'weight' => 510, + 'header' => 1, + 'type' => 'csv', + 'sep_char' => "\t", + 'import_fields' => [ + skip(2), # Reseller Account Number, Confirmation Number + 'description', # Conference Name + skip(3), # Organization Name, Bill Code, Q&A Active + 'userfield', # Chairperson Name + skip(2), # Conference Start Time, Conference End Time + _cdr_date_parser_maker('startdate'), # Connect Time + _cdr_date_parser_maker('enddate'), # Disconnect Time + sub { my($cdr, $data, $conf, $param) = @_; + $cdr->duration($data); + $cdr->billsec( $data); + }, # Duration + skip(2), # Roundup Duration, User Name + 'dst', # DNIS + 'src', # ANI + skip(2), # Call Type, Toll Free, + skip(1), # Chair Conference Entry Code + 'accountcode', # Participant Conference Entry Code, + ], + +); + +sub skip { map {''} (1..$_[0]) } + +1; diff --git a/FS/FS/cdr/infinite.pm b/FS/FS/cdr/infinite.pm new file mode 100644 index 000000000..90560c8c7 --- /dev/null +++ b/FS/FS/cdr/infinite.pm @@ -0,0 +1,41 @@ +package FS::cdr::infinite; + +use strict; +use vars qw( @ISA %info ); +use FS::cdr qw(_cdr_date_parser_maker); + +@ISA = qw(FS::cdr); + +%info = ( + 'name' => 'Infinite Conferencing', + 'weight' => 520, + 'header' => 1, + 'type' => 'csv', + 'sep_char' => ',', + 'import_fields' => [ + 'uniqueid', # billid + skip(3), # confid, invoicenum, acctgrpid + 'accountcode', # accountid ("Room Confirmation Number") + skip(2), # billingcode ("Room Billingcode"), confname + skip(1), # participant_type + 'startdate', # starttime_t + skip(2), # startdate, starttime + sub { my($cdr, $data, $conf, $param) = @_; + $cdr->duration($data * 60); + $cdr->billsec( $data * 60); + }, # minutes + 'dst', # dnis + 'src', # ani + skip(8), # calltype, calltype_text, confstart_t, confstartdate, + # confstarttime, confminutes, conflegs, ppm + 'upstream_price', # callcost + skip(13), # confcost, rppm, rcallcost, rconfcost, + # auxdata[1..4], ldval, sysname, username, cec, pec + 'userfield', # unnamed field + ], + +); + +sub skip { map {''} (1..$_[0]) } + +1; diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index 00aee9e47..702dc1bcc 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -55,6 +55,8 @@ die "access denied" my $edit_data = $FS::CurrentUser::CurrentUser->access_right('Edit rating data'); +my $conf = new FS::Conf; + my $areboxes = 0; my $title = 'Call Detail Records'; @@ -148,14 +150,21 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) { # src/dest/charged_party ### -if ( $cgi->param('src') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { - ( my $src = $1 ) =~ s/\D//g; +my $phonenum = qr/^\s*([\d\-\+\ ]+)\s*$/; +my $x = qr/\D/; +if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) { + $phonenum = qr/^\s*([\d\-\+\ A-Za-z]+)\s*$/; + $x = qr/[^\dA-Za-z]/; +} + +if ( $cgi->param('src') =~ $phonenum ) { + ( my $src = $1 ) =~ s/$x//g; $hashref->{'src'} = $src; push @search, "src = '$src'"; } -if ( $cgi->param('dst') =~ /^\s*([\d\-\+ ]+)\s*$/ ) { - ( my $dst = $1 ) =~ s/\D//g; +if ( $cgi->param('dst') =~ $phonenum ) { + ( my $dst = $1 ) =~ s/$x//g; $hashref->{'dst'} = $dst; push @search, "dst = '$dst'"; } @@ -166,8 +175,8 @@ if ( $cgi->param('dcontext') =~ /^\s*(.+)\s*$/ ) { push @search, "dcontext = '$dcontext'"; } -if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { - ( my $charged_party = $1 ) =~ s/\D//g; +if ( $cgi->param('charged_party') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; #$hashref->{'charged_party'} = $charged_party; #push @search, "charged_party = '$charged_party'"; #XXX countrycode @@ -178,8 +187,8 @@ if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { push @qsearch, $search; } -if ( $cgi->param('charged_party_or_src') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { - ( my $charged_party = $1 ) =~ s/\D//g; +if ( $cgi->param('charged_party_or_src') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; #$hashref->{'charged_party'} = $charged_party; #push @search, "charged_party = '$charged_party'"; #XXX countrycode @@ -191,7 +200,6 @@ if ( $cgi->param('charged_party_or_src') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { push @qsearch, $search; } - ### # cdrbatchnum (or legacy cdrbatch) ###