X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fnetsapiens.pm;h=b8068940b7160035d11f09b68f6432a5dad2f39c;hb=d0221fabd4656b3a04251ca6168cc45f54d23574;hp=a24bc3727cbcfb97b2f4c5b3dc0e5e958f97e4b1;hpb=b3e081bbd2ba95554687a531bc134c00026a3669;p=freeside.git diff --git a/FS/FS/part_export/netsapiens.pm b/FS/FS/part_export/netsapiens.pm index a24bc3727..b8068940b 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'). ':'. @@ -85,10 +84,6 @@ sub ns_subscriber { sub ns_registrar { my($self, $svc_phone) = (shift, shift); - my $domain = $self->option('domain'); - my $countrycode = $svc_phone->countrycode; - my $phonenum = $svc_phone->phonenum; - $self->ns_subscriber($svc_phone). '/registrar_config/'. $self->ns_devicename($svc_phone); } @@ -97,19 +92,21 @@ sub ns_devicename { my( $self, $svc_phone ) = (shift, shift); my $domain = $self->option('domain'); - my $countrycode = $svc_phone->countrycode; + #my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; - "sip:$countrycode$phonenum@$domain"; + #"sip:$countrycode$phonenum\@$domain"; + "sip:$phonenum\@$domain"; } sub ns_dialplan { my($self, $svc_phone) = (shift, shift); - my $countrycode = $svc_phone->countrycode; + #my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; - "/dialplans/DID+Table/dialplan_config/sip:$countrycode$phonenum@*" + #"/dialplans/DID+Table/dialplan_config/sip:$countrycode$phonenum\@*" + "/dialplans/DID+Table/dialplan_config/sip:$phonenum\@*" } sub ns_device { @@ -125,7 +122,7 @@ sub ns_create_or_update { my($self, $svc_phone, $dial_policy) = (shift, shift, shift); my $domain = $self->option('domain'); - my $countrycode = $svc_phone->countrycode; + #my $countrycode = $svc_phone->countrycode; my $phonenum = $svc_phone->phonenum; my( $firstname, $lastname ); @@ -158,6 +155,7 @@ sub ns_create_or_update { #Piece 2 - sip device creation my $ns2 = $self->ns_command( 'PUT', $self->ns_registrar($svc_phone), + 'termination_match' => $self->ns_devicename($svc_phone) ); if ( $ns2->responseCode !~ /^2/ ) { @@ -168,7 +166,7 @@ sub ns_create_or_update { #Piece 3 - DID mapping to user my $ns3 = $self->ns_command( 'PUT', $self->ns_dialplan($svc_phone), - 'to_user' => $countrycode.$phonenum, + 'to_user' => $phonenum, 'to_host' => $domain, ); @@ -250,7 +248,7 @@ sub export_device_insert { 'PUT', $self->ns_device($svc_phone, $phone_device), 'line1_enable' => 'yes', 'device1' => $self->ns_devicename($svc_phone), - 'line1_ext' => $countrycode.$phonenum, + 'line1_ext' => $phonenum, , #'line2_enable' => 'yes', #'device2' =>