summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-06-30 02:54:54 +0000
committerivan <ivan>2009-06-30 02:54:54 +0000
commit55c933db01346b350ad08c03246ca0db0473c056 (patch)
tree0191f004aca113b027990ffcdd666d7d5b7c5de2 /FS
parent665067cef48a5516e0bfb2dd79d99b8495e25ee5 (diff)
add DID association w/user? docs from netsapiens rough... RT#5226
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_export/netsapiens.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/FS/FS/part_export/netsapiens.pm b/FS/FS/part_export/netsapiens.pm
index 172f7b053..22124e951 100644
--- a/FS/FS/part_export/netsapiens.pm
+++ b/FS/FS/part_export/netsapiens.pm
@@ -63,6 +63,15 @@ sub ns_subscriber {
"/domains_config/$domain/subscriber_config/$phonenum";
}
+sub ns_dialplan {
+ my($self, $svc_phone) = (shift, shift);
+
+ my $countrycode = $svc_phone->countrycode;
+ my $phonenum = $svc_phone->phonenum;
+
+ "/dialplans/DID+Table/dialplan_config/sip:$countrycode$phonenum@*"
+}
+
sub ns_create_or_update {
my($self, $svc_phone, $dial_policy) = (shift, shift, shift);
@@ -80,6 +89,8 @@ sub ns_create_or_update {
$lastname = $cust_main->get('last');
}
+ #create user
+
my $ns = $self->ns_command( 'PUT', $self->ns_subscriber($svc_phone),
'subscriber_login' => $phonenum.'@'.$domain,
'firstname' => $firstname,
@@ -94,6 +105,17 @@ sub ns_create_or_update {
join(', ', $self->ns_parse_response( $ns->responseContent ) );
}
+ #map DID to user
+ my $ns2 = $self->ns_command( 'PUT', $self->ns_dialplan($svc_phone),
+ 'to_user' => $phonenum.'@'.$domain,
+ 'to_host' => $domain,
+ );
+
+ if ( $ns2->responseCode !~ /^2/ ) {
+ return $ns2->responseCode. ' '.
+ join(', ', $self->ns_parse_response( $ns2->responseContent ) );
+ }
+
'';
}