add svc_phone-radius-password config, RT#21445
authorIvan Kohler <ivan@freeside.biz>
Mon, 11 Nov 2013 05:45:02 +0000 (21:45 -0800)
committerIvan Kohler <ivan@freeside.biz>
Mon, 11 Nov 2013 05:45:02 +0000 (21:45 -0800)
FS/FS/Conf.pm
FS/FS/svc_phone.pm

index 6b9aab2..0eed8ee 100644 (file)
@@ -4767,6 +4767,17 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'svc_phone-radius-password',
+    'section'     => 'telephony',
+    'description' => 'Password when exporting svc_phone records to RADIUS',
+    'type'        => 'select',
+    'select_hash' => [
+      '' => 'Use default from svc_phone-radius-default_password config',
+      'countrycode_phonenum' => 'Phone number (with country code)',
+    ],
+  },
+
+  {
     'key'         => 'svc_phone-radius-default_password',
     'section'     => 'telephony',
     'description' => 'Default password when exporting svc_phone records to RADIUS',
index 72c609c..887f7be 100644 (file)
@@ -650,7 +650,13 @@ sub radius_check {
 
   my $conf = new FS::Conf;
 
-  $check{'User-Password'} = $conf->config('svc_phone-radius-default_password');
+  my $password;
+  if ( $conf->config('svc_phone-radius-password') eq 'countrycode_phonenum' ) {
+    $password = $self->countrycode. $self->phonenum;
+  } else {
+    $password = $conf->config('svc_phone-radius-default_password');
+  }
+  $check{'User-Password'} = $password;
 
   %check;
 }