projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
referral credits overhaul, use billing events, agents can self-configure, limit to...
[freeside.git]
/
FS
/
FS
/
svc_phone.pm
diff --git
a/FS/FS/svc_phone.pm
b/FS/FS/svc_phone.pm
index
04d5960
..
237bbf5
100644
(file)
--- a/
FS/FS/svc_phone.pm
+++ b/
FS/FS/svc_phone.pm
@@
-1,12
+1,16
@@
package FS::svc_phone;
use strict;
package FS::svc_phone;
use strict;
-use vars qw( @ISA );
+use vars qw( @ISA @pw_set );
+use FS::Conf;
#use FS::Record qw( qsearch qsearchs );
use FS::svc_Common;
@ISA = qw( FS::svc_Common );
#use FS::Record qw( qsearch qsearchs );
use FS::svc_Common;
@ISA = qw( FS::svc_Common );
+#avoid l 1 and o O 0
+@pw_set = ( 'a'..'k', 'm','n', 'p-z', 'A'..'N', 'P'..'Z' , '2'..'9' );
+
=head1 NAME
FS::svc_phone - Object methods for svc_phone records
=head1 NAME
FS::svc_phone - Object methods for svc_phone records
@@
-53,6
+57,8
@@
primary key
Voicemail PIN
Voicemail PIN
+=item phone_name
+
=back
=head1 METHODS
=back
=head1 METHODS
@@
-89,6
+95,7
@@
sub table_info {
disable_select => 1,
},
'sip_password' => 'SIP password',
disable_select => 1,
},
'sip_password' => 'SIP password',
+ 'name' => 'Name',
},
};
}
},
};
}
@@
-114,7
+121,10
@@
Returns the phone number.
sub label {
my $self = shift;
sub label {
my $self = shift;
- $self->phonenum; #XXX format it better
+ my $phonenum = $self->phonenum; #XXX format it better
+ my $label = $phonenum;
+ $label .= ' ('.$self->phone_name.')' if $self->phone_name;
+ $label;
}
=item insert
}
=item insert
@@
-169,21
+179,39
@@
and replace methods.
sub check {
my $self = shift;
sub check {
my $self = shift;
+ my $conf = new FS::Conf;
+
my $phonenum = $self->phonenum;
my $phonenum = $self->phonenum;
- $phonenum =~ s/\D//g;
+ my $phonenum_check_method;
+ if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
+ $phonenum =~ s/\W//g;
+ $phonenum_check_method = 'ut_alpha';
+ } else {
+ $phonenum =~ s/\D//g;
+ $phonenum_check_method = 'ut_number';
+ }
$self->phonenum($phonenum);
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_numbern('countrycode')
$self->phonenum($phonenum);
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_numbern('countrycode')
- || $self->
ut_number
('phonenum')
+ || $self->
$phonenum_check_method
('phonenum')
|| $self->ut_anything('sip_password')
|| $self->ut_numbern('pin')
|| $self->ut_anything('sip_password')
|| $self->ut_numbern('pin')
+ || $self->ut_textn('phone_name')
;
return $error if $error;
$self->countrycode(1) unless $self->countrycode;
;
return $error if $error;
$self->countrycode(1) unless $self->countrycode;
+ unless ( length($self->sip_password) ) {
+
+ $self->sip_password(
+ join('', map $pw_set[ int(rand $#pw_set) ], (0..16) )
+ );
+
+ }
+
$self->SUPER::check;
}
$self->SUPER::check;
}
@@
-199,6
+227,35
@@
sub check_pin {
$check_pin eq $self->pin;
}
$check_pin eq $self->pin;
}
+=item radius_reply
+
+=cut
+
+sub radius_reply {
+ my $self = shift;
+ #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime
+ ();
+}
+
+=item radius_check
+
+=cut
+
+sub radius_check {
+ my $self = shift;
+ my %check = ();
+
+ my $conf = new FS::Conf;
+
+ $check{'User-Password'} = $conf->config('svc_phone-radius-default_password');
+
+ %check;
+}
+
+sub radius_groups {
+ ();
+}
+
=back
=head1 BUGS
=back
=head1 BUGS