X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fpbxware.pm;h=53cb12bf97a2570ec013e2c23d2c6b48023255de;hb=acf13acb795d75feca7614688c5510a47822cee9;hp=3da4c2ad1b4906369da8987ff745aed866308dac;hpb=4d27115f3f5d290602d1c656d8b20d5bbfc30f4d;p=freeside.git diff --git a/FS/FS/part_export/pbxware.pm b/FS/FS/part_export/pbxware.pm index 3da4c2ad1..53cb12bf9 100644 --- a/FS/FS/part_export/pbxware.pm +++ b/FS/FS/part_export/pbxware.pm @@ -19,7 +19,9 @@ our $DEBUG = 0; tie my %options, 'Tie::IxHash', 'apikey' => { label => 'API key' }, 'debug' => { label => 'Enable debugging', type => 'checkbox', value => 1 }, -; # best. API. ever. + 'ext' => { label => 'PBXware "ext" field in CDR download request', }, + 'cdrtype' => { label => 'PBXware "cdrtype" field in CDR download request', }, +; our %info = ( 'svc' => [qw(svc_phone)], @@ -28,7 +30,7 @@ our %info = ( 'notes' => <<'END' <P>Export to <a href="www.bicomsystems.com/pbxware-3-8">Bicom PBXware</a> softswitch.</P> -<P><I>This export does not provision services.</I> Currently you will need +<P><I>This export does not yet provision services.</I> Currently you will need to provision trunks and extensions through PBXware. The export only downloads CDRs.</P> <P>Set the export machine to the name or IP address of your PBXware server, @@ -96,6 +98,10 @@ sub import_cdrs { end => $ed->strftime('%b-%d-%Y'), endtime => $ed->strftime('%H:%M:%S'), ); + + $opt{$_} = $self->option($_) + for grep length( $self->option($_) ), qw( ext cdrtype ); + # unlike Certain Other VoIP providers, this one does proper pagination if # the result set is too big to fit in a single chunk. my $page = 1; @@ -140,6 +146,11 @@ sub import_cdrs { uniqueid => $uniqueid, ); @hash{@names} = @$row; + # strip non-numeric junk that sometimes gets appended to these (it + # causes problems creating Freeside detail records) + foreach (qw(src dst)) { + $hash{$_} =~ s/\D*$//; + } my $cdr = FS::cdr->new(\%hash); $error = $cdr->insert; @@ -163,6 +174,10 @@ sub api_request { my $self = shift; my ($method, $content) = @_; $DEBUG ||= 1 if $self->option('debug'); + +# kludge to curb excessive paranoia in LWP 6.0+ +local $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; + my $url = 'https://' . $self->machine; my $request = POST($url, [ %$content,