# LRN lookup
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
+use IO::Socket::SSL;
use Cpanel::JSON::XS qw(decode_json);
@ISA = qw(FS::Record);
-@EXPORT_OK = qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+@EXPORT_OK = qw( _cdr_date_parser_maker _cdr_min_parser_maker _cdr_date_parse );
$DEBUG = 0;
$me = '[FS::cdr]';
my $self = shift;
my $field = shift;
- my $ua = LWP::UserAgent->new;
+ my $ua = LWP::UserAgent->new(
+ 'ssl_opts' => {
+ verify_hostname => 0,
+ SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+ },
+ );
+
my $url = 'https://ws.freeside.biz/get_lrn';
my %content = ( 'support-key' => $support_key,
tie my %import_formats, 'Tie::IxHash',
map { $_ => $cdr_info{$_}->{'name'} }
- sort { $cdr_info{$a}->{'weight'} <=> $cdr_info{$b}->{'weight'} }
+
+ #this is not doing anything useful anymore
+ #sort { $cdr_info{$a}->{'weight'} <=> $cdr_info{$b}->{'weight'} }
+ #so just sort alpha
+ sort { lc($cdr_info{$a}->{'name'}) cmp lc($cdr_info{$b}->{'name'}) }
+
grep { exists($cdr_info{$_}->{'import_fields'}) }
keys %cdr_info;
# Telos 2014-10-10T05:30:33Z
($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
$options{gmt} = 1;
+ } elsif ( $date =~ /^(\d+):(\d+):(\d+)\.\d+ \w+ (\w+) (\d+) (\d+)$/ ) {
+ ($hour, $min, $sec, $mon, $day, $year) = ( $1, $2, $3, $4, $5, $6 );
+ $mon = { # Acme Packet: 15:54:56.868 PST DEC 18 2017
+ # My best guess of month abbv they may use
+ JAN => '01', FEB => '02', MAR => '03', APR => '04',
+ MAY => '05', JUN => '06', JUL => '07', AUG => '08',
+ SEP => '09', OCT => '10', NOV => '11', DEC => '12'
+ }->{$mon};
} else {
die "unparsable date: $date"; #maybe we shouldn't die...
}
#
# Used by FS::Upgrade to migrate to a new database.
+use FS::upgrade_journal;
sub _upgrade_data {
my ($class, %opts) = @_;
+ return if FS::upgrade_journal->is_done('cdr_cdrbatchnum');
+
warn "$me upgrading $class\n" if $DEBUG;
my $sth = dbh->prepare(
$sth->execute($cdrbatchnum{$cdrbatch}, $cdrbatch) or die $sth->errstr;
}
+ FS::upgrade_journal->set_done('cdr_cdrbatchnum');
+
}
=item ip_addr_sql FIELD RANGE
=cut
1;
-