more options for netsapiens export, #14958
[freeside.git] / FS / FS / svc_phone.pm
index e3d18e0..118748e 100644 (file)
@@ -503,7 +503,16 @@ sub check {
 
   $self->countrycode(1) unless $self->countrycode;
 
-  unless ( length($self->sip_password) ) {
+  unless ( length($self->pin) ) {
+    my $random_pin = $conf->config('svc_phone-random_pin');
+    if ( $random_pin =~ /^\d+$/ ) {
+      $self->pin(
+        join('', map int(rand(10)), 0..($random_pin-1))
+      );
+    }
+  }
+
+  unless ( length($self->sip_password) ) { # option for this?
 
     $self->sip_password(
       join('', map $pw_set[ int(rand $#pw_set) ], (0..16) )
@@ -658,6 +667,10 @@ on inbound processing status.
 =item default_prefix => "XXX": Also accept the phone number of the service prepended 
 with the chosen prefix.
 
+=item begin, end: Start and end of a date range, as unix timestamp.
+
+=item cdrtypenum: Only return CDRs with this type number.
+
 =item disable_src => 1: Only match on "charged_party", not "src".
 
 =item by_svcnum: not supported for svc_phone
@@ -696,6 +709,10 @@ sub get_cdrs {
     $hash{'freesidestatus'} = $options{'status'}
       if exists($options{'status'});
   }
+
+  if ($options{'cdrtypenum'}) {
+    $hash{'cdrtypenum'} = $options{'cdrtypenum'};
+  }
   
   my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';