#!/usr/bin/perl # # */5 * * * /home/ivan/freeside/bin/cdr-netsapiens.import ivan exportnum use strict; use vars qw( $DEBUG ); use REST::Client; use FS::UID qw(adminsuidsetup); use FS::Record qw(qsearchs); use FS::part_export; use FS::cdr; $DEBUG = 2; my $user = shift or die &usage; adminsuidsetup $user; my $exportnum = shift or die &usage; my $part_export = qsearchs('part_export', { 'exportnum' => $exportnum } ) or die "unknown exportnum $exportnum\n"; #find max time_release #SELECT MAX( #2009-02-19 20:17:37 my $time_release = '2009-01-01 00:00:00'; #retreive CDRs >= this time #XXX (in pages, this tops out at 20) _start=>0, _limit=>20 my $ns = $part_export->ns_command( 'GET', '/cdr/', 'time_release' => '$time_release,', '_sort' => '+time_release', ); #loop over them, double check duplicates, insert the rest my $content = $ns->responseContent; #20090219201719000016@SkyNet360.Com #