summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2011-03-01 04:38:31 +0000
committermark <mark>2011-03-01 04:38:31 +0000
commit6f0d2394d35b47761f54991895cdf40c4e6bcc16 (patch)
treecb0c7ab262f2974a1fcc5529b4d8c11547a5747c
parente3a2ca0a7ef6e0931283136321ba8c1494b37c19 (diff)
VoipNow export, minor fixes
-rw-r--r--FS/FS/part_export/voipnow_did.pm8
-rw-r--r--bin/populate-areacodes2
2 files changed, 7 insertions, 3 deletions
diff --git a/FS/FS/part_export/voipnow_did.pm b/FS/FS/part_export/voipnow_did.pm
index cd13a44d5..514db8dcd 100644
--- a/FS/FS/part_export/voipnow_did.pm
+++ b/FS/FS/part_export/voipnow_did.pm
@@ -5,7 +5,6 @@ use Tie::IxHash;
use FS::Record qw(qsearch qsearchs dbh);
use FS::part_export;
use FS::areacode;
-use XML::Writer;
use XML::Simple 'XMLin';
use Net::SSLeay 'post_https';
use Cache::FileCache;
@@ -19,6 +18,7 @@ tie my %options, 'Tie::IxHash',
'login' => { label=>'VoipNow client login' },
'password' => { label=>'VoipNow client password' },
'country' => { label=>'Country (two-letter code)' },
+ 'cache_time' => { label=>'Cache lifetime (seconds)' },
;
%info = (
@@ -38,7 +38,8 @@ sub did_cache {
my $self = shift;
$CACHE ||= new Cache::FileCache( {
'namespace' => __PACKAGE__,
- 'default_expires_in' => 300,
+ 'default_expires_in' => $self->option('cache_time') || 300,
+ 'cache_root' => $FS::UID::cache_dir.'/cache'.$FS::UID::datasrc,
} );
return $CACHE->get($self->exportnum) || $self->reload_cache;
}
@@ -259,6 +260,9 @@ sub voipnow_command {
my $host = $self->machine;
my $path = "/soap2/${endpoint}_agent.php";
+ eval "use XML::Writer";
+ die $@ if $@;
+
warn "[$method] constructing request\n" if $DEBUG;
my $soap_request;
my $writer = XML::Writer->new(
diff --git a/bin/populate-areacodes b/bin/populate-areacodes
index f5e8ae105..7e4c52fdc 100644
--- a/bin/populate-areacodes
+++ b/bin/populate-areacodes
@@ -40,7 +40,7 @@ while(<$fh>) {
}
my $areacode = FS::areacode->new({
- 'npa' => $npa,
+ 'code' => $npa,
'state' => $statecode,
'country' => $countrycode,
'description' => $desc,