X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fnetsapiens.pm;h=83f0f01847de007600ffcf746c9f7173a800c6db;hb=9a778387bc4bfc97d28b25a9c123700fc6c15062;hp=cf4b5e35cbdf97d00c98a63d871b0cc04e058248;hpb=165423e6ce43f8f87f329330bf92f422e718a768;p=freeside.git diff --git a/FS/FS/part_export/netsapiens.pm b/FS/FS/part_export/netsapiens.pm index cf4b5e35c..83f0f0184 100644 --- a/FS/FS/part_export/netsapiens.pm +++ b/FS/FS/part_export/netsapiens.pm @@ -21,7 +21,7 @@ tie my %options, 'Tie::IxHash', ; %info = ( - 'svc' => 'svc_phone', + 'svc' => [ 'svc_phone', ], # 'part_device', 'desc' => 'Provision phone numbers to NetSapiens', 'options' => \%options, 'notes' => <<'END' @@ -61,8 +61,7 @@ sub _ns_command { $args[0] .= $ns->buildQuery( { @_ } ); } - warn "$me $method ". $self->option($prefix.'url'). - " $command ". join(', ', @_). "\n" + warn "$me $method ". $self->option($prefix.'url'). join(', ', @args). "\n" if $self->option('debug'); my $auth = encode_base64( $self->option($prefix.'login'). ':'. @@ -73,10 +72,15 @@ sub _ns_command { $ns; } +sub ns_domain { + my($self, $svc_phone) = (shift, shift); + $svc_phone->domain || $self->option('domain'); +} + sub ns_subscriber { my($self, $svc_phone) = (shift, shift); - my $domain = $self->option('domain'); + my $domain = $self->ns_domain($svc_phone); my $phonenum = $svc_phone->phonenum; "/domains_config/$domain/subscriber_config/$phonenum"; @@ -92,7 +96,7 @@ sub ns_registrar { sub ns_devicename { my( $self, $svc_phone ) = (shift, shift); - my $domain = $self->option('domain'); + my $domain = $self->ns_domain($svc_phone); #my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; @@ -122,7 +126,7 @@ sub ns_device { sub ns_create_or_update { my($self, $svc_phone, $dial_policy) = (shift, shift, shift); - my $domain = $self->option('domain'); + my $domain = $self->ns_domain($svc_phone); #my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; @@ -239,7 +243,7 @@ sub _export_unsuspend { sub export_device_insert { my( $self, $svc_phone, $phone_device ) = (shift, shift, shift); - #my $domain = $self->option('domain'); + my $domain = $self->ns_domain($svc_phone); my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; @@ -257,7 +261,7 @@ sub export_device_insert { #'notes' => 'server' => 'SiPbx', - 'domain' => $self->option('domain'), + 'domain' => $domain, 'brand' => $phone_device->part_device->devicename,